A SIP bridge is the layer between the public phone network and an AI voice agent. It translates signaling, negotiates codecs, relays audio, handles keypad tones and transfers, and keeps the call alive while the agent listens, thinks and speaks. You can have a fast model and a natural voice, and still fail callers if this layer drops audio or loses a transfer.
This guide covers the architecture, a call flow, codecs, DTMF, passing data to the agent, transfers to humans, outbound calling, failover, one-way audio and monitoring. For choosing carriers and channels, see our SIP trunking guide; for a step-by-step setup, see how to connect a voice AI agent to a SIP trunk.
What does a SIP bridge do in an AI voice stack?
AI Summary: The bridge terminates the carrier call, creates a matching leg to the AI media server, and controls codecs, media relay, DTMF, transfers and teardown between them.
Technically, most SIP bridges are B2BUAs. Instead of forwarding messages like a proxy, a B2BUA acts as the endpoint for each leg, which gives it control over everything that happens between them.
Component | What it does | Changes the media? | Typical role in AI telephony |
SIP proxy | Routes SIP messages | No | Load balancing, failover routing, registration |
B2BUA | Ends one leg and starts another | Can relay and transcode | The bridge itself |
Session border controller (SBC) | B2BUA plus security and interoperability at the edge | Often | Carrier-facing edge, topology hiding, TLS and SRTP |
WebRTC gateway | Translates SIP and RTP to WebRTC signaling and DTLS-SRTP | Yes | Connects phone calls into a WebRTC agent pipeline |
Common building blocks include Kamailio or OpenSIPS for proxying, FreeSWITCH or Asterisk as B2BUAs, rtpengine for media relay, and LiveKit SIP for bridging phone calls into LiveKit agent rooms. Our managed LiveKit support team runs the last pattern in production.
The 4-Tier SIP Bridge Architecture
The RTC LEAGUE 4-Tier SIP Bridge Architecture separates the edge, the bridge, the agent media layer and the application, so each scales and fails independently.
We build every telephony deployment on the RTC LEAGUE 4-Tier SIP Bridge Architecture.
Tier | Responsibilities | Scales on |
1. Edge (SBC and proxy) | TLS, authentication, IP allowlists, rate limits, carrier failover, routing | Calls per second |
2. Bridge (B2BUA and media relay) | SDP negotiation, codec normalisation, DTMF, transfers, SIP to WebRTC | Concurrent calls, transcoding load |
3. Agent media (media server and AI workers) | ASR, LLM, TTS, turn-taking | Concurrent sessions, GPU |
4. Application | Conversation state, tool calls, CRM, analytics | Requests |
Keeping tiers 1 and 2 separate means a signaling flood doesn't take down live audio, and you can update the AI stack without touching the carrier connection.
What does an inbound AI call flow look like?
The carrier sends an INVITE, the bridge answers with an agreed codec, sets up the agent leg, and the agent speaks only once media is confirmed both ways.
Step | Message | What the bridge should do |
1 | Carrier sends INVITE with SDP offer | Authenticate, check the dialled number, pick the route |
2 | Bridge replies 100 Trying | Stop carrier retransmissions |
3 | Bridge creates the agent leg | Start the agent session and pass caller data |
4 | Bridge replies 200 OK with SDP answer | Offer only the codecs you want (ideally G.711) |
5 | Carrier sends ACK | Call is established |
6 | Media flows both ways | Confirm inbound RTP before the agent's greeting |
7 | Either side sends BYE | Tear down both legs and release resources |
Wait for audio to flow before the agent speaks. Greeting into a path that isn't connected yet is a common cause of callers hearing the middle of a sentence. If you use early media (183 Session Progress) for prompts before answering, confirm the carrier supports it.
Which codec should a SIP bridge use for AI speech recognition?
Prefer G.711 end to end from the carrier, resample once to the rate your ASR expects, and avoid G.729 and repeated transcoding.
Codec | Sample rate | Effect on AI speech recognition | Recommendation |
G.711 (PCMU or PCMA) | 8 kHz | Clean narrowband audio | Preferred from the PSTN |
G.722 | 16 kHz | Better high-frequency detail | Use when the carrier supports it end to end |
G.729 | 8 kHz, compressed | Artefacts reduce accuracy | Avoid for AI where possible |
Opus | Up to 48 kHz | Best quality, adaptive | Preferred on the WebRTC leg |
In your SDP answer, list only the codecs you accept so the carrier can't pick G.729. Then resample once, inside the media pipeline, to the format your ASR expects (commonly 16 kHz linear PCM). Upsampling doesn't add detail that 8 kHz audio never had, so test accuracy on real phone recordings; see evaluating ASR accuracy.
Keep packet time (ptime) consistent, usually 20 ms, on both legs to avoid buffering artefacts.
How should a SIP bridge handle DTMF for AI agents?
Use RFC 4733 telephone events, avoid in-band detection on compressed audio, and deliver each keypress to the agent as an application event.
Method | How it travels | Reliability | Use |
RFC 4733 (formerly RFC 2833) | RTP telephone-event packets in the media stream | High | Default |
SIP INFO | SIP signaling messages | Variable between carriers | Only if the carrier requires it |
In-band audio | Tones inside the audio | Poor on compressed codecs | Last resort |
For AI agents, forwarding tones isn't enough. The bridge should turn each digit into an event for the agent's logic ("digit 4 pressed") so the agent can react mid-conversation, collect a PIN securely or hand payment entry to a masked flow. Keep card digits away from transcripts and the model entirely; see data privacy in voice AI.
How do you pass caller data from SIP to the AI agent?
Read caller identity and routing headers at the bridge and pass them to the agent session as metadata, so the agent starts the call with context.
Useful sources in the INVITE include the caller's number (From and P-Asserted-Identity headers), the dialled number (To or Request-URI), Diversion or History-Info headers showing why a call was forwarded, and custom headers your PBX or contact center adds, such as a queue name or customer ID.
Pass these to the agent as session metadata, not as text inside the prompt, so they can't be spoofed into instructions. The agent can then look up the customer through CRM integration before the first word. Treat caller ID as a hint, not proof of identity.
How do you transfer an AI call to a human agent over SIP?
Use a SIP REFER for blind transfers, or keep the bridge in the call and dial the human for warm transfers that carry a summary.
Method | How it works | Pros | Cons |
Blind transfer (REFER) | Bridge tells the carrier or PBX to connect the caller elsewhere | Frees your resources | Context must travel separately; not every carrier supports REFER |
Bridged warm transfer | Bridge dials the human, briefs them, then joins the caller | Human gets context; no repeat questions | Bridge stays in the media path |
Context headers | Add a summary reference or case ID in a header such as User-to-User (RFC 7433) | Context arrives with the call | The receiving system must read it |
Whichever method you use, send a short summary (reason for calling, verified identity, what's been done) so the caller never has to start over. That handoff is one of the six pillars in our AI agent design guide.
What changes for outbound AI calls?
Outbound calls add caller ID rules, answering machine detection, call pacing and compliance checks on top of the inbound design.
Caller ID and attestation. Use numbers you own; in the US, make sure calls carry STIR/SHAKEN attestation.
Answering machine detection. Decide what the agent does on voicemail (leave a short message or hang up) and test detection on local carriers.
Pacing. Limit calls per second to what your trunk and agents can handle; campaigns often trip carrier rate limits.
Compliance. Respect consent, calling hours and do-not-call rules; AI-generated voices in the US fall under the TCPA.
How do you make a SIP bridge highly available?
Run edge and bridge in multiple zones, use DNS SRV and OPTIONS health checks for routing, keep two carriers and route new calls away from failing nodes.
Edge: at least two SBC or proxy instances across zones; carriers reach them through DNS SRV records with priority and weight.
Health checks: SIP OPTIONS pings detect dead peers quickly; fail over on timeouts and 503 responses.
Media: a live RTP stream can't move to another server without a gap, so route new calls to healthy nodes and drain nodes gracefully.
Carriers: two providers or diverse routes, with numbers that can be re-pointed quickly.
Session timers (RFC 4028): detect calls that are silently dead and release them.
The broader patterns are covered in agent failover patterns.
How do you fix one-way audio on a SIP bridge?
One-way audio usually means media is sent to the wrong address because of NAT or SDP errors; enable symmetric RTP and check every SDP address.
Symptom | Likely cause | Fix |
Caller can't hear the agent | SDP advertises a private IP | Set the public media address; use an SBC or rtpengine |
Agent can't hear the caller | Firewall blocks the RTP port range | Open the range from carrier IPs only |
Audio drops after 30 to 60 seconds | NAT binding expires | Symmetric RTP, keepalives, session timers |
No audio for the first seconds of WebRTC calls | DTLS not finished before media | Wait for DTLS completion before bridging |
Audio stops after hold or transfer | Re-INVITE handled wrongly | Test hold, resume and transfer flows explicitly |
Enable symmetric RTP (send media back to where it actually comes from) and rport (RFC 3581) for SIP behind NAT.
What should you monitor on a SIP bridge?
Track call setup success and time, response codes, media quality per leg, DTMF delivery and silent-call timeouts.
Metric | Alert when |
Answer seizure ratio and call setup success | Drops below baseline |
INVITE to 200 OK time | p95 rises sharply |
4xx and 5xx responses by code | Any code spikes |
Packet loss, jitter, MOS per leg | Loss over 1%, jitter over 30 ms |
RTP silence timeouts | Rising count |
DTMF events received vs delivered to the app | Any gap |
Transfer success rate | Falls below target |
How many concurrent calls can a SIP bridge handle?
A pure relay handles far more calls per server than one that transcodes; profile your own codec path before sizing.
A bridge that only relays RTP can carry a very large number of calls per server, because it just moves packets. Transcoding, especially to and from G.729, uses far more CPU per call. Profile your actual codec path under load, size for peak concurrency plus 20 percent, and load test with SIPp as described in our testing guide.






.jpg&w=2048&q=65)
