best-battery-56004
03/07/2026, 12:24 AMtall-airline-16756
03/07/2026, 12:24 AMtall-airline-16756
03/07/2026, 12:24 AMparticipant_left webhook includes a reason field (e.g., "client_initiated"). Use this for downstream processing or logging outside your application.
• SDK / server-side listeners: Listen for participant state changes or room events in your application and check the participant’s close/disconnect reason. Example pattern:
1. Attach a listener for participant left/disconnect events.
2. Inspect the participant close reason value.
3. Branch your logic by reason: treat CLIENT_INITIATED as user hang-up, and PARTICIPANT_REMOVED / ROOM_DELETED as agent/server hang-up.
If you’d like, tell me:
• Which SDK or webhook integration you’re using (JavaScript, Python, webhook consumer), and
• Whether you want an example for event handling in code or the exact webhook payload layout.
I can then give a short code sample or the exact fields to parse for your environment.
Sources: Server-side | livekit/livekit_composite | DeepWikibest-battery-56004
03/07/2026, 12:26 AMtall-airline-16756
03/07/2026, 12:26 AMCLIENT_INITIATED) inside a LiveKit agent so you can tell user hang-up vs. agent hang-up. You can access that reason from the agent runtime via room/participant events or from the job context at session end.
Can you tell me which environment/SDK you want the example for? (Python agent, JS, or Go agent?) Below are the common ways — pick the one you need and I’ll provide a concise code sample for that SDK.
What to read/inspect
• Use the agent session lifecycle: ctx.disconnect_reason is available when the session ends and holds the disconnect reason (for example, CLIENT_INITIATED).
• Listen for participant disconnect events on the room: those event callbacks include the disconnect reason (e.g., participant_disconnected / participant_left with reason like CLIENT_INITIATED, PARTICIPANT_REMOVED, or ROOM_DELETED).
How to get it (summary)
• From JobContext at shutdown:
a. Wait for session end or participant leave inside your agent.
b. Read ctx.disconnect_reason to get values such as CLIENT_INITIATED or ROOM_DELETED.
• From room/participant event handler:
a. Register a listener for participant disconnect/left events.
b. Inspect the event payload or the participant object for the close reason field (e.g., participant.close_reason or the reason argument passed to the handler).
If you tell me which SDK (Python, JavaScript, or Go) I’ll send a short concrete example showing exactly where to read ctx.disconnect_reason or how to handle the participant disconnect event and parse the reason.
Sources: server-sdk-go | livekit/livekit_composite | DeepWiki | Server-side | livekit/livekit_composite | DeepWikibest-battery-56004
03/09/2026, 6:43 PMon_participant_disconnected event with DisconnectReason.CLIENT_INITIATED even for SIP/voice channel?tall-airline-16756
03/09/2026, 6:44 PMon_participant_disconnected (or participant_left) event with CLIENT_INITIATED.
• You can also observe the SIP-specific attribute sip.callStatus changing to hangup. Monitoring on_participant_attributes_changed for that attribute provides an additional confirmation that the SIP caller hung up.
If you want, I can provide a short code example for your agent SDK (Python, JS, or Go) showing: 1) the disconnect event handler reading the disconnect reason, and 2) monitoring sip.callStatus as a backup signal. Which SDK should I use?
Sources: SIP Lifecycle Management Agent | LiveKit Documentation