Dograh

What Is SIP Trunking? How It Works With AI Voice Agents

What Is SIP Trunking? How It Works With AI Voice Agents
TechnicalNovember 28, 2026·9 min read

What Is SIP Trunking? How It Works With AI Voice Agents

Abhishek Kumar
Abhishek Kumar·Co-founder, Dograh AI

Co-founder of Dograh, building the future of open-source voice AI agents. Own your voice AI stack.

SIP trunking connects a business phone system to the public phone network over the internet instead of copper lines. SIP sets up and ends each call while RTP carries the audio. An AI voice agent can answer where a PBX would, and Dograh, the open-source AI voice agent platform, takes your trunk on your own servers or on Dograh Cloud.

Key Takeaways

  • SIP only sets up and ends the call, and RTP carries the voice.
  • G.711, the standard phone codec, sends 8 kHz audio at 64 kbit/s.
  • A channel is one call at once, and it is an account limit.

SIP trunking sounds like hardware, but it is a carrier service that carries your calls over the internet. We follow one call through a trunk, from signaling and audio to codecs and channels, compare it with VoIP and PRI, and then we talk about where an AI agent connects.

What a SIP trunk does on one call

A SIP trunk is a phone line delivered as internet traffic. The carrier connects your phone system to the public phone network, and calls travel between them as data instead of over copper or a T1 circuit. The protocol that runs it is SIP, the Session Initiation Protocol, which RFC 3261 defines as a signaling protocol for creating, modifying and ending sessions such as phone calls.

Carriers split a trunk's traffic into two directions. Origination is the incoming side, calls from the public network arriving on your numbers. Termination is the outgoing side, calls your system places out to the public network. Many teams buy both from one carrier, and some buy only one side.

The numbers ride on the trunk too. Each number your callers dial is a DID, and the carrier tells your system which one was dialed so it can send the call to the right place. Our explainer on what a DID number is covers that part, and SIP trunk providers compared covers which carriers to pick.

Signaling and audio travel separately

A SIP call is really two conversations between machines. The signaling side sends short text messages. An INVITE asks to start the call, the other end answers that it is ringing and then that it has picked up, and a BYE ends it. None of those messages carry your voice.

A carrier's mast and an office are joined by two connections. A thin wire carries short messages to start the call, say it is ringing, say it is picked up and end it, none of them carrying the voice. A wide pipe below carries the voice as small packets, and a firewall on that pipe at the office can block them, which leaves one-way or missing audio.
A call that rings and answers can still fail the people on it, since the voice travels on its own path through your network. A trunk test passes only when audio flows both ways from start to finish.

The voice rides a separate stream. RTP, defined in RFC 3550, carries real-time data such as audio in small packets, many times a second. Before any audio flows, the two ends agree on how to encode it. One side offers a list of codecs it can use, the other answers with its choice, and that SDP offer and answer model is set out in RFC 3264.

This split explains many trunk problems. A call can connect perfectly on the signaling side and still have one-way or missing audio, because the RTP packets are blocked by a firewall or sent to the wrong address. When you test a trunk, check both. The call should ring and answer, and both people should hear each other for the whole call.

Codecs, from G.711 to Opus

A codec decides how the voice is squeezed into packets. G.711, the standard phone codec from the ITU, sends audio sampled at 8 kHz at 64 kbit/s. It comes in two versions, mu-law in North America and Japan and a-law in most other countries, and almost every carrier supports it.

Wider codecs exist. Opus, defined in RFC 6716, scales from 6 kbit/s for narrow speech up to 510 kbit/s for full stereo music, and it is common in browsers and apps. On the phone network, though, G.711 still dominates. Twilio's trunks use mu-law and a-law by default, and it offers Opus, G.729 and AMR-NB only as limited availability, not supported end to end.

For a voice agent, the codec sets the ceiling on audio quality. Most phone calls still reach the agent as 8 kHz audio, while a browser demo runs at 16 kHz, so speech recognition that sounds sharp in a demo can slip on a real call. Test the agent on the trunk it will use, with real callers' phones.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Channels and how a trunk is sized

A channel is one call at a time on the trunk. A trunk with 20 channels can carry 20 calls at once, inbound and outbound together, and the 21st caller hears busy. Channels are a setting on your account, so a carrier can raise them without new wiring.

Bandwidth follows the channel count. Twilio sizes a trunk as maximum simultaneous calls times 100 kbps, a figure that covers G.711 plus packet overhead. So 20 calls at once need about 2,000 kbps, or 2 Mbps, in each direction, which most business connections can spare.

