From 4f8f7b8d1d41ec88d9c41752f4d97f0eaa4eb0e3 Mon Sep 17 00:00:00 2001 From: Jon Taylor Date: Mon, 1 Jul 2024 19:21:16 +0100 Subject: [PATCH] added on_call_state event to prevent idle vms --- examples/deployment/flyio-example/bot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/deployment/flyio-example/bot.py b/examples/deployment/flyio-example/bot.py index dbac0cfeb..cc68f5522 100644 --- a/examples/deployment/flyio-example/bot.py +++ b/examples/deployment/flyio-example/bot.py @@ -84,6 +84,11 @@ async def main(room_url: str, token: str): async def on_participant_left(transport, participant, reason): await task.queue_frame(EndFrame()) + @transport.event_handler("on_call_state_updated") + async def on_call_state_updated(transport, state): + if state == "left": + await task.queue_frame(EndFrame()) + runner = PipelineRunner() await runner.run(task)