try hiccup

Codecs and transcoding: why calls sound the way they do

Short version: the codec sets the ceiling on how good a call can sound; the network decides how far below that ceiling it lands. Transcoding — decoding one codec and re-encoding into another — always spends latency, CPU and quality to buy interoperability, and its most expensive victims are the non-speech things riding the voice channel: DTMF and fax.

The codecs you actually meet

CodecPayload bitrateOn the wire*Character
G.711 (PCMU/PCMA)64 kbit/s~80 kbit/sThe 1972 baseline. Narrowband ceiling (~MOS 4.4), trivially cheap to process, degrades gracefully, passes modem/fax tones. When bandwidth is not scarce, hard to beat.
G.7298 kbit/s~24 kbit/sThe classic low-bandwidth choice (~MOS 3.9 ceiling). Notice the wire numbers: it is a third of G.711's total, not an eighth — the headers do not shrink.
G.72264 kbit/s~80 kbit/sWideband (7 kHz) at G.711's bitrate — the easy "HD voice" upgrade on desk phones. Quirk: its RTP clock is stated as 8000 even though it samples at 16 kHz, a spec accident tools must special-case.
AMR / AMR-WB4.75–12.2 / 6.6–23.85 kbit/svariesThe mobile family; AMR-WB is what "HD Voice" on VoLTE means. Rate-adaptive under radio pressure, with a payload format (octet-aligned vs bandwidth-efficient) that causes real interop faults.
Opus6–510 kbit/svariesThe internet's codec (WebRTC default): fullband, loss-concealing, in-band FEC, rate-adaptive. Where both ends are software, the argument is usually over.
EVS5.9–128 kbit/svaries3GPP's successor to AMR-WB: super-wideband quality at AMR bitrates, with channel-aware modes. Spreading with newer IMS deployments.

*The wire column is the part people forget. At the standard 20 ms packet time a stream is 50 packets per second, and each packet carries 40 bytes of IP+UDP+RTP headers before any voice — 16 kbit/s of pure overhead (more on the LAN with Ethernet framing, more again inside any tunnel). Halving ptime doubles that overhead tax; doubling ptime halves it but adds packetisation delay and makes each lost packet twice as loud. That trade — overhead versus loss-resilience versus delay — is the whole ptime decision.

What transcoding really costs

The quiet victims: DTMF and fax

DTMF. Low-bitrate speech codecs are built to encode voices, and DTMF tones are not voices — G.729 mangles them badly enough that in-band digits become unreliable. The fix is RFC 4733 (née 2833): digits travel as named events on their own payload type, negotiated as telephone-event in SDP. The classic fault is a transcoding or interworking point that converts audio but forgets the event stream — or sends digits both in-band and as events, so the far IVR hears "5 5". When an IVR misbehaves, the first question is always: which of the three DTMF transports (in-band, RFC 4733, SIP INFO) did each leg think it agreed?

Fax. A fax machine's modem tones survive G.711 and nothing lossier. The choices are pass-through (force G.711, disable VAD, pray the clocks are clean) or T.38, which demodulates the fax and sends its data as its own protocol, renegotiated mid-call via re-INVITE when the tone is detected. That re-INVITE is fragile at borders — a peer that refuses it with 488 and no G.711 fallback is the anatomy of most "fax broke after the migration" tickets.

Reading codec trouble in a trace

  1. Read the offer/answer honestly: what was offered, what was answered, per leg. An SBC narrowing the codec list between legs is policy at work — see whether the surviving codec is one both ends genuinely do well.
  2. Confirm the RTP payload type actually matches the answered codec, both directions. Asymmetric codecs (G.711 one way, G.729 the other) are legal but a classic source of one-sided complaints.
  3. Check telephone-event made it into both legs' answers when DTMF matters, and watch the PT 101 packets to see what was really sent.
  4. ptime: offered vs answered vs the spacing the packets actually arrive at. Mismatched ptime forces repacketisation — cheap transcoding with the same failure modes.

hiccup diffs the SDP across legs, flags narrowed codec lists, DTMF payload-type mismatches and ptime disagreements, and reads the RTP to confirm what was actually sent. Self-hosted, free for individual users.

upload a trace