Skip to content

Telephony primer: PSTN, SIP, RTP and WebRTC

This content is not available in your language yet.

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.


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.

Starting in the 1990s, voice moved onto IP networks. The key protocols:

LayerProtocolRole
SignallingSIP (Session Initiation Protocol)Sets up, modifies and tears down calls — like dialling and hanging up.
MediaRTP (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.

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.


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.


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 --> A

Each stage adds latency. Typical first-pass measurements for an early system can look like:

StageTypical range
Speech-to-text (per utterance)0.65 – 1.8 s
Agent brain + TTS1 – 3 s each (combined can dominate)
Total reply latency4 – 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.


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.


TermMeaning
PSTNPublic Switched Telephone Network — the global phone network.
SIPSession Initiation Protocol — signalling for VoIP calls.
RTPReal-time Transport Protocol — carries audio packets.
SIP trunkA logical VoIP connection replacing physical phone lines.
G.711The standard PSTN audio codec: 8 kHz, 64 kbit/s.
WebRTCBrowser/app standard for real-time audio and video.
STTSpeech-to-text (automatic speech recognition).
TTSText-to-speech (speech synthesis).
Barge-inInterrupting the agent mid-sentence and having it listen immediately.
Full-duplexBoth parties can send audio simultaneously.

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.