Understanding VoIP Codecs and Bandwidth Requirements

Codecs determine how voice audio is compressed for transmission — directly affecting both call quality and bandwidth consumption. This guide explains the common options and how to choose correctly.

What a Codec Does

A codec compresses audio for efficient network transmission, then decompresses it on the receiving end — different codecs trade off audio quality, bandwidth usage, and CPU processing load differently.

Common VoIP Codecs Compared

CodecBandwidth per CallQualityNotes
G.711 (ulaw/alaw)~64-87 kbpsExcellent (uncompressed)Widely compatible, higher bandwidth usage
G.729~8-31 kbpsGoodMuch lower bandwidth, may require licensing depending on implementation
OpusVariable, ~6-510 kbpsExcellent, adaptiveModern, flexible, increasingly common default
GSM~13 kbpsFairOlder, lower quality, rarely the best choice today

Choosing a Codec: The Trade-Off

G.711 offers the best raw quality but uses the most bandwidth; G.729 and similar compressed codecs reduce bandwidth significantly at some quality cost — Opus offers a strong modern middle ground with adaptive quality based on available bandwidth.

Calculating Bandwidth for Multiple Concurrent Calls

Total bandwidth = (bandwidth per call) × (number of concurrent calls)

Example: 10 concurrent G.711 calls at ~87 kbps each ≈ 870 kbps total, plus overhead — verify your VPS's actual available bandwidth comfortably exceeds your expected peak concurrent call volume.

Configuring Codec Preference in Asterisk

[1001]
type=endpoint
disallow=all
allow=opus
allow=ulaw
allow=g729

Lists codecs in priority order — Asterisk negotiates the best mutually-supported codec between the two endpoints of a call.

Why Codec Mismatch Causes Problems

If two endpoints (or a trunk and your PBX) don't share a common codec, calls may fail to connect entirely, or Asterisk must transcode between codecs — adding CPU overhead and potential quality degradation compared to a native codec match.

Transcoding Overhead

Converting between codecs in real time is CPU-intensive — minimizing the need for transcoding (by ensuring compatible codec support across your trunk, PBX, and endpoints) improves both call quality and server capacity for concurrent calls.

Bandwidth Overhead Beyond Raw Codec Rate

Actual network bandwidth per call is somewhat higher than the raw codec bitrate due to RTP/UDP/IP packet overhead — budget roughly 10-20% additional headroom beyond the codec's nominal rate for realistic planning.

Choosing Based on Your Actual Constraints

  • Limited bandwidth, many concurrent calls — favor compressed codecs (G.729, or Opus at a lower bitrate setting)
  • Ample bandwidth, quality is the priority — G.711 or high-bitrate Opus
  • Uncertain/variable network conditions — Opus's adaptive bitrate handles this gracefully

Common Errors

Calls connect but with poor audio quality — check for codec mismatch causing transcoding, or genuinely insufficient bandwidth for the negotiated codec under current network conditions.

Continue Reading

Browse more articles in VoIP & Communication Servers.

  • voip codecs, voip bandwidth, opus codec, g711 g729
  • 0 Els usuaris han Trobat Això Útil
Ha estat útil la resposta?

Articles Relacionats

How to Install Asterisk PBX on a VPS

Asterisk is the foundational open-source telephony engine powering most self-hosted PBX systems...

How to Install FreePBX on a VPS

FreePBX is a widely-used, open-source web interface built on top of Asterisk — making PBX...

How to Set Up SIP Trunking for Your PBX

A SIP trunk connects your self-hosted PBX to the public telephone network, letting you make and...

How to Configure Extensions and Voicemail in Asterisk

Extensions are the individual phone lines within your PBX system, and voicemail lets callers...

How to Secure a VoIP Server Against Toll Fraud

An unsecured VoIP server is a common target for toll fraud — attackers who compromise weak...