# Telephony Concepts

> Industry vocabulary that this documentation uses.

This page is a brand-neutral reference for the telephony terminology
that appears in the rest of the docs. The "Where this maps to
FirstByte" section at the bottom links each concept area to the page
that implements it.

## Networks and origination

| Term | What it means |
| ---- | ------------- |
| **PSTN** | Public Switched Telephone Network — the global circuit-switched / IP voice network that terminates real phone numbers. |
| **VoIP** | Voice over IP — voice that travels as packets over data networks instead of circuits. |
| **SIP** | Session Initiation Protocol (RFC 3261) — the signaling layer that starts, modifies, and stops voice sessions. |
| **RTP** | Real-time Transport Protocol — the media layer that carries the audio packets after SIP sets up the call. |
| **SRTP** | Secure RTP — RTP encrypted with DTLS-SRTP keys that the endpoints negotiate during signaling. WebRTC requires it. |
| **DTLS-SRTP** | Datagram TLS that negotiates SRTP keys. It is the standard WebRTC media-encryption handshake. |
| **ICE / STUN / TURN** | The NAT-traversal toolkit for peer-to-peer media. ICE picks the candidate path. STUN discovers public addresses. TURN relays media when peer-to-peer is blocked. WebRTC uses all three. |
| **SDP** | Session Description Protocol — the offer/answer body inside SIP/WebRTC that says "I speak Opus and PCMU on UDP/16384". |
| **DID** | Direct Inward Dial — a phone number that routes inbound calls into a specific extension or trunk. To "buy a DID" means to rent a phone number. |
| **DDI** | The European synonym for DID. |
| **Toll-free number (TFN)** | Numbers such as 800/888. The **callee** pays the per-minute cost. |
| **E.164** | The international number format: `+<country><number>`, max 15 digits. Always quote and store numbers in E.164. |
| **CNAM** | Caller-ID Name — the string that the receiving phone shows. It is distinct from the calling number. |
| **CLI / Caller-ID** | The number that the caller presents to the called party. Regulatory rules apply (US STIR/SHAKEN, EU caller-ID spoofing laws). |
| **ANI** | Automatic Number Identification — the *billing* number on the receiving side. 911 and toll-free services use it. |

## Trunks and carriers

| Term | What it means |
| ---- | ------------- |
| **SIP trunk** | A logical connection between a voice platform and a carrier (or PBX). It has channels, codecs, auth credentials, and an IP allowlist. |
| **CPS** | Calls Per Second — the pacing limit that a trunk accepts before it throttles. Carriers price by CPS. |
| **Channels** | The number of concurrent in-flight calls that a trunk can hold. `CPS × ACD` ≈ steady-state channel usage. |
| **SBC** | Session Border Controller — a hardened SIP/RTP proxy at the edge of a network. It handles NAT, security, and transcoding. |
| **PBX** | Private Branch eXchange — an enterprise call switch. It sits between phones and trunks. |
| **Origination** | Outbound calls, from your platform to the PSTN. |
| **Termination** | The carrier's term for delivery of your outbound call to its destination. The same word also means the call's hangup. |
| **Number portability (LNR / LNP)** | The ability to keep a phone number when you change carriers. It adds a routing lookup before the call leaves your network. |
| **DTMF** | The 0–9, *, # tones. There are three signaling modes: in-band (audible), RFC 2833 (RTP events), or SIP INFO. Use RFC 2833 where possible. |

## Codecs and media

