Connect Your VoIP Infrastructure to LiveKit
Bridge Asterisk, FreeSWITCH, Kamailio, OpenSIPS — and any SIP carrier — with LiveKit AI rooms. Handle inbound/outbound PSTN calls through your existing telephony stack.
Quick answer
What is LiveKit SIP integration?
LiveKit SIP integration connects LiveKit rooms and AI agents to the phone network, so callers on regular numbers can reach WebRTC users and AI voice agents, and agents can place outbound calls. CelloIP connects LiveKit SIP to carriers' SIP trunks and to Asterisk, FreeSWITCH and Kamailio, inbound and outbound.
Quick answer
How do you connect Asterisk or FreeSWITCH to LiveKit?
Run LiveKit's SIP service, create an inbound or outbound SIP trunk and a dispatch rule in LiveKit, then point a SIP trunk from Asterisk (PJSIP) or FreeSWITCH (Sofia) at it. Each call arrives as a participant in a LiveKit room, where an AI voice agent, a WebRTC user or a recording pipeline can join it.
How LiveKit SIP Works
SIP Trunks
LiveKit creates inbound/outbound SIP trunks via REST API. Any RFC-3261 SIP carrier can connect.
Dispatch Rules
Rules decide which LiveKit room a call joins. Match by DID number, caller ID, or custom SIP headers.
SIP Participants
Each phone call appears as a participant in the LiveKit room — audio tracks exchanged bidirectionally.
DTMF & Transfer
Full DTMF pass-through, SIP REFER for call transfer, hold/resume support.
Integration Compatibility Matrix
| Platform | Integration Method | Complexity | Inbound | Outbound | Notes |
|---|---|---|---|---|---|
| Twilio Elastic SIP | Direct SIP trunk | Easy | ✓ | ✓ | Best for cloud-first setups |
| Telnyx | Direct SIP trunk | Easy | ✓ | ✓ | Lower cost than Twilio |
| Vonage | Direct SIP trunk | Easy | ✓ | ✓ | Good EU coverage |
| Asterisk 20/21 | chan_pjsip SIP trunk | Medium | ✓ | ✓ | Route specific DIDs to LiveKit |
| FreeSWITCH | mod_sofia SIP gateway | Medium | ✓ | ✓ | ESL event integration |
| Kamailio | dispatcher module | Advanced | ✓ | ✓ | LCR + failover before LiveKit |
| OpenSIPS | SIP proxy routing | Advanced | ✓ | ✓ | Multi-tenant routing logic |
| Generic SIP PBX | SIP trunk | Easy-Med | ✓ | ✓ | Any RFC-3261 compatible |
Integration Architectures
Asterisk + LiveKit Architecture
Asterisk receives PSTN call on DID → Dialplan routes to SIP trunk pointing at LiveKit SIP service → LiveKit dispatches to room based on dispatch rule → Voice Agent joins and greets caller → Agent can transfer back to Asterisk extension via SIP REFER.
FreeSWITCH + LiveKit Integration
FreeSWITCH mod_sofia receives call → ESL event fires to Node.js controller → Controller decides if AI agent needed → bridges to LiveKit via SIP → ESL monitors for disconnect → Full recording via LiveKit egress.
Kamailio/OpenSIPS Advanced Routing
All DIDs hit Kamailio (fraud detection, rate limiting) → Dispatcher routes AI-destined calls to LiveKit SIP, human-destined to Asterisk/FreeSWITCH → LiveKit agent answers, optionally transfers back via SIP REFER.
LiveKit SIP Configuration
// Create inbound SIP trunk via LiveKit API
const sipTrunk = await sipClient.createSIPInboundTrunk({
name: 'Asterisk-to-LiveKit',
numbers: ['+15551234567', '+15559876543'],
allowedAddresses: ['203.0.113.10'], // Asterisk server IP
authUsername: 'livekit-sip',
authPassword: 'secure-password-here',
});
// Create dispatch rule: route calls to AI agent room
const rule = await sipClient.createSIPDispatchRule({
trunkIds: [sipTrunk.sipTrunkId],
rule: {
dispatchRuleIndividual: {
roomPrefix: 'ai-agent-',
},
},
});
// Enable TLS and SRTP for production security
const trunk = await sipClient.updateSIPInboundTrunk(sipTrunk.sipTrunkId, {
tlsCertificateRequest: true,
enableSRTP: true,
});Security & Production Considerations
IP Allowlisting
Restrict SIP signalling to known carrier/PBX IPs only.
SIP Authentication
Digest auth username + password per trunk required.
TLS/SRTP
Enforce encrypted media and signalling in production.
Rate Limiting
Dispatch rules with max concurrent calls per trunk.
Monitoring
LiveKit webhooks + Prometheus metrics for observability.
Frequently Asked Questions
How does LiveKit SIP receive calls from Asterisk?
Configure chan_pjsip trunk pointing to LiveKit SIP service IP:5060. Set dispatch rule for room routing based on DID. Asterisk will route matching calls to the SIP trunk.
Can LiveKit transfer calls back to Asterisk?
Yes, via SIP REFER. The agent calls sip_client.transfer_sip_participant() pointing to the Asterisk extension. The caller is transferred seamlessly back to the PBX.
Does LiveKit SIP support SRTP encryption?
Yes. TLS signalling and SRTP media encryption are enforced in production trunks. Configure enableSRTP: true when creating or updating trunks.
What SIP carriers work with LiveKit?
Any RFC-3261 compliant carrier. Tested: Twilio Elastic SIP, Telnyx, Vonage, plus self-hosted Kamailio and OpenSIPS proxies.
Can different DIDs route to different AI agents?
Yes. Dispatch rules match by DID number, directing each to a different room prefix and agent configuration. One trunk can support many DIDs with independent routing.
Integration Use Cases
Asterisk PBX Enhancement
Bridge existing Asterisk PBX to LiveKit rooms for AI-powered IVR, voice transcription, and lead qualification.
Contact Center
Route incoming calls from SIP carriers through LiveKit for AI pre-screening, skill-based routing, and agent assist.
Carrier Integration
Connect Twilio, Telnyx, or Vonage SIP trunks directly to LiveKit for PSTN-to-AI-room bridges.
Multi-Tenant SIP Proxy
Deploy Kamailio/OpenSIPS with intelligent routing: send some calls to LiveKit AI, others to Asterisk extensions.
Ready to Bridge Your VoIP Stack?
CelloIP's SIP integration experts will connect your Asterisk, FreeSWITCH, or SIP carrier to LiveKit in days, not weeks.
Questions? Email our team — we reply within one business day. Developer FAQs & Pricing