when a participant disconnects, livekit automatica...
# ask-ai
i
when a participant disconnects, livekit automatically begins call shutdown after room_departure seconds right? is there a way to manually cancel the shutdown?
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! Could you share a bit more about why you'd like to cancel the automatic call shutdown? For instance, are you hoping to keep the room open for others to join, or is there a particular reason you'd like to delay the shutdown? I'm here to help figure this out with you!
i
yea so, we retry outbound sip attempts with create_sip_participant if we get a 480 from a previous attempt (maximum 3 retries). im noticing that there are cases where we get a 480 (which causes a participant disconnected event to fire), begin the process for a retry, we call create_sip_participant, and the call shuts down during the retry.
t
I understand that managing call shutdowns during SIP participant retries can be a bit tricky. LiveKit doesn’t have a built-in feature to prevent this, but don’t worry—we have some ways to handle it together: • You can manage retries externally within your application logic. • Consider adjusting the
ringing_timeout
or setting custom request deadlines to give more time for the call setup. • Keep an eye on the SIP participant status using the
sip.callStatus
attribute, and you can manually trigger retries or recover the call as needed. Please feel free to reach out if you’d like me to walk you through this with a code example or any further help using the LiveKit SDKs—I’m here to support you! Sources: cmd/lk/sip.go | pkg/service/sip.go | examples/warm-transfer/warm_transfer.py | telephony/sip_lifecycle.py | Making outbound calls | LiveKit Docs
i
the ringing_timeout is 70, and what i think is happening is the call is shutting down during create_sip_participant, is that possible?
t
I understand that the documentation doesn’t clearly state whether a call shutdown can happen during the execution of
create_sip_participant
, and that can be a bit confusing. From what we’ve seen, errors during this operation might cause shutdown behavior in some cases. If you’re noticing the call shutting down at the same time, it could be due to external triggers or timeout settings. To help get to the bottom of this, you might want to: • Look into any external triggers or events that could be causing the shutdown. • Double-check your timeout settings to make sure they work well with your retry logic. • Keep a log of the events to see if the shutdown is actually overlapping with the
create_sip_participant
process. If you’d like, I’m here to help you with debugging or setting up logging so we can trace what’s happening more clearly. Just let me know! Sources: Making outbound calls | LiveKit Docs | cmd/lk/sip.go | pkg/service/sip.go | agent.py
i
so calling create_sip_participant should cancel the shutdown timeout from a participant disconnection event?
t
I understand that the documentation doesn’t clearly mention whether calling
create_sip_participant
cancels a shutdown timeout triggered by a participant disconnection event. This detail isn’t explicitly covered, and I can see how that might be a bit confusing. If you’re noticing unexpected shutdowns, it could help to add some extra logic to manage room activity or to prevent shutdowns during retries. I’m here to help if you’d like to explore some workarounds or dive deeper into debugging this behavior together. Just let me know! Sources: SIP APIs | LiveKit Docs | SIP participant | LiveKit Docs | Connecting to LiveKit | LiveKit Docs
i
what logic should i add to prevent shutdowns during retries?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!