≡ Menu

IP Telephony Codecs

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[23334] channel.c: Unable to find a codec translation path from 0x400 (ilbc) to 0x4 (ulaw)
[Jan 14 01:40:21] WARNING[23334] 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.

{ 4 comments… add one }
  • Charles R. Whealton January 18, 2009, 10:39 am

    So, could you elaborate a bit more on WHY you’re setting up a PBX? I’m assuming this is a home project and no question, it sounds fun (or not!).

    Why haven’t I heard about this neat sounding project earlier!?!?

    Charles Whealton

  • weave January 18, 2009, 11:19 am

    Well, mostly cause it’s fun and a learning experience. But there are other reasons too. I can eliminate my local phone service, or drop it down to the basic per-minute plan for about $10/month for some extra security (cause if the internet and cell service goes down, no way to make calls).

    Another reason is for the features. This PBX is more featured than many company PBX systems. Call transfer, parking, conference calling, separate extensions in the house, web-based voicemail, even can get voicemail integrated into your email account.

  • Charles R. Whealton January 18, 2009, 1:23 pm

    Sounds pretty neat! I’ll need to read up on it some more.

  • Dave Smith February 25, 2009, 9:18 am

    Weave, your blog about iLBC helped me out just as you hoped, I had no end of trouble getting an inbound call bridged, and eventually found your post. It all came down to the iLBC codec not being included in Asterisk 1.6

    Thanks for your help.

Leave a Comment