average-horse-37689
10/07/2025, 11:54 PMtall-airline-16756
10/07/2025, 11:54 PMtall-airline-16756
10/07/2025, 11:55 PMparticipantDisconnected event in your application code. This event fires whenever a participant, including those using SIP, leaves the room. You can use this snippet: room.on('participantDisconnected', participant => { /* handle disconnect */ });
• Keep an eye on the sip.callStatus attribute to track real-time call state changes. When the call ends, you’ll see it update to hangup.
• Make sure your Twilio SIP trunk is set up correctly with the right origination URL and credentials—this helps avoid any signaling hiccups.
• Also, double-check that your application is actively subscribed to the room events and that nothing’s blocking event delivery, like network interruptions.
If you find that disconnect events still aren’t coming through, a helpful tip is to cross-reference Twilio’s call logs using the sip.twilio.callSid attribute. This way, you can confirm exactly when and why the call ended.
Sources: quickstart/src/joinroom.js | Making outbound calls | LiveKit Docs | packages/livekit-rtc/src/proto/participant_pb.ts | Tests/PlayMode/RoomTests.cs | SIP participant | LiveKit Docsaverage-horse-37689
10/07/2025, 11:56 PMtall-airline-16756
10/07/2025, 11:56 PMparticipant_disconnected event in the Python SDK, which should fire when a caller hangs up. Let’s walk through some steps together to see why it might not be firing:
• First, please double-check that you’re using the exact event name: participant_disconnected (with underscores), not participantDisconnected (camelCase).
• Make sure your event handler is set up correctly. Here’s a simple example you can compare with:
@room.on("participant_disconnected")
def on_participant_disconnected(participant):
print(f"Participant disconnected: {participant.identity}")
• If you’re working with SIP participants, sometimes disconnection is indicated through participant_attributes_changed. Keep an eye on the sip.callStatus attribute for the value hangup.
• Turning on debug logging can be really helpful to spot any errors or missed events. You can do this with:
import logging
logging.basicConfig(level=logging.DEBUG)
• Also, it’s a good idea to confirm your SDK is updated to the latest version, as older versions might have some event propagation issues.
If you’re still running into trouble, please feel free to share any related logs or details about how the disconnection is happening (like SIP hangup or server-side termination). I’m here to support you through this!
Sources: stream_audio.py | terminal-client/client.py | Connecting to LiveKit | LiveKit Docs | telephony/sip_lifecycle.py | livekit-rtc/livekit/rtc/_proto/room_pb2.pyirapid-noon-12288
10/10/2025, 1:04 PMtall-airline-16756
10/10/2025, 1:06 PMsip.callStatus attribute for SIP participants. When it switches to hangup, you can immediately handle the disconnection.
• Consider using a silence detection system to monitor user activity, so you can disconnect participants after a set period of inactivity. For example, tracking the last time someone spoke and disconnecting them if the silence goes beyond your threshold.
• Make sure your SIP trunk is correctly configured to send signaling updates to LiveKit, since any misconfiguration might delay or block disconnection events.
If you'd like, I’m here to help you implement these steps or troubleshoot the issue further. Just let me know!
Sources: packages/livekit-server-sdk/src/SipClient.ts | How to detect and handle silence during calls | SIP & Telephony Applications | livekit/livekit_composite | DeepWiki | livekit-api/livekit/api/sip_service.py | pkg/sip/participant.go