Voice AI Ecosystem
Connect Exotel SIP Trunk to LiveKit
14 min
this guide connects exotel sip trunking to livekit cloud telephony so pstn calls can reach livekit rooms and outbound calls can use exotel as the indian pstn leg github repo (reference) https //github com/exotel/agentstream voiceaiecosystem what you will set up direction path inbound pstn → livekit pstn → exotel did → trunk destination uri → livekit sip endpoint → dispatch → room outbound pstn ← livekit livekit outbound trunk → digest → exotel edge ip\ port → pstn exotel trunk acl use whitelisted ips only when livekit (or your network) provides a fixed static egress ip to allow exotel trunk does not support cidr range allowlisting — use mask 32 and one post per static ip otherwise rely on digest (post /credentials) architecture inbound pstn → exotel did → destination uri on trunk → livekit sip host → room → agent outbound livekit → exotel edge ip\ port (digest) → pstn prerequisites exotel kyc, did e 164 , api credentials, https //api in exotel com livekit cloud project, telephony, sip uri from project settings (sip trunk setup) part a — livekit cloud sip endpoint and region (inbound) copy sip uri from project settings for india pinning {subdomain} india sip livekit cloud (region pinning) inbound trunk telephony → sip trunks → inbound — include your exotel did in e 164 (inbound trunk) dispatch rule at least one rule so calls land in a room ( https //docs livekit io/telephony/accepting calls/dispatch rule/ ) outbound trunk address — exotel edge ip\ port from exotel numbers — exotel did e 164 authusername / authpassword — same as exotel post /credentials { "name" "exotel outbound", "address" "your exotel edge ip 443", "numbers" \["+9198xxxxxxxx"], "authusername" "sip user", "authpassword" "sip pass" } agent in the same room https //github com/exotel/agentstream voiceaiecosystem/tree/main/livekit — ring without bot audio usually means no publisher in the room part b — exotel apis rate limit 200/minute snippets exotel trunk api snippets md outbound sip — three steps create trunk map did to trunk post /credentials (user name, password) — must match livekit outbound trunk auth optional post /whitelisted ips only if livekit gives you a static sip egress ip to allow — single ip , mask 32 per entry no cidr range on trunk inbound only post /destination uris toward your livekit sip host (not required for minimal outbound only testing) curl s x post \\ "https //${api key} ${api token}@${subdomain}/v2/accounts/${account sid}/trunks/${trunk sid}/credentials" \\ h "content type application/json" \\ d '{ "user name" "sip user", "password" "sip pass", "friendly name" "livekit" }' inbound sip — destination uri on trunk curl s x post "https //${api key} ${api token}@${subdomain}/v2/accounts/${account sid}/trunks/${trunk sid}/destination uris" \\ h "content type application/json" \\ d '{ "destinations" \[ { "destination" "your subdomain india sip livekit cloud 5061;transport=tls" } ] }' connect applet (inbound) dial whom sip \<trunk sid> — use the trunk sid from create trunk ( not a full sip uri) map did to flow docid 2oddtedmmf64scwjhgvkt testing outbound sip was validated with correct edge ip\ port , digest , and e 164 ; optional static ip acl when applicable audio still requires an agent in the same room as the sip participant applicability ui driven + developer driven (livekit cloud console for trunks/dispatch; your app/agent joins rooms) not a single “import trunk” wizard like some providers exotel edge signaling toward exotel uses edge ip\ port from exotel (network and firewall) configure ip\ port as exotel assigns — not an assumed carrier hostname edge hostnames you may see (india) in voip exotel com 5070 (tcp) and in voip exotel com 443 (tls) use the exact host/ip + port + transport exotel assigns see exotel trunk api snippets md acl vs digest (important) exotel trunk acl (whitelisted ips) is intended for static /32 ips only (mask 32), not cidr ranges if the provider/network only has cidr/shared egress , prefer digest and coordinate with exotel support—ip allowlisting can become the primary trust signal and cause intermittent auth/routing issues in shared egress setups scope livekit cloud with telephony enabled see outbound exotel notes md for 403, e 164, and “no audio” patterns troubleshooting symptom what to check 403 / 4001 digest; optional static ip acl; correct edge ip\ port wrong format e 164 for india ring, no bot agent + room (outbound exotel notes md) connect broken sip \<trunk sid> only in dial whom references resource url livekit cloud https //cloud livekit io/ livekit sip trunk setup https //docs livekit io/telephony/start/sip trunk setup/ exotel sip api https //docs exotel com/dynamic sip trunking/detailed sip trunking api reference
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.