Some carriers count every call leg against one pool. Plivo, for example, draws its voice API and its SIP trunks from one account-wide limit, and says every phone network leg counts. That matters for AI agents, since a call the agent transfers to a person adds a second leg while both are connected. Our breakdown of SIP trunk pricing shows how carriers charge for channels and minutes.

How a trunk knows the traffic is yours

A carrier has to know that calls arriving on its trunk come from you, or anyone could place calls on your bill. Two methods cover most trunks, and many carriers accept both together.

The first is an IP access list, where the carrier accepts outgoing calls only from the IP addresses you name. The second is credential authentication, where your system signs each call request with a username and password. Twilio requires at least one of the two before a trunk can place outgoing calls. Some phone systems also register with the carrier, logging in so the carrier knows where to send incoming calls. When an AI agent platform sits on the trunk, its fixed addresses or credentials go into this setting too.

SIP trunk vs VoIP vs PRI

The three terms get mixed up because they overlap. VoIP is the broad idea of sending voice over the internet. A SIP trunk is one way to do it, a carrier connection for a whole phone system. PRI is the older digital line that SIP trunks often replace.

VoIP phone serviceSIP trunkPRI line
What it isVoice over the internet, usually a hosted phone systemA carrier connection that feeds your own phone system or appA digital circuit from the carrier, on a T1 in North America
Who runs the phone systemThe VoIP providerYou, on your PBX or platformYou, on your PBX
CapacityUsers on the planChannels set on the account23 call channels on a T1
How it scalesAdd usersRaise the channel countAdd another circuit
Audio pathThe public internetThe public internet or a private linkA dedicated circuit

The internet path has a cost. A trunk is only as good as the network under it, and delay, jitter and lost packets on a busy office connection show up as choppy or clipped audio. Giving voice traffic priority on your router and keeping enough spare bandwidth matter more than the trunk brand. Our post on SIP trunk vs PRI covers when a PRI still makes sense.

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Where an AI voice agent connects

An AI voice agent takes the place a desk phone or a PBX extension would have. The trunk delivers the call to an address that speaks SIP, that system turns the RTP audio into a stream, and the agent listens and answers on that stream. For outbound calls the path runs the other way, with the agent's platform asking the trunk to place the call.

There are two common shapes. In the first, the trunk points straight at the agent platform, which answers every call on the numbers you choose. In the second, the trunk stays on your PBX, and the PBX sends chosen calls to the agent, such as after-hours calls or one department's line. The second keeps your existing phones and routing in charge, and the agent becomes one more destination.

Either way, the agent inherits the trunk's limits. It hears 8 kHz audio on most calls, it counts against your channels, and a transfer to a person uses another leg.

Connecting your own trunk or PBX to Dograh

Dograh connects to the carrier you already use, so the trunk, its numbers and its bill stay yours. A trunk from any carrier can reach a Dograh agent through your own Cloudonix account, a cloud SIP platform. You connect it under Telephony with Add configuration, choosing Cloudonix and entering your Bearer Token and Domain Name. Application Name is optional, and the voice application is created on save if you leave it blank. The Cloudonix setup page covers the inbound trunk and number binding in Cloudonix's cockpit.

Inside Cloudonix, the carrier's trunk delivers calls, and each dialed number is bound to that voice application. In Dograh, you add the number to the configuration in E.164 form, such as +1415555XXXX, and set its Inbound workflow to the agent that should answer. Our Cloudonix setup guide walks through it end to end.

If your trunk already lands on an Asterisk PBX, a self-hosted Dograh install can take calls through Asterisk ARI. You enter the ARI Endpoint, ARI Username and password, and the websocket_client.conf connection name, and a Stasis App Name for your dialplan is generated on save. Dograh's media stream uses G.711 mu-law, so the trunk endpoint must allow ulaw. Use Asterisk 22.8 or later, or 20.18 or 23.2 on those release lines, since every call uses a WebSocket option those releases added.

Running Dograh yourself this way means you still pay for servers, model keys and the carrier's phone minutes, and your team looks after the database and upgrades. Once a number is in place, place a test call with Phone Call in the agent editor and listen on both ends.

Glossary

Origination and termination
The two directions of trunk traffic. Origination is calls arriving on your numbers from the phone network, and termination is calls you place out to it.
SDP offer and answer
The exchange in which one end of a SIP call lists the codecs it supports and the other picks one, set out in RFC 3264, before any audio flows.
Channel
One call at a time on a trunk. A 20-channel trunk carries 20 calls at once, inbound and outbound together, and a transferred call can use two.
RTP
Real-time Transport Protocol, the stream that carries a call's audio in small packets, separate from the SIP messages that set the call up.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.