cool-boots-48258
10/02/2025, 10:26 AMtall-airline-16756
10/02/2025, 10:26 AMtall-airline-16756
10/02/2025, 10:26 AMend_session to recognize when the user wants to wrap things up. This way, we can make sure everything is tidied up properly when the session ends.
2. Ensure Bot Completes Goodbye: To make sure the bot’s farewell message is fully delivered before closing the session, you can use allow_interruptions=False or wait_for_playout(). This keeps the goodbye smooth and complete.
3. End the Room Session: When it’s time, use the delete_room API to end the session for everyone involved, including the caller. This also stops the telephony session if Twilio is connected through SIP.
4. Twilio Integration: Deleting a LiveKit room automatically ends the linked SIP session, so the Twilio call disconnects too. If you want more control, you can use Twilio’s REST API or set up a webhook to track call status updates.
If you’d like, I’d be happy to help you set up SIP trunking between Twilio and LiveKit to keep your call states perfectly in sync. Just let me know!
Sources: tests/test_agent_session.py | Docs::Agents | Docs::Agents | packages/sip--um-actually/README.mdcool-boots-48258
10/02/2025, 11:35 AMtall-airline-16756
10/02/2025, 11:36 AMend_call Function Tool: This handy tool deletes the current room, sends a goodbye message, and gracefully ends the call. It’s a great way to make sure everything wraps up nicely.
2. Or use the Close or CloseWithStatus Methods: The Close method will end the inbound call by sending a BYE signal or ending the INVITE with a busy status. Meanwhile, CloseWithStatus lets you customize the status code and message when you end the call.
If you’d like, I’m here to walk you through how to implement either of these options step-by-step. Just let me know!
Sources: pkg/sip/inbound.go | telephony/sip_lifecycle.py