for inbound calls - when does the agent "pickup" t...
# ask-ai
i
for inbound calls - when does the agent "pickup" the call? is it when the agent session is started?
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you please help me understand a bit more? Are you asking about a specific feature or integration within LiveKit, like a call center setup or maybe a custom implementation? Knowing this will really help me give you the best possible answer.
i
when an inbound call comes in to an agent, is there a specific time or function that causes the phone call to be picked up?
t
Let's walk through how an inbound call gets picked up by an agent in LiveKit. It happens when a few key conditions come together: • Inbound Trunk Configuration: First, you need to have a SIP inbound trunk set up to receive calls from your SIP trunking provider. • Dispatch Rule Matching: Then, a dispatch rule that matches the call specifies the agent (for example, by
agent_name
), and that agent is dispatched to the room created for the call. • Agent Name Matching: The agent will answer the call only if the
agent_name
in their
WorkerOptions
matches the
agent_name
in the dispatch rule. This ensures the right person picks up. • Call Status Transition: The call status changes from "ringing" to "active" when the SIP participant subscribes to remote audio tracks—usually when the agent joins and starts handling the audio. • Agent Answers Programmatically: Finally, the agent's code runs the
generate_reply
method of the
AgentSession
to greet the caller, which effectively answers the call. By following these steps, you can be confident that calls are routed correctly and answered smoothly by your agents. If you have any questions about any of these points, feel free to ask—I’m here to help! Sources: Agents telephony integration | LiveKit Docs | Accepting inbound calls | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs | SIP participant | LiveKit Docs
i
yea im trying to understand better when the call goes from ringing to active, is it when session.start() is called?
t
Thanks so much for your question! I’d love to help clarify how the call status changes from "ringing" to "active." This change isn’t directly linked to calling
session.start()
. Instead, it happens because of SIP call lifecycle events. In particular, the status switches to "active" when the SIP participant subscribes to any remote audio tracks, which means the call has successfully connected and audio is flowing. While
session.start()
is indeed used to start an agent session and connect it to a room, it doesn’t directly cause the SIP call status to change from "ringing" to "active." That transition really depends on SIP signaling and media subscription. I hope this helps clear things up—please feel free to ask if you have any more questions! Sources: SIP participant | LiveKit Docs | examples/src/tool_call_disfluency.ts
i
so the agent automatically joins the room and the call gets picked up when the worker receives the dispatch request and accepts the job?
t
Could you please let me know if you're using any specific LiveKit feature or integration, like a SIP-based call handling setup or a custom worker implementation? Understanding this will really help me guide you better through how the dispatch and job acceptance process works for you. I'm here to help!