SIP trunking connects a phone system to the public phone network over the internet. Instead of renting physical lines from a phone company, you send calls to a carrier as SIP signaling and RTP audio, and the carrier connects them to every other phone in the world. One trunk can carry many simultaneous calls and hundreds of phone numbers.
That’s the whole idea. The rest of this guide covers what happens on the wire, how SIP trunking compares with VoIP and PRI lines, and what changes when the thing answering your calls is an AI voice agent instead of a person at a desk phone. It’s written for engineers and operations leads who own a phone system, or who are about to put a voice agent on one.
How SIP trunking works
A phone call over a SIP trunk is two separate streams:
- Signaling. SIP messages set up, change, and end the call. An
INVITEstarts it,200 OKanswers it,BYEhangs up. SIP usually runs over UDP or TCP on port 5060, or over TLS on port 5061. - Media. The audio itself travels as RTP packets, usually on a different set of ports. SRTP is the encrypted version.
For an inbound call, someone dials one of your numbers. The carrier owns that number on the public network, looks up your trunk, and sends a SIP INVITE to the address you configured. Your system answers, both sides agree on an audio codec, and RTP starts flowing. An outbound call runs the same steps in reverse: your system sends the INVITE to the carrier, and the carrier dials out.
The “trunk” part is old telephone language. A trunk was a bundle of lines between two switches that many callers shared. A SIP trunk is the same thing without the copper: a configured, authenticated connection between your system and a carrier, with a limit on how many calls it can carry at once.
What you get from a SIP trunk provider
- Phone numbers, often called DIDs (direct inward dialing). You can usually port existing numbers to the trunk.
- Channels, the number of concurrent calls the trunk allows. Some providers sell them in fixed blocks, others meter by the minute with a concurrency cap.
- Termination and origination: placing calls out to the phone network, and receiving calls from it.
- Emergency calling and caller ID handling, which differ by country and carrier.
SIP trunking vs VoIP vs PRI
People use these terms loosely, so it helps to separate them.
| Option | What it is | Who runs the phone system |
|---|---|---|
| VoIP | The general term for voice carried over IP networks. Every option here except PRI is a kind of VoIP. | Depends on the service |
| Hosted VoIP | A provider runs the phone system and gives you phones, apps, and numbers. | The provider |
| SIP trunk | A connection between your own phone system or application and a carrier, over the internet. | You (PBX, contact center, voice agent) |
| PRI (ISDN) | A physical digital circuit from the phone company. A US T1 PRI carries 23 simultaneous calls; a European E1, 30. | You |
Most teams replace a PRI with a SIP trunk because adding capacity becomes a configuration change instead of a new circuit. Teams choose a SIP trunk over hosted VoIP when they need to keep control of routing: when the phone system is a contact center platform, custom software, or a voice agent that a hosted phone service can’t run.
Why SIP trunking matters for voice AI
A voice agent needs a way to answer phone calls. There are three common ways to give it one, and SIP trunking is the one that leaves your telephony where it already lives.
| Option | Good for | What to watch |
|---|---|---|
| Numbers from the platform | A fast start. No carrier account needed. | Country coverage. On Cartesia, provisioned numbers are US only. |
| Numbers from a CPaaS (Twilio) | Teams that already run numbers and call flows on Twilio. | You pay two providers, and routing goes through the CPaaS. |
| Your own SIP trunk | Keeping existing numbers, carriers, and international reach. | You configure authentication, encryption, and transfers yourself. |
A SIP trunk is usually the right choice when:
- Your numbers are already printed on invoices, websites, and the side of a truck, and you aren’t going to change them.
- You need numbers outside the US, or a carrier that’s licensed in a specific country.
- Your security team wants signaling over TLS, encrypted media, and a fixed list of IP addresses that can send calls.
- You want the agent to hand calls to an existing contact center queue, which also lives on SIP.
What the agent hears on a phone line
Phone audio is narrowband. Most calls on the public phone network use G.711, sampled at 8 kHz: µ-law in North America and Japan, A-law in Europe, India, and most other regions. That cuts off everything above about 3.4 kHz, which is where much of the difference between “f” and “s” lives.
This is why an agent that sounds great in a browser demo can mishear “F as in Frank” on a real call. Test speech recognition on 8 kHz audio from your actual carrier, and check the codec before blaming the model. Cartesia’s audio input docs list the exact encodings for telephony streams if you’re wiring audio yourself.
Latency adds up across hops
Every hop between the caller and the agent adds delay: the carrier’s network, your SBC or PBX if the call passes through one, the internet path to the agent, and the agent’s own speech recognition, LLM, and speech synthesis. Callers notice when the gap after they stop talking gets long. Keep the path short: send the trunk straight to the agent platform where you can, and pick carrier points of presence near the platform’s region.
Transfers use SIP REFER
When the agent hands a caller to a person, it usually sends a SIP REFER asking the carrier to connect the call somewhere else, either a phone number or a SIP address. Your carrier has to support REFER for the destination type you use. Check this before launch. A failed transfer at the end of a long call is how a caller ends up describing your company to their friends.
How to connect a SIP trunk to a voice agent
The steps below use Cartesia Managed Agents. Other platforms follow the same shape with different field names. The full reference is in the SIP trunking docs.
1. Point your carrier at the agent platform
Set the trunk’s origination URI to Cartesia’s SIP endpoint, using the transport your carrier supports:
sip:sip.cartesia.ai;transport=tls
sip:sip.cartesia.ai;transport=tcp
TLS encrypts the signaling. If your carrier or firewall filters by IP address, ask Cartesia support for the static IP ranges to allowlist.
2. Lock down who can send calls
Configure at least one access control on the inbound side: digest authentication (a username and password), a list of your carrier’s signaling IP addresses, or both. Never leave an inbound trunk open. Strangers on the internet scan for open SIP endpoints constantly, and they aren’t calling to book an appointment.
Some carriers can’t do digest authentication for inbound calls. Twilio Elastic SIP Trunking is one, so you allowlist Twilio’s signaling IP ranges instead.
3. Turn on media encryption if you need it
Cartesia’s media_encryption setting controls SRTP for the call audio: disabled, allowed, or required. If you set it to required with TLS, enable secure trunking and SRTP on the carrier side too. Setting it on one end only won’t encrypt anything.
4. Register the trunk with Cartesia
Create the trunk through the API with your inbound credentials and outbound carrier address:
curl -X POST "https://api.cartesia.ai/agents/phone-numbers/providers" \
-H "X-API-Key: $CARTESIA_API_KEY" \
-H "Cartesia-Version: 2026-08-14" \
-H "Content-Type: application/json" \
-d '{
"type": "sip_trunk",
"label": "Primary carrier trunk",
"inbound": {
"credentials": { "username": "carrier-inbound", "password": "your-sip-password" },
"media_encryption": "allowed"
},
"outbound": {
"address": "sip.example.com",
"transport": "tls",
"destination_country": "US",
"media_encryption": "required",
"credentials": { "username": "cartesia-outbound", "password": "your-sip-password" }
}
}'
outbound.address is the carrier host that receives Cartesia’s INVITE, without a sip: prefix. Without a port, Cartesia uses 5060 for TCP and 5061 for TLS.
5. Import your numbers and assign an agent
Import each carrier number against the trunk’s provider ID, then assign it to an agent in the Playground or with the Phone Numbers API. Inbound calls to that number now reach the agent. For outbound calls, pass the number as from_number_id. Your carrier decides the caller ID the recipient sees.
6. Set up transfers and test them
Enable Transfer call on the agent, or configure the transfer_to_number system tool, with phone numbers or SIP URIs as destinations. Cartesia transfers are cold transfers over SIP REFER. If the carrier rejects a transfer, Cartesia keeps the original call connected, so the caller doesn’t get dropped. On Twilio Elastic SIP Trunking, set the trunk’s transfer mode to enable-all.
Then call the number from a real phone, interrupt the agent mid-sentence, read out an order number, and ask for a person. That’s ten minutes, and it catches most of what goes wrong in production.
Common SIP trunk problems
| Symptom | Usual cause |
|---|---|
| Calls never arrive | The origination URI or transport is wrong, or a firewall blocks the carrier’s IP addresses. |
401 or 403 responses | The digest credentials don’t match, or the source IP isn’t on the allowlist. |
| The call connects but nobody hears audio | RTP is blocked or misrouted, often by NAT or a firewall that allows SIP but not the media ports. |
| The call fails when encryption is on | SRTP is required on one side and not enabled on the other. |
| Transfers fail | The carrier doesn’t accept REFER for that destination type, or transfers are disabled on the trunk. |
| The agent mishears names and numbers | Narrowband 8 kHz audio. Test recognition on real phone audio, not browser recordings. |
What it costs
Two bills apply. Your carrier charges for the trunk: per channel, per minute, or both, plus number rental. The voice agent platform charges for the agent. On Cartesia, Managed Agents calls cost $0.06 per minute whatever the number source. Calls on SIP trunk numbers carry no Cartesia telephony fee, because your carrier bills the carrier side. The $0.014 per minute telephony add-on applies only to Cartesia-provisioned numbers. LLM usage is billed on top.
To try it, create an agent in the Cartesia playground, connect your trunk, and call it. Our AI phone agent page covers numbers, outbound calling, and transfers.