Module livekit.agents.beta.tools.send_dtmf
Functions
async def send_dtmf_events(ctx: livekit.agents.voice.events.RunContext,
events: list[DtmfEvent]) ‑> str-
Expand source code
@function_tool async def send_dtmf_events( ctx: RunContext, events: list[DtmfEvent], ) -> str: """ Send a list of DTMF events to the telephony provider. 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 as e: return f"Failed to send DTMF event: {event.value}. Error: {str(e)}" return f"Successfully sent DTMF events: {', '.join(events)}"Send a list of DTMF events to the telephony provider.
Call when: - User wants to send DTMF events