Quantcast
Channel: Elastix Blogs » intraoffice
Viewing all articles
Browse latest Browse all 2

iLBC vs g729 — The quick guide to using compressed codecs in Elastix

$
0
0

We all know that g711 (alaw / ulaw) is meant to sound the best. It’s uncompressed and equivalent quality to ISDN, which most businesses are used to with their traditional PABX System.

However, it comes at a price, 64kbps + overheads means around 111kbps when you factor in everything else over an ADSL PPPoA / PPPoE connection.

Now that’s a LOT when you think about it, considering on a standard ADSL2+ line you’re going to max out at around 5-7 SIP lines, especially if it’s a shared connection. This is where a compressed codec such as (My personal favorite) iLBC, or g729, can be incredibly cost effective, as you can load up around 15-20 on the same sort of bandwidth. When you’re a small business, that means with the right kind of QoS, you can share your ADSL Broadband connection and still have 5-10 concurrent phone calls, all happily living together.

So do away with expensive BRI interfaces and monthly charges, and go SIP!

We’re going to look at a few things very briefly:

1) MOS – What is it and why do I care?

2) Which codec is right for me?

3) g729 – Installation

4) iLBC – Installation

5) Trunk and Extension setup

6) Testing the codecs

1) MOS – What is it and why do I care?

MOS stands for “Mean Opinion Score“, and in a nutshell it’s a way of determining out of 5 how good a particular codec (Read: Phone call) will sound. The Wikipedia article is a good overview of MOS, each codecs ratings, and some phrases you can use to test the compression yourself and see if words become difficult to understand.

Now, we all want a nice good MOS, because at the end of the day if you’re using a PBX system, there’s nothing worse than it sounding like a VoIPBuster call to some exotic island. Personally I aim for higher quality, this is why iLBC stands out well for me. That said, the choice is yours, try a few out and see what sound you personally (And quite possibly the person who writes your paycheck) are happy with.

2) Which codec is right for me?

Well that is a very good question, and that’s something that you’re going to have to answer for yourself. Lets look at some of the benefits of each:

iLBC Pros iLBC Cons g729 Pros g729 Cons
Free! Generally installed from Source code Most physical devices support it Costs $ per-channel
Better MOS than g729 “Interesting” license Requires less CPU than iLBC for encoding / decoding
(Good for low-powered or highly loaded PBXs)
Not many free Softphones support g729
Handles packet loss better than g729 & g711 Less physical devices support it than g729 More common than iLBC Easier to pick up the compression vs iLBC
Many open-source softphones support it Many different version

It’s not difficult to see there could be benefits for either. If you’re looking for low-cost deployment, or over a shaky ADSL connection you can’t seem to QoS well (Or perhaps Wireless?) then iLBC is probably the way to go. If you’re doing a larger installation, or an installation for a customer then it’s worth investigating g729, especially if you’re running underpowered hardware or have a large number of Exts or lots of expected concurrent calls.

Please keep in mind that you do not have to stick with just one codec, feel free to mix and match box on a per-customer level, or on a per-machine level also.

3) g729 – Installation

OK so I’m going to cheat here and direct you to Digium. Yes, there are “free” binaries out there, but at the price of $10 per-channel surely it’s not that expensive if you’re going to add it to your PBX’s you deploy.

Anyway if you’re downloading a “free” version, simply pop it in /usr/lib/asterisk/modules and chmod 755 the file. 64-bit versions go in /usr/lib64/asterisk/modules

Other than that, follow Digiums excellent instructions here, it should take you less than 5 minutes: http://kb.digium.com/entry/5/

4) iLBC – Installation

We’re going to be compiling this from source. Lucky for us Elastix makes this nice and easy! We won’t be installing a complete asterisk system, we don’t want to break the RPM’s because, let’s face it, it’s the easiest way to keep a system updated / secure.

First off, download Asterisk from here: http://www.asterisk.org/downloads

Get it to your elastix box any way you want (SCP / SSH / local terminal) and pop it in /usr/src

Now, run:

tar xvzf asterisk-1.4.*.tar.gz

change in to the newly created “asterisk” directory and run:

./contrib/scripts/get_ilbc_source.sh

Press “Enter” after it displays the warning presuming you’ve read the documentation (Which I’m also going to assume you’ve done) and shortly after you’ll get a lovely message telling you “The iLBC source code download is complete.”

Now, run:

./configure

That should run through without any issues, so now we’re going to tell Asterisk that we only want to build a very basic system (for the sake of time) and we want the iLBC codec. To enable the iLBC Codec you need to ensure in “4. Codec Translators” that “codec_ilbc” is checked.

Note: When you press “Esc” to quit “make menuconfig”, make sure you press S to save changes.

Now, just type “make” and watch the system build! As soon as you see codec_ilbc you can press Ctrl + C to stop it building. You’ll notice codec_ilbc being built just after all the app_ files, so it’s safest to stop the build process when you see the format_ files being built. Either that or let it run right the way through.

Almost done now, you just need to copy ./codecs/codec_ilbc.so to /usr/lib/asterisk/modules (or /usr/lib64/asterisk/modules on a 64-bit system) and chmod 755 /usr/lib/asterisk/modules/codec_ilbc.so

5) Trunk and Extension setup

Now depending on if you want your Ext or SIP Trunk to use the codec, it may be desirable to “force” the system to only use that codec.

To setup a Trunk: Open the SIP / IAX2 Trunk that you wish to limit in Elastix to the particular codec. In the PEER Details add an additional two lines:

disallow=all
allow=g729&ilbc

You may want to opt for something such as “allow=g729&g711″ or perhaps “allow=ilbc&alaw” for example. Review your needs and act appropriately. Save and submit the changes.

To setup an Ext: Open the Ext that you wish to limit the particular codec on. Scroll down to “disallow” and enter in “all”. Next in the “allow” field enter in something such as “g729″ or “ilbc”, or perhaps “ilbc&alaw” as above with the Trunk. Save and submit the changes when done.

Notes: Try and avoid transcoding where possible. It’s nice that asterisk does it so well, however it does add marginal delay to your calls, not to mention CPU overheads etc.

Also keep in mind that if you limit the codecs, say to just g729, and a particular device is unable to use g729, the call will simply fail.

6) Testing the codecs

The best part, testing! Hopefully everything has gone according to plan thus far. You’ve got one or two new codecs setup and you’re dying to test them out (In a development / testing environment naturally and not on your companies production PBX). Now you need to ssh in to your asterisk system and run:

asterisk -r

This brings up the asterisk console. Now, make a call on one of your new Ext’s that should be using iLBC / g729, or over the trunk that should be compressed.

While that call is active, rush back over to your ssh session and in the asterisk console type:

sip show channels

You should see something like this:

x.x.x.x   09xxxxxxx   2408517b625  00101/00102  0x400 (ilbc)     No       Rx: ACK

If you’re making a pure SIP call, you’ll see one line for the Ext -> Asterisk, and one line from Asterisk -> your SIP Provider.

Success!

Thanks for reading, and if you have any questions please feel free to leave comments or post in the Elastix forums.

Please also keep in mind that whilst g729 / iLBC are not the only codecs, almost every device that supports compression is likely to support one of them, or if not it will support GSM.

Hopefully as you’re reading this you’re happily making calls via iLBC or g729. Enjoy!

Share/Bookmark

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images