SIP Codecs Explained: G.711, Opus and Other Common Options
A codec turns voice into data and back. Learn how G.711, Opus, G.722, G.729 and GSM compare in bandwidth, quality and licensing, how codecs are negotiated in SDP, and how to choose one for your PBX.
Published 8 November 2026 · Updated 9 November 2026 · 6 min read · By SpaGreen Creative
Short answer
A codec encodes microphone audio for RTP and decodes it at the far end. G.711 is the most widely supported baseline: 64 kbit/s and telephone quality, on almost every SIP device and server. Opus is the modern choice: wideband, loss tolerant, royalty free, typically 16 to 40 kbit/s for voice. G.722 adds wideband at 64 kbit/s; G.729 compresses to 8 kbit/s. Both sides must share a codec.
A codec is the algorithm that converts your voice into a compact stream of bytes for transmission and converts the received bytes back into sound. In a SIP call, each side lists the codecs it supports in the SDP of the INVITE and its answer, and the answer settles which codec the RTP audio stream uses. G.711 is the baseline that almost every SIP device supports. Opus is the modern option with better quality and lower bandwidth. G.722, G.729 and GSM appear on older or specialised systems. Choosing a codec is a trade-off between bandwidth, audio quality, robustness to packet loss and compatibility.
How is a codec chosen for a call?
The choice happens in the offer/answer exchange described in RFC 3264, using the SDP format defined in RFC 8866. The caller's INVITE includes a media line listing payload types in order of preference, with a=rtpmap lines naming each one.
m=audio 10000 RTP/AVP 111 0 8 101
a=rtpmap:111 opus/48000/2
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
This offer says: I prefer Opus, then G.711 ulaw, then G.711 alaw, and I support DTMF events. The callee replies with the subset it accepts, normally one audio codec plus telephone-event. Endpoints normally send with the first codec listed in the answer. If the two lists share nothing, the callee usually rejects the call with 488 Not Acceptable Here, a code you can look up in the SIP error code lookup. Payload types 0 and 8 are static assignments from RFC 3551. Opus has no static number, so each side assigns a dynamic type between 96 and 127 and declares it in the rtpmap line.
A PBX in the media path can also transcode. If the phone offers only Opus and the trunk supports only G.711, Asterisk decodes one and re-encodes the other. This costs server CPU and adds a little delay and distortion, so matching codecs end to end is preferable when possible.
What is G.711?
ITU-T G.711 is the codec of the traditional telephone network, standardised in 1972. It samples audio 8000 times per second and stores each sample in 8 bits using a logarithmic companding curve. The result is 64 kbit/s of audio with a frequency range of about 300 to 3400 Hz, which is ordinary telephone quality.
There are two variants. Ulaw, payload type 0 and named PCMU in SDP, is used in North America and Japan. Alaw, payload type 8 and named PCMA, is used in Europe and most of the rest of the world. They differ only in the companding formula and are equivalent in quality.
G.711 strengths:
- Supported by almost every SIP device, PBX and provider. Whether a given call uses it still depends on the codecs the server or trunk allows.
- Simple companding rather than heavy compression, so very low processing delay and no licensing cost.
- Carries fax and modem tones far better than compressed codecs, which distort them.
G.711 weaknesses:
- The highest bandwidth of the common voice codecs. With RTP, UDP and IP headers at 20 millisecond packets it uses about 80 to 90 kbit/s per direction.
- Narrowband only. Voices sound like a landline, not a face-to-face conversation.
- Poor handling of packet loss. A lost packet is a 20 millisecond gap, and basic decoders have limited concealment.
What is Opus?
Opus is an open, royalty-free codec standardised by the IETF in 2012. It combines a speech-oriented coder from Skype's SILK with a low-latency music coder from Xiph's CELT, and switches between them as needed. Its RTP payload format is defined in RFC 7587, and it is declared in SDP as opus/48000/2.
Opus strengths:
- Bitrate from about 6 kbit/s to 510 kbit/s, adjusted on the fly. Voice calls typically use 16 to 40 kbit/s.
- Wideband and fullband audio, up to 20 kHz. A voice over Opus sounds noticeably clearer than over G.711.
- Built-in packet loss concealment and optional forward error correction, so calls survive poor Wi-Fi and mobile networks better.
- Low algorithmic delay, down to 5 milliseconds.
- Mandatory in WebRTC, so browser-based systems support it.
Opus weaknesses:
- Not supported by older desk phones, some trunks and some providers. A PBX usually has to transcode to G.711 for the public telephone network.
- More CPU than G.711, which matters on very constrained embedded devices but not on modern computers or phones.
What about G.722, G.729 and GSM?
G.722 is an ITU wideband codec at 64 kbit/s, offering 50 to 7000 Hz audio at the same bandwidth as G.711. It is widely supported on business desk phones and is often marketed as "HD voice". It is royalty free. Opus covers the same use case with less bandwidth, which is why some newer software clients implement Opus instead.
G.729 compresses speech to 8 kbit/s with acceptable quality. It was popular when bandwidth was scarce and on links with many concurrent calls. It was patent-encumbered until 2017, so many software clients never shipped it, and some still do not. It handles music and tones poorly and adds about 15 milliseconds of algorithmic delay.
GSM (GSM 06.10 full rate) is the original mobile phone codec at 13 kbit/s. It is free and simple but low quality by today's standards. It survives mainly as a legacy option in some PBX codec lists.
iLBC and Speex are older open codecs from the pre-Opus era. Opus has largely replaced both in new deployments.
How do codecs compare?
| Codec | Audio bitrate | Bandwidth | Quality | Loss tolerance | Licence |
|---|---|---|---|---|---|
| G.711 ulaw / alaw | 64 kbit/s | 300 to 3400 Hz | Telephone | Low | Free |
| Opus | 6 to 510 kbit/s, typically 16 to 40 | Up to 20 kHz | Wideband to fullband | High | Free |
| G.722 | 64 kbit/s | 50 to 7000 Hz | Wideband | Low | Free |
| G.729 | 8 kbit/s | 300 to 3400 Hz | Telephone, slightly reduced | Low | Patents expired 2017 |
| GSM | 13 kbit/s | 300 to 3400 Hz | Below telephone | Low | Free |
Bandwidth figures exclude IP, UDP and RTP headers, which add roughly 16 to 24 kbit/s at 20 millisecond packets regardless of codec. The VoIP bandwidth calculator includes them.
How do codec choices look in practice?
Softphones differ in what they ship. Some include every codec above. Others keep the list short. SIPdia, for example, supports Opus and G.711 ulaw and alaw only, and does not include G.722 or G.729. With an Asterisk, FreePBX or Issabel PBX this usually works. Those systems handle G.711 natively and support Opus when its codec module is installed. They can transcode to the codec a trunk requires when a module for that codec is installed.
On the PBX side, make sure the extension allows the codecs the phone offers. In Issabel and FreePBX this is the allowed codecs setting on the extension. A mismatch produces a 488 response or a call that connects through transcoding with higher server load.
How do you choose?
- Over the internet or Wi-Fi: prefer Opus. Its loss concealment and lower bitrate make a clear difference.
- To the public telephone network: the call is usually carried as narrowband G.711 at the network boundary, so there is little quality gain from anything wider. Let the PBX transcode or use G.711 directly.
- Constrained links with many simultaneous calls: G.729 was the historical answer; Opus at a low bitrate now does the same job with better quality.
- Fax or modem traffic: G.711 only, or better, T.38 fax relay.
- Compatibility first: include G.711 somewhere in the list. It is the codec the far end is most likely to share, which makes a failure for lack of a common codec much less likely.
Next steps
Estimate your bandwidth needs with the VoIP bandwidth calculator and see which codecs a modern softphone offers on the SIPdia features page. To understand how the encoded audio travels, read Understanding RTP and audio streams.
Frequently asked questions
Which codec should I choose for my SIP phone?
Offer Opus first and G.711 as a fallback. Opus gives better quality and handles poor networks. G.711 is supported by almost every PBX and provider, but a call can only use it if the server or trunk allows it, so check the allowed codecs on your extension. Only add others if your server or provider specifically requires them.
What is the difference between G.711 ulaw and alaw?
They are two companding variants of the same 64 kbit/s codec. Ulaw (PCMU) is used in North America and Japan, alaw (PCMA) in Europe and most of the rest of the world. Quality is equivalent. Most devices support both, and the PBX converts between them if needed.
Why does my PBX offer G.729 but my softphone does not support it?
G.729 was covered by patents and many software clients never licensed it. The patents have expired, but implementations remain less common than G.711 and Opus. If the far end needs G.729, the PBX can transcode from a codec your client supports, provided it has a G.729 codec module installed.
Does the codec affect call setup or just audio?
Just the audio. The codec list travels in the SDP during the INVITE, but SIP signalling itself is unaffected. If no common codec exists, the call usually fails with 488 Not Acceptable Here.
What is transcoding?
Converting audio from one codec to another in the middle of the call, usually on the PBX. It allows two endpoints with no common codec to talk, at the cost of CPU on the server and a small loss in quality.
Sources and further reading
- ITU-T Recommendation G.711: Pulse Code Modulation (PCM) of Voice Frequencieswww.itu.int
- RFC 6716: Definition of the Opus Audio Codecwww.rfc-editor.org
- RFC 7587: RTP Payload Format for the Opus Speech and Audio Codecwww.rfc-editor.org
- RFC 3551: RTP Profile for Audio and Video Conferences with Minimal Controlwww.rfc-editor.org
- RFC 8866: SDP: Session Description Protocolwww.rfc-editor.org
- RFC 3264: An Offer/Answer Model with SDPwww.rfc-editor.org
- RFC 7874: WebRTC Audio Codec and Processing Requirementswww.rfc-editor.org
- Asterisk documentation: Codec Opusdocs.asterisk.org
This article is published by SpaGreen Creative, the maker of SIPdia. Product names mentioned belong to their owners. Where it describes other software, treat the steps as general guidance and check the official documentation linked above.
