Most people picture an AI voice agent like this:
Customer calls → AI answers
Simple. Almost like ChatGPT wired up to a phone number.
Real production systems are far more interesting.
Behind every AI receptionist sits an entire realtime infrastructure stack — telecom networks, streaming protocols, SIP signaling, PBX routing, AI orchestration, and backend services — all working together in milliseconds.
And once you see the full picture, one thing becomes obvious:
Voice AI isn't just an AI problem. It's a realtime systems engineering problem.
To understand why, let's follow a single phone call from the moment it's dialed to the moment someone hangs up.
The setup
A customer picks up their phone and calls XYZ Plumbing Services.
At first, nothing "AI" happens at all. The call begins its life in the traditional telecom world.
The phone connects to the nearest cell tower, the request travels through the carrier network, and it eventually reaches the PSTN — the global telephone routing system that decides where calls should go.
The network essentially asks one question: "Who owns this phone number?"
And the PSTN answers: "This number belongs to Twilio."
Just like that, the call is routed into Twilio's infrastructure.
Stage 1 — Crossing from telecom to the internet
This is the most important transition in the entire system:
Traditional telecom → Internet-based voice infrastructure
It matters because your stack can't speak telecom:
Your AI servers don't understand telecom protocols.
Your backend APIs don't speak PSTN.
Your cloud infrastructure can't directly receive a carrier phone call.
Twilio is the bridge between those two worlds. It takes a call from the old telephone network and hands it off to systems that live on the internet.
Stage 2 — SIP takes the call
Once Twilio has the incoming call, it needs to figure out where the call goes next. This is where SIP enters.
Twilio sends a SIP INVITE to the PBX system.
Think of SIP as the protocol that manages the conversation itself:
Ringing
Answering
Transfers
Hangups
Session management
Everything except the actual audio.
This is one of the biggest misconceptions about voice systems:
SIP does NOT carry voice audio.
SIP only manages the session. The live audio travels over a separate protocol — RTP (Realtime Transport Protocol).
The clean way to remember it:
SIP manages the call. RTP carries the voice.
Stage 3 — The PBX answers
The PBX receives the SIP request and accepts the call. At that exact moment, the realtime audio stream begins — and the PBX starts running business logic.
This is where IVR systems show up. You've heard them thousands of times:
"Welcome to XYZ Plumbing Services." "Press 1 for emergency." "Press 2 for support." "Press 3 for billing."
Most people assume this is just a prerecorded audio file. It's not. Behind the scenes, the PBX is acting as a realtime traffic controller, constantly deciding one thing:
"Where should this call go next?"
Stage 4 — The keypress
The caller presses 1.
That single button generates a DTMF signal — a unique audio tone combination for each key on the keypad.
Here's the part most people get wrong:
The system does NOT create a new call.
The same realtime session stays alive the entire time. The signal simply travels through the connection that's already open:
Phone → Carrier → Twilio → PBXThe PBX detects Digit = 1 and immediately executes its routing logic:
Route caller → emergency AI agent
All of it happens in realtime, within milliseconds.
Stage 5 — The AI agent takes over
Now the modern AI pipeline kicks in.
The customer speaks. The speech becomes text. The LLM processes it. A response is generated. The text becomes audio. The voice streams back to the caller.
At a glance, the pipeline looks like this:
Caller Speech → Speech-to-Text → LLM → Text-to-Speech → Voice ResponseBut production systems go much deeper. During the same conversation, the AI often reaches into:
CRM systems
Scheduling systems
Databases
Payment systems
Ticketing systems
Internal APIs
So when a customer says "My pipe burst," the agent can instantly:
Ask for the address
Check technician availability
Create an emergency ticket
Schedule a visit
Confirm the appointment
…all while the realtime audio stream keeps running in the background.
The mental model that changes everything
Most people imagine voice AI as a series of separate requests firing one after another.
That's not how it works.
Once the call is established, a persistent realtime media stream stays alive continuously. Audio packets stream in both directions until someone hangs up. The whole thing becomes a continuous loop:
Caller Voice
→ Carrier Network
→ Twilio
→ PBX / AI Server
→ Speech-to-Text
→ LLM
→ Text-to-Speech
→ Audio back to callerAgain. And again. And again — all in realtime.
No new PSTN lookup. No new SIP session. The same session simply stays open for the entire conversation.
Why this is genuinely hard to build
The challenge isn't generating intelligent responses. The challenge is making a system that feels natural in realtime.
Humans are brutally sensitive to delay. Even half a second of latency makes a conversation feel awkward.
Which means voice AI quietly becomes a problem of:
Networking
Streaming
Latency optimization
Packet timing
Interruption handling
Media transport
Backend orchestration
Distributed systems
At that point, you're building something closer to Zoom, Discord, or realtime gaming infrastructure — not a chatbot.
Build vs. buy
This is why many startups begin on platforms like Twilio, Vapi, or Bland AI. They abstract away the hard infrastructure and let teams launch fast.
But as companies scale, many move toward owning more of the stack:
SIP trunks
Self-hosted PBX systems
Asterisk
FreeSWITCH
Custom realtime infrastructure
Controlling the infrastructure buys you lower latency, lower costs, more flexibility, deeper integrations, and better margins.
The takeaway
Modern AI products are no longer just models. They're entire realtime distributed systems.
And the engineers who understand both sides — AI and infrastructure — will have a massive advantage in the next generation of software.
If you enjoyed this breakdown, subscribe to ai.shipped for more deep dives into AI infrastructure, realtime systems, voice AI, backend architecture, LLM engineering, and production AI systems.

