astonishing-camera-14040
02/17/2026, 6:58 PMtall-airline-16756
02/17/2026, 6:58 PMtall-airline-16756
02/17/2026, 6:58 PM@server.rtc_session(agent_name="my-telephony-agent")
async def my_agent(ctx: JobContext):
# agent logic
• If your dispatch rule lists agentName "my-telephony-agent", the running agent must use that exact name.
1. (Optional) Enable outbound calls from the agent
◦ Configure an outbound trunk in LiveKit with Twilio SIP credentials if your agent needs to place calls.
◦ Use the agent API (for example ctx.api.sip.create_sip_participant()) to programmatically create a SIP participant and initiate outbound calls.
1. Test the flow
◦ Dial the Twilio number. Twilio should forward the call to your LiveKit SIP endpoint.
◦ LiveKit’s dispatch rule should match and connect the call to a room where your agent is present.
Common areas that cause issues
• Network reachability: Twilio must reach your server. If your server is only on localhost behind NAT without port forwarding or a public hostname, Twilio cannot reach it.
• Ports: SIP (5060) + media RTP ports need to be open/forwarded. Confirm any cloud/VPN/firewall path allows SIP + RTP.
• Agent name mismatch: Dispatch rules match agent names exactly. Confirm spelling and casing.
• SIP formatting: Ensure the SIP URI and Twilio SIP domain settings match what LiveKit expects.
If you want, I can help next with:
• Specific CLI/JSON for a dispatch rule you can apply.
• Example Twilio SIP domain/trunk values and SIP URI formatting.
• Troubleshooting steps if calls fail to reach your server (tests to run, logs to check).
• Instructions to test outbound calls from an agent.
Which of these would you like help with now? Also tell me:
• Is your LiveKit server behind NAT or on a public IP/domain?
• Do you want inbound only, outbound, or both?
• What OS/environment is your agent running in (so I can tailor firewall/port advice)? Sources: Agents telephony integration | LiveKit Documentation