From 65c74232803c0bb8ff4abaee9af7adb8caa02c35 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Sun, 27 Apr 2025 14:26:40 -0400 Subject: [PATCH] Add other dial-in event handlers --- .../phone-chatbot-daily-twilio-sip/bot.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/phone-chatbot-daily-twilio-sip/bot.py b/examples/phone-chatbot-daily-twilio-sip/bot.py index 69010e0cc..3d4afbfcd 100644 --- a/examples/phone-chatbot-daily-twilio-sip/bot.py +++ b/examples/phone-chatbot-daily-twilio-sip/bot.py @@ -136,6 +136,25 @@ async def run_bot(room_url: str, token: str, call_id: str, sip_uri: str) -> None logger.error(f"Failed to forward call: {str(e)}") raise + @transport.event_handler("on_dialin_connected") + async def on_dialin_connected(transport, data): + logger.debug(f"Dial-in connected: {data}") + + @transport.event_handler("on_dialin_stopped") + async def on_dialin_stopped(transport, data): + logger.debug(f"Dial-in stopped: {data}") + + @transport.event_handler("on_dialin_error") + async def on_dialin_error(transport, data): + logger.error(f"Dial-in error: {data}") + # If there is an error, the bot should leave the call + # This may be also handled in on_participant_left with + # await task.cancel() + + @transport.event_handler("on_dialin_warning") + async def on_dialin_warning(transport, data): + logger.warning(f"Dial-in warning: {data}") + # Run the pipeline runner = PipelineRunner() await runner.run(task)