Module livekit.agents.beta.tools.send_dtmf
Functions
async def send_dtmf_events(ctx: livekit.agents.voice.events.RunContext,
events: list[DtmfEvent]) ‑> livekit.agents.llm.tool_context.ToolResult-
Expand source code
@function_tool async def send_dtmf_events( ctx: RunContext, events: list[DtmfEvent], ) -> ToolResult: """ Send a list of DTMF events to the telephony provider. Successful sends do not request a follow-up reply. Call when: - User wants to send DTMF events """ try: room = ctx.session.room_io.room except RuntimeError: room = get_job_context().room for event in events: try: code = dtmf_event_to_code(event) await room.local_participant.publish_dtmf(code=code, digit=event.value) await asyncio.sleep(DEFAULT_DTMF_PUBLISH_DELAY) except Exception: raise ToolError("Failed to send DTMF events.") from None return ToolResult(f"Successfully sent DTMF events: {', '.join(events)}", reply_required=False)Send a list of DTMF events to the telephony provider. Successful sends do not request a follow-up reply.
Call when: - User wants to send DTMF events