boundless-author-7811
02/23/2026, 12:45 PMtall-airline-16756
02/23/2026, 12:45 PMtall-airline-16756
02/23/2026, 12:45 PMringing state and when it transitions to active (answered) or hangup (not answered).
Recommended approach (programmatic — best for automated tracking)
1. Listen for participant_attributes_changed events for the SIP participant.
2. When sip.callStatus changes to ringing, record a timestamp (start).
3. When sip.callStatus changes to active or hangup, record a second timestamp (end).
4. Ring duration = end − start.
Example logic (pseudocode):
• on `participant_attributes_changed`:
◦ if participant is SIP and sip.callStatus changed:
▪︎ if `ringing`: store ring_start_time
▪︎ if active or `hangup`: compute time.now() - ring_start_time and log/store the result
What to log/save
• sip.callStatus transitions and their timestamps
• identifiers like sip.phoneNumber or sip.trunkID so you can correlate the duration to a specific call
• whether the final state was active (answered) or hangup (not answered)
Alternative/manual approach (Agent Observability)
• Use the LiveKit Cloud Dashboard’s Agent Insights timeline and logs.
• Inspect the timeline or trace events to find when ringing began and when active or hangup occurred; subtract those timestamps to get ring duration.
• This is useful for post-call analysis and troubleshooting.
If you’d like, I can:
• Provide a concrete code example in your preferred language (JavaScript, Python, or TypeScript).
• Suggest a data model for storing these timestamps in your database.
• Help with specific event names or attribute paths if you share which SDK or integration you’re using.
Which option do you prefer, and what language/SDK are you using?
Sources: SIP Lifecycle Management Agent | LiveKit Documentation | Streamline troubleshooting with Agent Observability | Outbound Calling Script | LiveKit Documentation