Technical

SIP Audio Codecs Explained

Understand the audio codecs used in VoIP, how they affect call quality and bandwidth, and how to configure them in SipLine for the best results.

10 min read
1

What Is a Codec?

A codec (coder-decoder) compresses and decompresses audio for transmission over a network. In VoIP, the codec determines the trade-off between audio quality, bandwidth usage, and processing power. When you make a SIP call, both sides negotiate which codec to use through a process defined in the SDP (Session Description Protocol) portion of the SIP signaling.
The word "codec" comes from coder/decoder. Each codec uses a different algorithm to digitize and compress your voice.
2

G.711 — The Universal Standard

G.711 is the most widely supported codec in telephony. It comes in two variants: PCMA (G.711a, A-law) used primarily in Europe, and PCMU (G.711u, mu-law) used in North America and Japan. G.711 uses 64 kbps per direction and delivers toll-quality audio (8 kHz sample rate, narrowband). With IP overhead, a G.711 call consumes approximately 87 kbps per direction.
When in doubt, use G.711a (PCMA). It is supported by virtually every VoIP provider and SIP device in the world. It is the safest choice for interoperability.
3

Opus — The Modern Choice

Opus is a modern, open-source codec designed for internet audio. It is adaptive, meaning it dynamically adjusts its bitrate based on network conditions — from as low as 6 kbps up to 510 kbps. Opus supports wideband and super-wideband audio (up to 48 kHz), delivering significantly richer sound than G.711. It handles packet loss gracefully with built-in forward error correction.
Opus is ideal for calls between two SipLine users or with providers that support it. It delivers near-HD voice quality at a fraction of G.711's bandwidth.
4

Choosing the Right Codec

Your choice depends on your use case. For maximum compatibility with any provider, use G.711a. For best audio quality on good connections, use Opus. For low-bandwidth scenarios like mobile hotspots, Opus at a lower bitrate is the best option. You can enable multiple codecs in SipLine and let the SDP negotiation select the best one automatically.
In SipLine, drag codecs to reorder them by priority. The first codec in the list is offered first during negotiation. Place your preferred codec at the top.
5

Codec Negotiation in SIP (SDP)

When a SIP call is initiated, the caller sends an INVITE message containing an SDP body that lists supported codecs (identified by payload type numbers). The callee responds with its own SDP, selecting one or more matching codecs. If no common codec is found, the call fails with a 488 Not Acceptable Here error. This negotiation happens automatically — you just need to ensure compatible codecs are enabled.
If calls fail immediately with no audio, check that at least one codec is enabled in SipLine that your provider also supports. A codec mismatch is a common cause of failed calls.
6

Configuring Codecs in SipLine

Go to Settings > SIP Accounts > [Your Account] > Codecs. You will see a list of available codecs with checkboxes to enable or disable them. Drag codecs to set their priority order. For most users, the recommended configuration is: G.711a (PCMA) first, G.711u (PCMU) second, and Opus third. This ensures maximum compatibility while taking advantage of Opus when available.
Disable codecs you will never use. Fewer codecs in the SDP offer means faster call setup and less room for negotiation issues.

Frequently Asked Questions

G.711 vs Opus — which should I use?

G.711 is the safe choice: universally supported, predictable quality, no licensing issues. Opus is superior in audio quality and bandwidth efficiency, but not all providers support it yet. For calls to traditional phone lines (PSTN), G.711 is almost always used. For calls between softphones or modern VoIP platforms, Opus provides noticeably better quality.

How much bandwidth does each codec use?

Including IP/UDP/RTP overhead: G.711 uses approximately 87 kbps per direction. Opus at its default VoIP setting uses approximately 30–40 kbps per direction, though it can go as low as 10 kbps or as high as 128 kbps depending on configuration. The Opus codec is especially efficient because it adapts in real time to available bandwidth.

Can I use multiple codecs at the same time?

You can enable multiple codecs, but only one is used per call. During SDP negotiation, both sides agree on a single codec. Having multiple codecs enabled increases the chance of finding a match with the other party. SipLine will try codecs in the priority order you set.

What about G.729?

G.729 is a low-bandwidth codec (8 kbps) historically popular for saving bandwidth. However, it was patented (patents expired in 2017) and many modern systems have moved to Opus, which offers better quality at similar or lower bitrates. SipLine supports G.729 for backward compatibility, but Opus is recommended for new deployments that need low bandwidth.

Why do my calls fail with a 488 error?

A 488 Not Acceptable Here response means the remote party could not find a common codec with your SipLine configuration. Enable G.711a (PCMA) — it is the most universally supported codec. If you only had Opus enabled and the provider does not support it, calls will fail with this error.

Does the codec affect latency?

Yes, slightly. G.711 has very low processing delay since it performs minimal compression. Opus introduces a small encoding delay (typically 20–40 ms) but compensates with better packet loss resilience. In practice, the codec's contribution to overall latency is small compared to network latency. Both G.711 and Opus are well within acceptable limits for real-time conversation.

Related Guides

Ready to Get Started?

Download SipLine for free and follow along with this guide.