nutritious-businessperson-79241
03/06/2026, 10:55 AMtall-airline-16756
03/06/2026, 10:55 AMtall-airline-16756
03/06/2026, 10:55 AMRoomEvent.Connected) as the start time.
• Listen for the disconnect event (e.g., RoomEvent.Disconnected) as the end time.
• Compute end_time - start_time to get session duration.
• Example pattern (pseudo):
start_time = None
@room.on("connected")
def on_connected():
global start_time
start_time = time.time()
@room.on("disconnected")
def on_disconnected():
if start_time:
duration = time.time() - start_time
# store/report duration
1. Track per-participant duration:
◦ Record when each participant joins and leaves (participant connected/disconnected events).
◦ Save timestamps server-side or in your analytics store to calculate per-user durations and aggregate totals for the room.
1. For SIP calls:
◦ Monitor SIP call lifecycle attributes (e.g., sip.callStatus values like "dialing", "active", "hangup") to determine when the call is active and compute duration from active → hangup.
1. For Agents / automated sessions:
◦ Use the session or job context (e.g., JobContext in Agents) together with manual timing to capture session start/end and include session reports after completion.
If you’d like, tell me:
• Are you using LiveKit Cloud or self-hosted LiveKit?
• Do you want total room time (sum of all participants), per-participant time, or just wall-clock duration for the room itself?
• Do you prefer dashboard/automatic tracking or a programmatic approach so I can provide a short code example tailored to your SDK (JavaScript, Python, etc.)?
I can then give exact code snippets or steps for your setup.
Sources: Say hello to improved Cloud analytics | Agents (Python) | livekit/livekit_composite | DeepWiki | SIP Lifecycle Management Agent | LiveKit Documentation