Vanie AI logo
sip · telephony · how it works

SIP trunk setup for an AI voice agent

By · Founder & CEO, Vanie AI

The short answer: a SIP trunk is the IP connection that lets your AI voice agent place and receive real phone calls. To set one up you configure termination (outbound) and origination (inbound), pick an auth method (IP allow-list and/or credentials), agree a codec (G.711 is the safe default), and — in India — use a DoT-licensed provider. Then test inbound, outbound, two-way audio, and DTMF before you go live.

SIP trunk vs PRI, in one line

A PRI is a dedicated physical circuit carrying a fixed number of voice channels (23 on a T1, 30 on an E1). A SIP trunk is a virtual connection that carries calls as VoIP over IP and scales in software — no new lines to add capacity. SIP itself is the signalling that sets up and tears down the call; the audio travels separately as RTP. For an AI agent, the SIP trunk is simply how the call reaches the model.

The core settings you’ll configure

SettingWhat it does
TerminationOutbound — your platform → the phone network
OriginationInbound — the network → your platform (a DID rings your agent)
AuthIP ACL (whitelist) and/or username+password credentials
TransportUDP / TCP / TLS (TLS encrypts signalling, default port 5061)
CodecG.711 (PCMU/PCMA) is the universal baseline; Opus/G.729 by arrangement
DTMFOut-of-band RTP telephone-events (RFC 4733, formerly RFC 2833)

On authentication, Twilio’s own guidance is to use credentials in addition to IP allow-listing because “IP ACLs alone do not protect against certain types of attacks”. For DTMF (the digits a caller presses), the modern standard is RFC 4733, which obsoleted RFC 2833 — carry tones as RTP telephone-events, not in-band audio.

The India angle: who can provide the trunk

This is the part teams outside India miss. In India, SIP trunking can only be provided legally by a DoT-licensedentity — a Unified License holder, VNO, or TSP — under the DoT/TRAI framework. That’s why Exotel operates as a UL VNO to offer compliant Indian PSTN access. Practical implication: for Indian numbers, connect through a licensed Indian provider rather than routing India calls through a foreign carrier at markup. Vanie AI supports bring-your-own SIP trunks alongside Twilio and Exotel, with carrier presets for Jio, Vi, Airtel, Tata, and Servetel.

Binding the trunk to your agent

Once the trunk is up, the wiring is straightforward: an inbound DID is routed to a specific agent (so calls to that number reach the right persona), and the trunk’s number is used as caller ID on outbound calls. From there the agent runs the conversation on Gemini Live exactly as it would on any other channel — see how AI phone agents work for the full real-time pipeline, and Exotel vs Twilio if you’re choosing a provider.

Common pitfalls (and how to test)

  • One-way audio — usually NAT: a private IP in the SDP, or a router’s SIP ALG rewriting packets. Disable SIP ALG, use an SBC/public media address, open the RTP range.
  • Registration / auth failures — mismatched credentials or the trunk’s source IP not on the allow-list.
  • Codec mismatch — no common codec enabled on both ends; keep G.711 on as the fallback.
  • DTMF not detected — ensure RFC 4733 telephone-events are negotiated, not in-band tones.

Before go-live, run the checklist: confirm the trunk is reachable (SIP OPTIONS), registration/IP-auth succeeds, a test inbound DID rings the agent, an outbound call shows the correct caller ID, audio is two-way (no NAT one-way), DTMF registers, and the negotiated codec lands on G.711.

The bottom line

A SIP trunk is just the pipe between the phone network and your AI agent — but the details (termination/origination, auth, codecs, DTMF, and, in India, using a licensed provider) are where setups succeed or fail. Get them right, test methodically, and the agent dials and answers like it was born on the network.

Frequently asked questions

What is the difference between a SIP trunk and a PRI line?
A SIP trunk carries voice as VoIP over an IP network and scales in software; a PRI is a dedicated physical circuit (23 channels on a T1, 30 on an E1) carrying voice only. SIP trunks add capacity without new physical lines, which is why modern voice platforms use them.
What are termination and origination?
Termination is the configuration for placing outbound calls from your infrastructure to the phone network; origination is for receiving inbound calls from the network and delivering them to your infrastructure. You typically configure both on a trunk.
Should I authenticate with IP whitelisting or credentials?
Use at least one, and ideally credentials. Providers like Twilio recommend username/password authentication in addition to IP access control lists, because IP ACLs alone don’t protect against certain attacks. A trunk can also be configured not to register and rely on IP auth.
Why am I getting one-way audio, and how do I fix it?
Almost always NAT/firewall: an endpoint advertises a private IP in its SDP, so return RTP has nowhere to go, or a router’s SIP ALG is rewriting packets. Disable SIP ALG, use an SBC or public media address, and open the RTP port range.
Who can legally provide SIP trunking in India?
Only DoT-licensed providers — a Unified License holder, VNO, or telecom service provider. For example, Exotel operates as a UL VNO to offer compliant PSTN access. So for Indian numbers, connect through a licensed provider rather than routing India calls through a foreign carrier at markup.