c
hi
t
Thanks for reaching out, Arun. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — welcome! How can I help you today? If you’re not sure where to start, tell me what you’re trying to do (e.g., set up a room, join a call, configure auth, debug an error) and share any relevant details like project/room IDs, SDK/platform (web, iOS, Android), and any error messages.
c
how to setup livekit sip server with twilio
t
You're asking how to set up LiveKit SIP with Twilio — here’s a concise step-by-step guide. Tell me which part you want more detail on (Twilio trunk, LiveKit trunks/dispatch, secure trunking, or TwiML alternative). 1. Configure a Twilio SIP Trunk • Create a SIP trunk (CLI or Console). Note the trunk SID. • Set inbound origination URI to your LiveKit SIP endpoint, e.g.
sip:<your-sip-endpoint>
(or
sips:
for Secure Trunking). • For outbound, create a credential list (Voice → Credential lists) and attach it under the trunk’s Termination → Authentication. • Associate a phone number with the trunk. (Reference: Create and configure a Twilio SIP trunk)[https://docs.livekit.io/sip/quickstarts/configuring-twilio-trunk] 1. Configure LiveKit for inbound calls • Create an inbound trunk JSON:
Copy code
{
  "trunk": {
    "name": "My inbound trunk",
    "numbers": [
      "+15105550123"
    ]
  }
}
• Create the inbound trunk with
lk sip inbound create inbound-trunk.json
. • Create a dispatch rule to route incoming calls into rooms, e.g. a rule with
"roomPrefix": "call-"
, and apply with
lk sip dispatch create dispatch-rule.json
. (Reference: SIP trunk setup)[https://docs.livekit.io/sip/quickstarts/configuring-sip-trunk] 1. Configure LiveKit for outbound calls • Create an outbound trunk JSON with Twilio trunk address and credentials:
Copy code
{
  "trunk": {
    "name": "My outbound trunk",
    "address": "<my-trunk>.<http://pstn.twilio.com|pstn.twilio.com>",
    "numbers": [
      "+15105550100"
    ],
    "authUsername": "<username>",
    "authPassword": "<password>"
  }
}
• Run
lk sip outbound create outbound-trunk.json
to create it. (Reference: SIP outbound trunk)[https://docs.livekit.io/sip/trunk-outbound] 1. Alternative: Twilio Programmable Voice (TwiML) inbound • Purchase a Twilio number, create a TwiML Bin that dials your SIP endpoint:
Copy code
<Response>
  <Dial>
    <Sip username="sip_user" password="sip_pass">sip:+15105550123@<your-sip-endpoint></Sip>
  </Dial>
</Response>
• Point the phone number to that TwiML Bin. • In LiveKit, create a matching inbound trunk and dispatch rule. • Note: TwiML approach does not support SIP REFER or outbound calls. (Reference: Inbound calls with Twilio Voice)[https://docs.livekit.io/sip/accepting-calls-twilio-voice/] 1. Secure trunking (recommended) • Enable Secure Trunking in Twilio (Console → Trunk → Features). • Use
sips:
origination URIs and TLS. • In LiveKit, enable media encryption via
media_encryption
in
CreateSIPParticipant
(
SIP_MEDIA_ENCRYPT_ALLOW
or
SIP_MEDIA_ENCRYPT_REQUIRE
). (Reference: Secure trunking)[https://docs.livekit.io/sip/secure-trunking/] 1. Optional: Region pinning • Use a region-specific LiveKit SIP endpoint and ensure Twilio termination URI targets that region. (Reference: region pinning guide)[https://docs.livekit.io/sip/cloud/#region-pinning] If you tell me: • whether you want inbound, outbound, or both, • the platform (LiveKit Cloud vs self-hosted), • and whether you need TLS/media encryption, I’ll provide the exact JSON/CLI commands and any Twilio CLI commands or TwiML tailored to your setup. Sources: Create and configure a Twilio SIP trunk | LiveKit docs | SIP trunk setup | LiveKit docs | SIP outbound trunk | LiveKit docs | Inbound calls with Twilio Voice | LiveKit docs | Secure trunking | LiveKit docs
c
i wwan slfhosteed sip
t
Great — you're setting up a self-hosted LiveKit SIP server with Twilio. Which of these do you need help with right now? Pick one or more: • Installation: Docker Compose or native (
config.yaml
) and startup steps • Twilio setup: creating Elastic SIP Trunk, origination URL to your SIP server, phone number association, credential lists for termination • LiveKit config: creating inbound/outbound trunks, dispatch rules,
CreateSIPParticipant
usage, example JSON/CLI commands • Security & networking: TLS (sips), SRTP, firewall/NAT rules and required ports (5060/5061, RTP 10000–20000) • Troubleshooting connectivity: SIP signaling failures, RTP/muted audio, or authentication problems If you tell me the deployment method (Docker or native), your public IP or domain (or whether you’ll use TLS), and whether you need inbound, outbound, or both, I’ll provide the exact commands, JSON samples, and Twilio CLI/TwiML snippets you can run. Sources: Self-hosted SIP server | LiveKit docs | Create and configure a Twilio SIP trunk | LiveKit docs | SIP outbound trunk | LiveKit docs | Ports and firewall | LiveKit docs | SIP overview | LiveKit docs