| Term | What it means |
| ---- | ------------- |
| **G.711 µ-law (PCMU)** | An 8 kHz, 64 kbit/s codec. It is the North-American PSTN standard. It applies lossy log compression to 14-bit linear samples. |
| **G.711 A-law (PCMA)** | The same as µ-law, but with a different log curve. It is the EU/ROW PSTN standard. |
| **Opus** | A modern wideband codec, 6 kbit/s – 510 kbit/s. It is the WebRTC default. It sounds much better than G.711. |
| **G.722** | A 16 kHz wideband codec at 64 kbit/s. Many mobile networks use it as "HD voice". |
| **AMR / AMR-WB** | Mobile-network codecs. They are rare on PSTN handoff. |
| **Linear16 / PCM16** | Uncompressed 16-bit PCM. ML/AI services usually want this format. |
| **Transcoding** | Conversion from one codec to another mid-call. It costs CPU and adds ≥ 20 ms of latency. |
| **Jitter** | Variation in packet inter-arrival time, measured in ms. Jitter > 30 ms typically requires de-jitter buffering. |
| **Jitter buffer** | An adaptive queue that smooths jitter at the cost of latency. A bigger buffer gives better audio and more delay. |
| **Packet loss** | The % of RTP packets that never arrive. Loss > 1 % is audible. Loss > 3 % is unintelligible. |
| **PLC** | Packet Loss Concealment — it synthesizes plausible audio to mask a missing packet. Most modern codecs include it. |
| **MOS** | Mean Opinion Score, 1.0–5.0. It estimates subjective quality. A score ≥ 4.0 is "toll quality". |
| **R-factor** | An objective ITU E-Model score, 0–100. It drives an estimated MOS. |
| **VAD** | Voice Activity Detection. It suppresses silence frames or triggers barge-in. |
| **AEC / AGC / NS** | Acoustic Echo Cancellation / Auto Gain Control / Noise Suppression — the three pillars of the WebRTC audio-processing pipeline. |
| **Comfort noise** | Synthetic background hiss inserted during silence. It keeps the line from sounding "dead". |

## Transports — how the audio actually travels

A modern voice platform must know these four transports:

| Transport | What it is | Where it's used |
| --------- | ---------- | --------------- |
| **SIP + RTP** | Classic VoIP. Signaling travels on SIP (TCP/UDP/TLS). Media travels on RTP/UDP. It is the carrier-facing protocol. | Carrier ↔ gateway trunks. |
| **WebRTC** | Browser-native voice/video. Signaling sends SDP over WebSocket. Media uses **DTLS-SRTP** over UDP, with **ICE** for NAT traversal. Media is always encrypted and is peer-to-peer by default. | Browser softphones, click-to-dial, agent dashboards, embedded contact-centre widgets, integrations with LiveKit / Daily / Chime / Twilio Media Streams / Vapi. |
| **WebTransport** | An HTTP/3 alternative for browser ↔ server bidirectional streams. It uses the same underlying QUIC, with no peer-to-peer and no ICE. | Browser apps that want a low-overhead control plane multiplexed with media on the same QUIC connection. |
| **QUIC** | A UDP-based encrypted multiplexed transport. Native SDKs use it directly to talk to the gateway. | Server-side Python / Go / Rust / Java / .NET workloads. |

WebRTC vs SIP — the rule of thumb:

- Use **SIP/RTP** for the trunk side (carrier ↔ gateway). The PSTN does not speak WebRTC.
- Use **WebRTC** for the last mile to humans in browsers or vendor SDKs (LiveKit, Daily, Chime, Vapi, Twilio Media Streams).
- Use **QUIC / WebTransport** for server-side or browser control workloads. Choose them when the audio source is already-decoded PCM (for example, a TTS pipeline) and you want minimum framing overhead.

## Call lifecycle and patterns

| Term | What it means |
| ---- | ------------- |
| **A-leg / B-leg** | A-leg = caller side; B-leg = callee side. A *bridge* connects them. |
| **Ringback tone** | The "ring ring" that the caller hears before answer. The local switch or the far end (early media) generates it. |
| **Early media** | Audio that the far end sends *before* the SIP `200 OK`. Carriers use it for "the number you have dialed…" intercepts. |
| **Bridge** | Connect two legs so audio flows both ways. |
| **Park** | Hold a call without a bridge — keep the line open with music or silence. |
| **Music on hold (MOH)** | Audio that plays to a parked call. You can set it via URL or stream. |
| **Transfer (blind / attended)** | The industry terms for the handoff of a call to another destination. *Not implemented* — out of scope on this platform. |
| **Conference** | The industry term for a mix of three or more legs into one audio stream. *Not implemented* — out of scope on this platform. |
| **Whisper / Coach** | The industry terms for one-way supervisor audio. *Not implemented* — the platform's `Barge` is unrelated; see the next row. |
| **Barge (AI barge-in)** | The headline AI-network unblocker. While an AI agent speaks, the gateway listens for the human caller's voice on the inbound leg. When the voice crosses the configured energy / VAD / semantic threshold, the gateway gates the AI's outbound audio. The human is then heard immediately. Without barge-in, AI voicebots feel deaf: the human must wait for the AI to finish before the AI acknowledges them. Set it per call via `auto_barge_in` and `barge_in_patience_ms`, and per trunk via `auto_bargein_mode` (`energy` / `vad` / `semantic` / `off`). |
| **Barge-in patience** | The grace window in milliseconds between detection of the human's voice and the gate on the AI. A window that is too short stops the AI on a cough. A window that is too long makes the AI talk over the caller. Typical values: 150–350 ms. |
| **IVR** | Interactive Voice Response — menus driven by DTMF or speech. |
| **ACD** | Automatic Call Distribution — routing rules that send inbound calls to queues, agents, and skill groups. |
| **AMD** | Answering-Machine Detection — a heuristic classifier that says "human" vs "voicemail" within the first ~2 s of audio. |

