in the agent code - where to start the recording ...
# ask-ai
t
in the agent code - where to start the recording if it is telephony call - do we call post ctx.connect or when?
✅ 1
t
Thanks for reaching out, Yashi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — great question. Regarding when to start recording a telephony call in agent code: • If you use automatic recording via SIP auto‑egress (recommended), configure it in your SIP dispatch rule and you don’t need to manually start recording. • If you start recording manually, do it after the room and session are active — i.e., start the agent session, call
await ctx.connect()
, then initiate the egress/recording request. The room must be connected and participants present for recording to work. • Note: enabling
record=True
when calling
session.start(...)
enables agent observability recording and doesn’t require separate timing. Would you like the exact code snippet for manual egress start in your agent? Sources: examples/bank-ivr | livekit/livekit_composite | DeepWiki | docs/examples/recording_agent/README.md | livekit-agents/livekit/agents/voice/agent_session.py, with interactive elements