To connect an AI voice agent to a SIP trunk, you point the trunk's inbound route (the origination URI) at the voice agent's SIP endpoint, add your numbers, and give the agent credentials or an IP allowlist so it can send outbound calls and transfers back through the same trunk. You keep your carrier, your numbers and your phone system. The parts that decide whether callers notice anything are codecs, latency, DTMF, how transfers carry context to a human, and what happens when the agent's endpoint is down.
TL;DR
- A SIP trunk is the carrier line between the phone network and the system that answers the call. For an AI voice agent, that system is the agent platform.
- There are three ways to connect: a SIP trunk straight to the vendor's SIP endpoint, forwarding a number to the agent, or bringing your own carrier (BYOC) on Twilio Elastic SIP Trunking, Telnyx and similar providers.
- Phone audio is 8 kHz G.711 on most trunks. Keep one codec end to end so nothing transcodes in the middle, and test speech recognition on that audio.
- Transfers decide the caller experience. SIP REFER hands the call off and drops the agent. A bridged transfer keeps the agent on the line long enough to brief the human.
- Set a fallback route and lock the trunk down: TLS and SRTP, an IP allowlist or digest credentials, and limits on where outbound calls can go.
- Carrier minutes are cheap next to the AI. Twilio lists US inbound local minutes at $0.0034 and Telnyx at $0.0032, both checked 22 Nov 2026.
What a SIP trunk does for an AI voice agent
SIP (Session Initiation Protocol) sets up and ends calls, while the audio travels separately as RTP, or SRTP when encrypted. A SIP trunk is a virtual connection from a carrier to a system that makes or takes calls.
When a customer dials your number, the carrier sends a SIP INVITE to the address the trunk points at: here, the agent platform. The platform answers, transcribes the caller, decides what to do, speaks a reply, and can send SIP messages back to transfer or hang up. Outbound works the other way: the agent sends an INVITE to the trunk's termination address, authenticated with credentials or by source IP.
If you already run a contact center or PBX, the trunk is how you add the agent without moving numbers. Our list of telephony providers has setup guides for 37 of them.
The 3 ways to connect an AI voice agent to your phone line
| Option | How it works | Good fit when | What to watch |
|---|---|---|---|
| SIP trunk to the vendor's SIP endpoint | Your PBX, contact center or SBC routes some calls over SIP to the agent's endpoint | You run a PBX or CCaaS and want the agent on specific queues or menu options | SIP transport (UDP, TCP or TLS), codecs, and whether your platform allows REFER back |
| Forward a number | Your phone system forwards calls (always, after hours, or on no answer) to a number the agent answers | You want to go live the same day, or nobody on staff manages telecom | The agent may see the forwarding number instead of the caller's number, and every forward is a second call leg |
| Bring your own carrier (BYOC) | You create a trunk on Twilio Elastic SIP Trunking, Telnyx, Bandwidth or another carrier and set the agent's SIP URI as the origination target | You want your own carrier rates, countries and number inventory | You manage the trunk's security, failover and capacity yourself |
Most teams start with forwarding for a pilot, then move to a direct SIP route once they trust the agent. If you run 3CX, our guide on adding an AI voice agent to 3CX walks through the trunk and outbound rule. If you're choosing a contact center platform first, see Amazon Connect vs Twilio Flex.
How to connect an AI voice agent to a SIP trunk, step by step
These steps follow the BYOC pattern on Twilio Elastic SIP Trunking. Other carriers use the same ideas under different names.
- Get the agent's SIP details. Copy the SIP endpoint, the transport it accepts, and the IP ranges it calls from.
- Create the trunk. Use a separate trunk for AI traffic so its settings and logs stay apart from your human agents' calls.
- Set the origination URI. Point inbound calls at the agent's SIP endpoint. Add a second URI with a lower priority as a fallback (more on that below).
- Set termination for outbound and transfers. Create a termination domain and lock it with a credential list, an IP access control list, or both. Twilio requires at least one of the two and recommends credentials.
- Turn on encryption. Enable TLS for signaling and SRTP for media on both ends. On Twilio, once Secure Trunking is on, unencrypted calls are rejected, so switch both sides together.
- Attach numbers. Move the numbers that should reach the agent onto the trunk.
- Configure transfers. Decide where handoffs go, and check that your carrier accepts SIP REFER or that the agent can bridge a second leg.
- Test from a real phone. Call from a mobile on a weak signal. Check audio both ways, keypad input, a transfer, and a call with the agent's endpoint switched off.
Codecs: G.711 vs Opus on 8 kHz phone audio
A codec decides how audio is compressed on the call. Two matter most here.
| G.711 (PCMU / PCMA) | Opus | |
|---|---|---|
| Audio band | Narrowband, 8 kHz sampling | Narrowband up to fullband (48 kHz) |
| Bitrate | 64 kbit/s | 6 to 510 kbit/s, adaptive |
| Where you meet it | The default on most SIP trunks and the public phone network | WebRTC, apps, some carriers on request |
| On Twilio Elastic SIP Trunking | Supported by default | Limited availability, on request, and not supported end to end |
For calls that start on the phone network, G.711 is the practical choice. The audio is already narrowband when it reaches your trunk, so Opus on the last hop doesn't add back what was lost. What hurts is transcoding: if two legs use different codecs, a media server converts between them, adding delay and artifacts. Keep one codec end to end.
At 8 kHz, sound above 4 kHz is gone (Twilio's media streams, for example, deliver 8,000 Hz mono mu-law audio). That's why "f" and "s" get confused and spelled-out email addresses fail more on calls than in a laptop demo. Test speech recognition on recorded calls, and make the agent read back numbers and names. If you serve Arabic callers, our guide to testing Arabic AI voice agents across dialects covers what narrowband audio does to dialect recognition.
Latency: where the delay comes from
Callers judge a voice agent by the gap between when they stop talking and when it replies. That gap adds up from speech recognition, the model, speech synthesis and the network. The trunk's share is usually small, but a caller in Dubai whose audio goes through a US data center pays for that round trip on every turn.
- Keep media close. Pick the carrier point of presence and the agent's SIP region nearest your callers. Open's SIP endpoints come in Global, US, EU and APAC regions.
- Avoid extra hops. Every forward, transcoding step or media relay adds delay. Forwarding a number through two systems is the most common cause.
- Measure it on recordings. Report the median and the slowest 10% of turns from end of caller speech to first agent audio. Averages hide the slow turns callers remember.
DTMF: keypad input still matters
Callers still press keys to enter an account number or pick a language, and an outbound agent may need to send tones to get through another company's menu.
Tones travel in the audio itself (in-band), as RTP telephone-event packets defined in RFC 4733, or as SIP INFO messages. In-band tones get distorted by compression and packet loss, so RFC 4733 is the safe default. Make sure the trunk, the PBX and the agent agree on one method. A mismatch shows up as an agent that never hears the key press.
Transfers: SIP REFER vs bridging, and passing context
When the agent needs a person, there are two ways to move the call.
| SIP REFER | Bridged transfer | |
|---|---|---|
| What happens | The agent tells the carrier or PBX to connect the caller to a new destination, then leaves | The agent places a second call to the human and joins the two legs |
| Agent stays on the call | No | Yes, until it drops off |
| Can brief the human | Only through data sent with the transfer | Yes, it can speak a summary before connecting the caller |
| Media path afterward | Direct between caller and human | May stay through the agent platform for the rest of the call |
| Watch for | Carrier and PBX support for REFER varies, and some limit destinations | Two legs of carrier minutes for the bridged part |
Twilio Elastic SIP Trunking accepts SIP REFER from your side and connects the call onward.
A transfer only helps if the human knows what happened, so the caller doesn't repeat their order number. Ways to carry context include custom SIP headers or a User-to-User header on the transfer, a ticket or CRM record the agent creates before handing off, or a screen pop in the agent desktop. Ask vendors which of these work with your phone system. Open hands off to a human with the full transcript and context attached, and our guide to AI-to-human handoff covers what a good handoff includes.
Failover: what callers hear when something breaks
A trunk with one origination URI and no fallback gives callers a fast busy tone when the agent's endpoint is unreachable. Plan the failure path before go-live.
- Add a second origination URI. On Twilio, the lowest priority value is tried first, and weight splits load between URIs with the same priority.
- Set a disaster recovery route. Twilio's trunks have a disaster recovery URL that takes calls when no origination URI answers. Point it at a human queue or voicemail, not at another AI endpoint in the same region.
- Cap call length and ring time, so a stuck call ends on its own.
Security: TLS, SRTP and IP allowlists
An open SIP trunk is a target for toll fraud: attackers who find one place calls to premium-rate numbers on your account. The basics:
- Encrypt both layers. TLS (usually port 5061) for signaling and SRTP for the audio. Twilio dropped TLS 1.0 and 1.1 on its trunks.
- Authenticate both directions. Allow inbound SIP only from your carrier's IP ranges, and require digest credentials or an IP allowlist for anything the agent sends out.
- Restrict destinations. Block the countries and number ranges you never call, and set limits on calls per second and concurrent calls.
Open supports TLS for signaling and SRTP for media, and authenticates trunks with digest credentials or an IP allowlist. Its security documentation is at trust.open.cx.
What SIP trunking costs for an AI voice agent
Carrier minutes are a small part of the bill. Published US list prices, checked 22 Nov 2026:
| Item (US) | Twilio Elastic SIP Trunking | Telnyx SIP Trunking |
|---|---|---|
| Inbound, local number | $0.0034 per min | From $0.0032 per min |
| Inbound, toll-free | $0.0130 per min | From $0.015 per min (varies by calling number) |
| Outbound, local (48 states) | $0.0100 per min | From $0.005 per min |
| Local number | $1.15 per month | $1.00 per month |
| Secure trunking (TLS/SRTP) | Included | Free |
| Call concurrency | Unlimited, included | Free |
At those rates, 10,000 inbound local minutes a month cost about $34 on Twilio and from about $32 on Telnyx, before numbers. Both vendors offer volume discounts through sales, and international rates differ by country.
The larger cost is the AI layer: the platform's per-minute, per-call or per-resolution fee, plus speech and model usage if billed separately. Add the carrier line to the platform line and divide by calls resolved, not calls answered.
Where Open fits
Open's AI voice agents answer and place calls on the carrier and phone system you already have. Open connects over SIP, so there's no carrier switch or number port, and if you'd rather not run a trunk at all, Open Telephony can provision local numbers in 100+ countries. The agent runs actions in your tools during the call and hands off to a human with the transcript attached. If your phone system is Microsoft Teams, see our guide to setting up an AI receptionist on Teams Phone.
Open charges $0.75–$0.90 per resolution, depending on volume. Handoffs to a human aren't billed, and carrier and telephony costs are passed through at cost. The details are on the pricing page. For a broader view of where an agent sits next to your phone menus, see conversational IVR vs AI voice agent.
Sources
- Twilio, "Elastic SIP Trunking pricing, United States," https://www.twilio.com/en-us/sip-trunking/pricing/us, checked 22 Nov 2026
- Telnyx, "SIP Trunking Pricing," https://telnyx.com/pricing/elastic-sip, checked 22 Nov 2026
- Twilio, "Elastic SIP Trunking" docs (origination URI priority and weight, disaster recovery URL, SIP REFER, secure trunking, authentication), https://www.twilio.com/docs/sip-trunking, checked 22 Nov 2026
- Twilio, "Elastic SIP Trunking codecs," https://www.twilio.com/docs/sip-trunking/codecs, checked 22 Nov 2026
- Twilio, "Media Streams WebSocket messages" (8,000 Hz mu-law audio), https://www.twilio.com/docs/voice/media-streams/websocket-messages, checked 22 Nov 2026
- IETF, RFC 6716, "Definition of the Opus Audio Codec," https://www.rfc-editor.org/rfc/rfc6716, checked 22 Nov 2026
- IETF, RFC 4733, "RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals," https://www.rfc-editor.org/rfc/rfc4733, checked 22 Nov 2026
- IETF, RFC 3515, "The Session Initiation Protocol (SIP) Refer Method," https://www.rfc-editor.org/rfc/rfc3515, checked 22 Nov 2026
- IETF, RFC 3711, "The Secure Real-time Transport Protocol (SRTP)," https://www.rfc-editor.org/rfc/rfc3711, checked 22 Nov 2026
- Open, "Telephony providers," https://www.open.cx/telephony, and "Twilio," https://www.open.cx/telephony/twilio, checked 22 Nov 2026