## Routing and dialplan

| Term | What it means |
| ---- | ------------- |
| **Dialplan** | The rules engine that decides what happens to a call: hang up, park, play, bridge, or hand to AI. |
| **LCR** | Least-Cost Routing — pick the cheapest carrier per destination prefix. |
| **Failover routing** | Try carrier A. On `503 Service Unavailable`, try carrier B. Trip a circuit breaker after N consecutive failures. |
| **Geo-routing** | Choose a regional gateway based on caller location, latency, or compliance. |
| **Whitelist / Blocklist** | Static allow/deny lists per trunk. Carriers often require them for outbound caller-ID. |
| **Inbound rule** | What to do when a PSTN call arrives at one of your DIDs: REJECT, PLAY-AND-HANGUP, NOTIFY-AND-HANGUP, or HANDLE-AI. |

## Compliance vocabulary

| Term | What it means |
| ---- | ------------- |
| **STIR/SHAKEN** | The US/CA framework for caller-ID attestation. Every outbound INVITE carries an `Identity` JWT signed by your carrier or platform. The attestation level (A/B/C) controls how trustworthy the receiving carrier marks your call. |
| **TCPA** | The US Telephone Consumer Protection Act. It regulates outbound dialing — quiet hours, abandoned-call rate caps, and consent requirements. |
| **Do-Not-Call (DNC)** | Federal + state lists. DNC suppression must run before every dial. |
| **GDPR / CCPA** | Privacy regimes that govern call recordings and CDR storage. They affect retention windows. |
| **HIPAA** | US health-info privacy. Healthcare deployments require a BAA + encrypted recording storage. |
| **PCI-DSS** | Card-data privacy. If your IVR collects card numbers, the IVR step must redact DTMF from recordings ("DTMF masking"). |
| **E911 / 112** | Emergency calls with the location attached as PIDF-LO. It is mandatory for any platform that lets users dial out. |
| **CALEA / Lawful Intercept** | Government wiretap obligations for carriers. The upstream carrier honours them, not the gateway. |

## Where this maps to FirstByte

This table maps each section above to the page that implements it on
this platform:

| Concept area | Lives in |
| ------------ | -------- |
| Trunk lifecycle, codec preferences, inbound rules | [Admin → Trunks](/admin/trunks) |
| Outbound origination, bulk dialer, hangup, barge | Public RPC — see [Method IDs](/rpc/method-ids) |
| Dialplan actions (park, MOH, playback, transfer) | `ExecuteDialplan` and bucket actions |
| WebRTC vendor adapters (Browser, LiveKit, Daily, Chime, Twilio, Vapi) | [Platform → WebRTC Vendors](/platform/webrtc-vendors) |
| Compliance headers (STIR/SHAKEN, PANI, PIDF-LO) | [Platform → Regulatory](/platform/regulatory) |
| MOS, jitter, packet loss, CDRs | [Platform → Telemetry](/platform/telemetry) |

## The four numbers that bound a voice deployment

Every sizing or capacity discussion comes back to these four numbers:

1. **CPS** sustained (per trunk and aggregate).
2. **Concurrent channel** ceiling.
3. **End-to-end latency** (caller mouth → callee ear, in ms).
4. **MOS** under typical packet-loss conditions.

Codecs, dialplan, AI bridges, and WebRTC interop all depend on those
four numbers.
