how to setup inbound, outbound call for agent, can...
# ask-ai
e
how to setup inbound, outbound call for agent, can i use twilio directly or i've to do it through SIP
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.
I'm happy to help you set up inbound and outbound calls for agents in LiveKit! To do this, you'll want to use SIP (Session Initiation Protocol). Twilio can be a great SIP provider to integrate with LiveKit, though direct integration with Twilio without SIP isn't supported just yet. For inbound calls: You can use Twilio Programmable Voice along with TwiML to forward calls to LiveKit, or if you're looking for more advanced features, setting up a SIP trunk is a great option. For outbound calls: You'll need to configure a SIP trunk with Twilio. This setup lets LiveKit initiate calls through Twilio and seamlessly bridge them into LiveKit rooms. If you'd like, I’d be more than happy to walk you through the detailed steps for either setup—just let me know! Sources: Inbound calls with Twilio Voice | LiveKit docs | Create and configure a Twilio SIP trunk | LiveKit docs | README.md | packages/sip--um-actually/README.md | Agents telephony integration | LiveKit Docs
e
so for inbound i don't have to use SIP , i can directly use twilio, right?
t
When it comes to inbound calls, you can definitely use Twilio Programmable Voice with TwiML to forward those calls to LiveKit. I want to mention that SIP is still part of the process here, since TwiML will guide the calls to a SIP endpoint in LiveKit. So, while you don’t have to set up a full SIP trunk for inbound calls, SIP does play an important role. If you'd like, I’m here to help you get this set up smoothly—just let me know!
e
and SIP is a service from livekit cloud and chargeable
t
Thank you for reaching out! I’d love to help clarify how SIP works in LiveKit Cloud. SIP is a chargeable service that has its own pricing, separate from the regular connection minutes. The cost depends on the number of SIP participants, how long the session lasts, and the rate per SIP minute. If you’re already using LiveKit Cloud, the great news is that SIP is ready to go without any extra setup. If you’d like, you can always check the specific pricing details on your LiveKit Cloud dashboard, or just let me know—I’m here to help with any questions you have! Sources: LiveKit Cloud billing | LiveKit docs | SIP overview | LiveKit docs
e
can i self host or use it my own
t
Absolutely, you can self-host SIP with LiveKit instead of using LiveKit Cloud. When you choose to self-host LiveKit, you'll just need to deploy the SIP service separately. Quick Setup: The simplest way to get started with self-hosting is by using Docker Compose:
Copy code
wget https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml
docker compose up
This will get a local LiveKit server and SIP server up and running, connected to Redis. To make sure everything works smoothly, please ensure the SIP signaling port (5060) and the media port range (10000-20000) are accessible from the Internet. If you'd like, I’m here to help with more detailed steps—just let me know! Sources: Self-hosted SIP server | LiveKit docs | test/integration/sip_test.go | SIP overview | LiveKit docs
e
how to setup variables like apikey and secret for docker container
t
Setting up the API key and secret for the LiveKit SIP Docker container is straightforward, and I’m here to guide you through it! You have a few options to choose from, so let’s explore them together: 1. Using Environment Variables Directly:
Copy code
docker run --rm \
    -e LIVEKIT_API_KEY=<your-api-key> \
    -e LIVEKIT_API_SECRET=<your-api-secret> \
    -e LIVEKIT_WS_URL=ws://host.docker.internal:7880 \
    --network host \
    livekit/sip
2. Using a Configuration File: You can create a
config.yaml
file with this content:
Copy code
log_level: debug
api_key: <your-api-key>
api_secret: <your-api-secret>
ws_url: ws://host.docker.internal:7880
redis:
  address: host.docker.internal:6379
Then, just run the container like this:
Copy code
docker run --rm \
    -e SIP_CONFIG_BODY="`cat config.yaml`" \
    --network host \
    livekit/sip
3. Using Docker Compose: If you prefer, you can download the Docker Compose file and get started quickly:
Copy code
wget https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml
docker compose up
If you have any questions or run into any bumps along the way, please don’t hesitate to reach out. I’m here to help you every step of the way! Sources: README.md | Self-hosted SIP server | LiveKit docs
e
what's the process for setting up inbound, outbound call for agent, assume my agent is running on my server what's the process look like, what are the important components and information i need for now i will be using SIP service from livekit cloud
t
Hi there! To help you set up inbound and outbound calls for agents using LiveKit Cloud SIP, I’ve put together a simple overview of the process and what you’ll need: 1. Required Components: • Inbound Calls: You’ll want an inbound trunk along with a dispatch rule to route calls smoothly to your LiveKit rooms. • Outbound Calls: An outbound trunk is needed so you can initiate calls from LiveKit to external numbers. 2. SIP Provider Setup: • Start by creating a SIP trunk with your provider (like Twilio). • Then, purchase a phone number and link it to that SIP trunk. • Make sure to configure the SIP trunk to point to your LiveKit SIP endpoint. 3. LiveKit SIP Configuration: • Use the LiveKit Cloud UI or API to set up your inbound and outbound trunks. • Don’t forget to create dispatch rules to control how calls get routed into rooms. 4. Call Workflows: • Inbound: Calls come through the SIP trunk and are bridged into LiveKit rooms seamlessly. • Outbound: You can use the CreateSIPParticipant API to start calls, which will go out through the outbound trunk. 5. Important Information: • Remember to set environment variables like
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, and
LIVEKIT_WS_URL
. • Also, ensure that SIP signaling (port 5060) and media ports (10000-20000) are open and accessible. If you’d like, I’d be happy to walk you through any of these steps in more detail—just let me know! I’m here to help. Sources: SIP trunk setup | LiveKit docs | packages/sip--um-actually/src/setup-livekit.ts | README.md | SIP cloud and region pinning | LiveKit docs | Agents telephony integration | LiveKit Docs
e
in addition to SIP cloud service, do i have to also setup SIP trunk on provider like twilio and are they chargeable in addition to livekit cloud sip?
t
Absolutely! Along with using LiveKit Cloud SIP, you'll also want to set up a SIP trunk with a provider like Twilio. This SIP trunk is what connects your phone numbers to the public telephone network and helps route calls smoothly to LiveKit. Just a heads-up, both LiveKit Cloud SIP and Twilio services come with their own charges. LiveKit charges based on usage like call duration and participants, while Twilio has separate fees for the SIP trunk, phone numbers, and call minutes. These costs are separate, so it’s good to keep that in mind. If you’d like, I’m here to help you with setting up the SIP trunk or to walk you through the pricing details. Just let me know! Sources: SIP overview | LiveKit docs | Create and configure a Twilio SIP trunk | LiveKit docs | README.md
e
can you create a diagram for the overall flow
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!