Telephony primer: PSTN, SIP, RTP and WebRTC
此内容尚不支持你的语言。
Why voice is different
Section titled “Why voice is different”Text lets a user think, edit and send at their own pace. Voice does not. A phone call is a real-time, full-duplex audio stream. Every extra millisecond of silence feels wrong. That constraint — latency is the product — shapes every design decision in voice AI.
A voice agent must listen, think and speak inside the same time budget a human would use: roughly one to two seconds of silence before a reply feels natural.
The three eras of calling
Section titled “The three eras of calling”1. PSTN — the public switched telephone network
Section titled “1. PSTN — the public switched telephone network”The worldwide circuit-switched network that has connected phones since the 1800s. Calls travel as analogue or digital signals over copper, fibre and microwave links, switched by telco exchanges. Audio is encoded at 8 kHz / 8-bit (G.711), giving a narrow 300–3 400 Hz band. That encoding is still what a mobile or landline call delivers to any system answering on a phone number.
2. VoIP — voice over IP
Section titled “2. VoIP — voice over IP”Starting in the 1990s, voice moved onto IP networks. The key protocols:
| Layer | Protocol | Role |
|---|---|---|
| Signalling | SIP (Session Initiation Protocol) | Sets up, modifies and tears down calls — like dialling and hanging up. |
| Media | RTP (Real-time Transport Protocol) | Carries the actual audio packets between endpoints. |
A SIP trunk is a logical connection between two SIP-speaking systems (for example, a carrier and a voice platform). It replaces a bundle of physical phone lines.
3. Browser and app calling — WebRTC
Section titled “3. Browser and app calling — WebRTC”WebRTC lets a browser or mobile app send and receive audio and video peer-to-peer (or through a media server) with no plugin. It uses its own overbearing suite (ICE, DTLS-SRTP, SCTP) but the idea is the same: signalling to set up a session, then real-time media.
Signalling versus media
Section titled “Signalling versus media”A common source of confusion: signalling and media travel separately.
- Signalling (SIP, or WebSocket messages in WebRTC) says “start a call to this number, codec is G.711, send audio to this IP.”
- Media (RTP/SRTP) is the audio itself — tiny packets, 20 ms each, flowing in both directions.
A server can handle signalling without ever touching audio, and vice versa.
Why phone audio is 8 kHz — and what it does to speech recognition
Section titled “Why phone audio is 8 kHz — and what it does to speech recognition”PSTN audio is sampled at 8 000 Hz. By the Nyquist theorem, that captures frequencies up to 4 kHz — enough for intelligibility, not for richness. Consonants like s, f and th lose energy above 4 kHz and become harder to distinguish.
Modern speech-recognition models are trained on wideband (16 kHz+) audio. When they receive 8 kHz phone audio:
- Accuracy drops, especially on short utterances, noisy lines, or accented speech.
- Language detection can misfire — a clipped English phrase may be scored as another language entirely.
- Background noise fills proportionally more of the narrow band.
Any voice AI system answering phone calls must account for this. Language hints, noise-robust models, and streaming recognition all help.
The AI voice loop
Section titled “The AI voice loop”An AI voice agent on a phone call repeats a tight loop every conversational turn:
flowchart LR A[Caller speaks] --> B[STT — speech to text] B --> C[Agent brain — decide reply] C --> D[TTS — text to speech] D --> E[Play audio to caller] E --> AEach stage adds latency. Typical first-pass measurements for an early system can look like:
| Stage | Typical range |
|---|---|
| Speech-to-text (per utterance) | 0.65 – 1.8 s |
| Agent brain + TTS | 1 – 3 s each (combined can dominate) |
| Total reply latency | 4 – 8 s |
The conversational bar is around 1.5 seconds. Closing that gap is an active engineering problem involving streaming recognition, shorter replies, faster models, and server placement closer to the caller.
Barge-in
Section titled “Barge-in”In natural conversation, people interrupt. Barge-in means the system detects new caller speech while the agent is still speaking, stops playback, and begins processing the interruption. Without barge-in, a voice agent feels like a one-way announcement.
Glossary
Section titled “Glossary”| Term | Meaning |
|---|---|
| PSTN | Public Switched Telephone Network — the global phone network. |
| SIP | Session Initiation Protocol — signalling for VoIP calls. |
| RTP | Real-time Transport Protocol — carries audio packets. |
| SIP trunk | A logical VoIP connection replacing physical phone lines. |
| G.711 | The standard PSTN audio codec: 8 kHz, 64 kbit/s. |
| WebRTC | Browser/app standard for real-time audio and video. |
| STT | Speech-to-text (automatic speech recognition). |
| TTS | Text-to-speech (speech synthesis). |
| Barge-in | Interrupting the agent mid-sentence and having it listen immediately. |
| Full-duplex | Both parties can send audio simultaneously. |
How this maps to Wetel Telephony today
Section titled “How this maps to Wetel Telephony today”Wetel Telephony is currently in a test environment, available on request. It implements the full loop described above — SIP inbound calling, speech-to-text, an agent brain backed by a knowledge base, text-to-speech, and barge-in — over real phone calls.
We are working on reducing reply latency toward the 1.5-second target through streaming recognition, shorter spoken replies, faster models, and closer server regions.