Asterisk – Understanding Codecs

What are Codecs? In lame man’s term, they are the different levels of compression for the audio between the phone and Asterisk box, and between the Asterisk box and your carrier. What’s the differences and which ones are best?

Basically the major differences is the amount of compression. What effect does the compression have on things? Generally speaking, the higher the compression, the less bandwidth used – but at the same time the lower the sound quality. You’ll also find that a higher compression codecs will require more CPU power to use.

Codec Data bitrate (Kbps) License Required
G.711 64 Kbps No
G.726 16, 24, 32, or 40 Kbps No
G.729A 8 Kbps Yes
GSM 13 Kbps No
iLBC 13.3 Kbps or 15.2 Kbps No
Speex Between 2.15 Kbps & 22.4 Kbps No

The most common codecs used are going to be: G.711 (ulaw or alaw as they are known), G.726, G.729A, and GSM. If you are bandwidth limited but can afford to lose some CPU power, GSM is good. Otherwise I would suggest G.711/ulaw as it’s basically uncompressed so there’s limited CPU usage incurred. – I personally like ulaw for quality sake – of course we’re not restricted by bandwidth here.

Compatibility – You will definitely want to check the compatibility of these codecs with your carrier and phones. Asterisk supports the major ones without much “tweaking” required. We’ll get more into using these codecs as we configure our Asterisk system in future articles.


Leave a Reply