What's process for integrating agent on phone call...
# ask-ai
e
What's process for integrating agent on phone call, what options are available.
t
Thanks for reaching out, Aman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit offers several wonderful options to help you integrate agents into phone calls smoothly: • Inbound Call Handling: You can set up LiveKit to receive inbound calls via a SIP trunk, which then routes them into a LiveKit room where an agent can join and assist the caller. • Outbound Call Initiation: With the
create_sip_participant
API, you can easily initiate outbound calls right from a LiveKit room. • DTMF Support: This lets you detect keypad inputs from callers, which can be used to trigger helpful actions like menu navigation or call transfers. • Call Transfer: You can programmatically transfer active calls to another number using SIP REFER, with options for both cold and warm transfers. • Voicemail Detection: LiveKit can detect when a call is answered by voicemail and handle it in the best way. • Agent Dispatch Control: You have full control over when and how agents are assigned to rooms and calls by explicitly assigning agent names. To get started with these features, you'll want to set up a SIP trunk with a provider like Twilio, use a multimodal agent, and configure event handlers for SIP-specific events. Please feel free to reach out if you'd like me to walk you through any of these options in more detail—I’m here to help! Sources: Agents telephony integration | LiveKit Docs | agent.py | README.md | OpenAI and LiveKit partner to turn Advanced Voice into an API
e
so what i need for SIP, currently i've a mobile number from twilio where i want if someone called it should be attended by the agent
t
Let's walk through setting up SIP integration with your Twilio mobile number for inbound calls together. Here’s a simple step-by-step guide to help you get started: 1. Environment Setup: First, you'll want to configure these environment variables: ◦
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, `LIVEKIT_URL`: These are your LiveKit server credentials. ◦ `LIVEKIT_SIP_URI`: This is the SIP URI provided by LiveKit. ◦ `TWILIO_PHONE_NUMBER`: Your Twilio mobile number goes here. ◦
TWILIO_ACCOUNT_SID
, `TWILIO_AUTH_TOKEN`: Your Twilio account credentials. ◦
TWILIO_SIP_USERNAME
, `TWILIO_SIP_PASSWORD`: These are the SIP credentials you generate in Twilio. 1. Configure Twilio SIP Trunk: Next, create a SIP trunk in Twilio and set the origination URL to the LiveKit SIP URI (for example,
sip:sip.livekit.cloud;transport=tcp
). ◦ Link your Twilio phone number to this SIP trunk. ◦ Create a SIP credentials list in Twilio, and make sure to set the username and password in your environment variables. 1. Enable Inbound Calls: Double-check that your Twilio trunk is set to forward calls to LiveKit. The Twilio Programmable Voice guide is a great resource if you need more details. 2. Set Up LiveKit Inbound Trunk: Use LiveKit’s API or setup scripts to create an inbound trunk using your Twilio phone number and SIP credentials. 3. Create Dispatch Rules: Define rules in LiveKit so incoming calls are routed to the right rooms. 4. Run Setup Scripts: Finally, run the setup scripts provided (
setup-twilio.ts
and
setup-livekit.ts
) to complete the configuration. Once you’ve completed these steps, calls to your Twilio number will smoothly route to LiveKit, allowing an agent to join and assist the caller. If you have any questions or need a hand with any part of this, just let me know—I’m here to help! Sources: packages/sip--um-actually/README.md | README.md | SIP inbound trunk | LiveKit docs