i'm looking for native twilio integration with web...
# ask-ai
e
i'm looking for native twilio integration with websocket and without sip server
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.
Thanks — you're asking if LiveKit supports a native Twilio integration that uses WebSocket only (no SIP server). LiveKit does not support a WebSocket-only integration with Twilio. Twilio calls must be connected to LiveKit via SIP trunking and the LiveKit SIP gateway to bridge telephony into WebRTC rooms. WebSocket support in LiveKit exists for client signaling and features like Track Egress to WebSocket, but that does not replace the SIP trunk required for Twilio call routing. If you’d like, I can: • Walk you through the Twilio → LiveKit SIP trunk setup steps, or • Suggest alternative architectures (e.g., proxying audio via a server that uses LiveKit client SDKs) depending on your exact use case. Which would you prefer? Sources: Inbound calls with Twilio Voice | LiveKit docs | Create and configure a Twilio SIP trunk | LiveKit docs | livekit/livekit_composite | DeepWiki | Track egress | LiveKit docs
e
i checked following in your codebase that hints that integration is avaiable Yes, LiveKit provides native Twilio integration with WebSocket support that doesn't require a SIP server. The integration uses Twilio's media stream WebSocket to connect calls directly to LiveKit rooms. Technical Implementation Core Protocol Definition The native Twilio integration is defined in
livekit_connector_twilio.proto
with the
ConnectTwilioCallRequest
and
ConnectTwilioCallResponse
messages livekit_connector_twilio.proto:25-64 . The response specifically returns a WebSocket URL for Twilio's media stream connection. Service Interface The
Connector
interface includes the
ConnectTwilioCall
method that handles the WebSocket-based connection livekit_connector.twirp.go:29-39 . WebSocket URL Response The
ConnectTwilioCallResponse
struct contains the
ConnectUrl
field which is "The websocket URL which twilio media stream will connect to" livekit_connector_twilio.pb.go:195-201 . RPC Service Definition The internal RPC service
ConnectorInternal
exposes the
ConnectTwilioCall
method for handling Twilio connections connector.proto:35-37 . Key Features • Direct WebSocket Connection: No SIP server required - uses Twilio's media stream WebSocket directly • Bidirectional Support: Handles both inbound and outbound calls via
TwilioCallDirection
enum livekit_connector_twilio.proto:27-32 • Room Integration: Connects Twilio calls to specific LiveKit rooms with configurable participant details • Country-based Routing: Supports call routing based on destination country code livekit_connector_twilio.proto:57-58
t
You're pointing to code that appears to implement a direct Twilio WebSocket connector. I checked the publicly documented LiveKit integrations: LiveKit's documented Twilio integrations all use SIP trunking (TwiML or Elastic SIP Trunking) and the LiveKit SIP gateway to bridge calls into WebRTC rooms. There is no public documentation describing a supported, WebSocket-only Twilio media-stream integration that bypasses SIP. To reconcile this: • If that proto/service (
ConnectTwilioCall
,
ConnectUrl
, etc.) exists in your codebase or a branch, it may be an internal/newer connector not yet documented publicly. • If you can share the repository path, branch, or the specific files/snippets you found, I can review those lines and tell you exactly how the connector is intended to work and whether it requires SIP in practice. Would you like me to review the specific files you found (paste snippets or repo paths), or would you prefer help setting up the documented SIP-based Twilio → LiveKit flow? Sources: Inbound calls with Twilio Voice | LiveKit docs | Create and configure a Twilio SIP trunk | LiveKit docs | Introducing LiveKit Phone Numbers: Zero to Ringing in 60 Seconds
e
i would like to support call on India number , can you share provider that supports
t
You're asking for providers that support India phone numbers to use with LiveKit. You can use third-party SIP providers that offer Indian DID numbers and route calls into LiveKit via SIP trunks. Recommended providers: • Plivo — supports India numbers and has a LiveKit quickstart for configuring a Plivo SIP trunk. • Twilio — offers India numbers (use Elastic SIP Trunking for full SIP feature support). • Telnyx — provides global numbers including India and SIP trunking. • Wavix — listed as compatible for SIP integrations. Important setup notes: • Enable region pinning for India in your LiveKit project and use the India-specific SIP endpoint (e.g., <your-subdomain>.india.sip.livekit.cloud) to meet local telephony requirements. • LiveKit Phone Numbers currently only supplies US numbers, so you’ll need one of the providers above to obtain an India number. If you want, I can: • Walk through configuring a Plivo or Twilio SIP trunk step‑by‑step for LiveKit, or • Review your provider choice and map the exact SIP settings you need. Which would you like? Sources: Create and configure a Plivo SIP trunk | LiveKit docs | SIP overview | LiveKit docs | SIP cloud and region pinning | LiveKit docs | LiveKit Phone Numbers | LiveKit docs | Introducing LiveKit Phone Numbers: Zero to Ringing in 60 Seconds
e
share instructions for Plivo
t
Thanks — I’ll share step-by-step instructions to set up Plivo with LiveKit for India numbers, including region pinning, inbound/outbound trunks, and testing. 1) Prerequisites • Plivo account with Indian phone number(s) purchased. • LiveKit Cloud project and access to the Project settings (your SIP subdomain). • TLS-enabled SIP trunking recommended. • CLI or API access to create trunks/dispatch rules in LiveKit. 2) Enable region pinning (India) • Use your LiveKit project’s India endpoint:
{your-subdomain}.india.sip.livekit.cloud
. • Any SIP URIs for India must use that India endpoint to comply with local regulations. 3) Configure Plivo — Inbound trunk • In Plivo Console → Zentrunk → Inbound Trunks → Create New Inbound Trunk. • Name: e.g., “LiveKit India Inbound”. • Primary URI:
{your-subdomain}.india.sip.livekit.cloud;transport=tls
(use
;transport=tls
). • Save the trunk. • Assign your Indian phone number: Phone Numbers → select number → Application Type = Zentrunk → choose the new trunk → Update. 4) Configure LiveKit — Inbound trunk • Create an inbound trunk in LiveKit (Dashboard / CLI / API). Example body:
Copy code
{
  "name": "India inbound trunk",
  "numbers": [
    "+91XXXXXXXXXX"
  ],
  "krispEnabled": true
}
• CLI example:
Copy code
lk sip inbound create inbound-trunk.json
• Create a dispatch rule to route inbound calls into rooms (example: per-call rooms with prefix
call-
):
Copy code
{
  "name": "India dispatch rule",
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "call-"
    }
  },
  "roomConfig": {
    "agents": [
      {
        "agentName": "my-telephony-agent"
      }
    ]
  }
}
• CLI:
Copy code
lk sip dispatch create dispatch-rule.json
5) Configure Plivo — Outbound trunk (termination) • Plivo Console → Zentrunk → Outbound Trunks → Create New Outbound Trunk. • Enable Secure Trunking and add credentials (username/password). • Note the termination SIP domain (e.g.,
dst-plivo.pstnhub.com
). 6) Configure LiveKit — Outbound trunk • Create outbound trunk in LiveKit with
destination_country: "in"
and TLS transport. Example:
Copy code
{
  "name": "Plivo outbound trunk",
  "address": "dst-plivo.pstnhub.com",
  "numbers": [
    "*"
  ],
  "authUsername": "<plivo-username>",
  "authPassword": "<plivo-password>",
  "transport": "SIP_TRANSPORT_TLS",
  "destination_country": "in"
}
• This ensures LiveKit uses the India region for origination. 7) Place outbound calls from LiveKit • Use LiveKit’s
CreateSIPParticipant
(or equivalent API) to create a SIP participant/participant call:
Copy code
{
  "sip_trunk_id": "<trunk-id>",
  "sip_call_to": "+91YYYYYYYYYY",
  "sip_number": "+91XXXXXXXXXX",
  "room_name": "outbound-call",
  "participant_identity": "outbound-agent",
  "wait_until_answered": true
}
8) Testing • Inbound: Call your Plivo India number — it should route to LiveKit and create a room/participant per your dispatch rule. • Outbound: Trigger an outbound call from LiveKit to an Indian destination number and confirm the call completes. 9) Troubleshooting checklist • Ensure both Plivo and LiveKit use TLS (
;transport=tls
/
SIP_TRANSPORT_TLS
). • Confirm
destination_country: "in"
for outbound trunks and use the
.india.sip.livekit.cloud
endpoint for inbound. • Verify credentials (username/password) match on both sides. • Check Plivo call logs and LiveKit telephony logs for SIP status and SDP negotiation details. • If calls fail, confirm DNS/port connectivity from Plivo to the LiveKit SIP endpoint and that any firewall allows TLS SIP traffic. 10) Helpful docs (reference) • Plivo quickstart guide for LiveKit: https://docs.livekit.io/sip/quickstarts/configuring-plivo-trunk • SIP cloud & region pinning: https://docs.livekit.io/sip/cloud/ • Inbound trunk: https://docs.livekit.io/sip/trunk-inbound • Outbound trunk: https://docs.livekit.io/sip/trunk-outbound • Secure trunking: https://docs.livekit.io/sip/secure-trunking Would you like a concrete example using your actual subdomain/phone numbers (paste them here), or do you want me to walk through any specific step in your environment? Sources: Create and configure a Plivo SIP trunk | LiveKit docs | SIP cloud and region pinning | LiveKit docs | SIP outbound trunk | LiveKit docs | SIP inbound trunk | LiveKit docs | sip | livekit/livekit_composite | DeepWiki