My first stumbling block when installing and trying to get Asterisk PBX working were the codecs and mismatching. If both ends of a connection can’t negotiate the same codec, the call won’t complete.
I grabbed the recommended asterisk config for gizmo5 and when attempting to place a call to my gizmo call-in number which should have landed it into my PBX I got the following errors and it disconnected:
[Jan 14 01:40:20] WARNING channel.c: Unable to find a codec translation path from 0x400 (ilbc) to 0x4 (ulaw) [Jan 14 01:40:21] WARNING channel.c: Unable to find a codec translation path from 0x400 (ilbc) to 0x2 (gsm)
When trying to determine what went wrong, I found that ilbc is no longer part of Asterisk config, and ulaw is actually G.711 using the µ-law algorithm. I also found that one can add iLBC codec to Asterisk by agreeing to a license agreement and running a script.
So hence this blog post, so I can document what I’ve learned and hopefully prevent someone else from having same frustrations.
First, iLBC is not checked by default when you run “make menuconfig” when configuring the makefile for asterisk compiling. iLBC can be added easily to Asterisk by running “./contrib/scripts/get_ilbc_source.sh” from the main asterisk install directory. Then rerun make menuconfig to enable it. iLBC is preferred codec by Gizmo5.
There are two flavors of g.711, and they are referenced by asterisk as ulaw (used in North America and Japan) and alaw (used mostly in Europe and rest of the word). g.711 is considered the lowest common denominator on voip codecs. Everyone supports it, but it’s not the best quality codec out there.
GSM is also a popular codec. Yes, GSM is the mobile network standard used by most of the world, but also refers to the codec it uses.
Many people say G.729 is the best codec all around, but not a lot of devices and services support it. It can be added to Asterisk but the license agreement is limited to developmental, personal, non-profit use only.
Asterisk can specify per channel or connection what codecs should be negotiated. For example, I initially fixed my initial gizmo problem by forcing gsm to be used. My initial config in sip.conf included for gizmo.
disallow=all allow=ulaw allow=alaw allow=ilbc
Because of that, Gizmo tried ilbc which my Asterisk install didn’t support at the time, so I changed it to just allow=gsm and that worked. Now that I have iLBC installed, I can go back to the recommended config of codecs and have it work!
Finally, vop-info.org site has a good page on the various codecs Asterisk supports.