SIP session ctx.makeSessionReport is giving none f...
# ask-ai
w
SIP session ctx.makeSessionReport is giving none for duration
t
Thanks for reaching out, Chiranjeevi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your note that
ctx.makeSessionReport
in a SIP session is returning
None
for the
duration
field. Likely causes • The session report is being generated before the session has fully ended, so final metrics (including duration) aren’t yet populated. • The session ended abruptly (no clean shutdown), so finalization that computes duration didn’t run. • The report is being created from the wrong lifecycle hook (not after cleanup/post-processing). What you can try (most likely fix first) 1. Ensure you call
makeSessionReport
from the session end callback (for example, inside
on_session_end
). This callback runs after the session closes and metrics are finalized. 2. If you explicitly shut down sessions, use a graceful shutdown (for example
agent_session.shutdown()
with draining/cleanup enabled) so final metrics are computed before the report is made. 3. Avoid calling
makeSessionReport
while the session is still active or during intermediate processing steps. 4. If your session can terminate abruptly, add a short delay or an explicit finalization step in
on_session_end
before calling
makeSessionReport
to allow internal cleanup to complete. What I need from you if the above doesn’t resolve it • Where/when you call
makeSessionReport
(which callback or code path). • A minimal snippet showing the session lifecycle: start, shutdown, and where
makeSessionReport
is invoked. • Whether sessions sometimes end cleanly vs. abruptly (any logs showing errors at end of session). If you share that snippet and a short description of how the session ends, I’ll point out exactly where to move the call or how to add finalization so
duration
is populated. Sources: Agents (Python) | livekit/livekit_composite | DeepWiki | Redacting PII from agent logs and transcripts | LiveKit | Job lifecycle | LiveKit Documentation