Thursday, October 1, 2009

Installing (Free) G729 Codec on Trixbox CE

The G.729 codec is a low-bandwidth codec, excellent for use in VoIP.

In this case, a client which my company manages wanted to minimize bandwidth usage from VoIP phones traveling through a VPN. Both the G729 & G723 codec are freely available from here, though you can alawys purchase a copy from Digium.

First download the G729 codec appropriate for your processor & system type. A great way to find this information is to run a cat /proc/cpuinfo and a uname -m command. Search down through the list (ensure you download G729, not G723!) for your appropriate binary. In my case, we were running on a P4 with no ss3, so I stuck with the standard codec_g729ast14-gcc4-glibc-pentium4.so binary.

Now, I'm not sure if this is necessary, but I moved the /usr/lib/asterisk/modules/format_g729.so file out of the /usr/lib/asterisk/modules folder, over to /home/root. I did this to ensure we were starting fresh.

Next, copy the downloaded codec over to that same /usr/asterisk/modules folder. Connect into asterisk console with the command asterisk -r, and load the new codec with module load codec_g729-ast14-gcc4-glibc-pentium4.so, or whatever your codec was.

You would think the phone system would be ready for G729 use, but in my case, I needed to restart asterisk with the command restart gracefully. Ensure everyone is out of the office, as this will drop all live calls!

When asterisk comes back up, log back into asterisk and run the command show translation which should give you some output such as the following:





As long as there’s a # (in this case, 6’s) and not a – under the g729 codec, we know it’s working properly.

The next step would be to head into the web interface, under PBX->PBX Settings->Extensions, choose the extension you wish to enable the codec for, ensure disallow is set to “all” and allow is set to “g729”.













Once the extension is set up to allow g729, you can test whether it’s working properly by having a test call connected and running the command sip show channels:

trixbox1*CLI> sip show channels

Peer User/ANR Call ID Seq (Tx/Rx) Format Hold Last Message

10.100.253.91 4004 2e1225e1-27 00101/00002 0x100 (g729) No Rx: ACK


:).

14 comments:

  1. Thanks for the quick guide. The 'module load codec_g729...' command worked for me on asterisk 1.6.0 without requiring a reload or knocking any current calls offline.

    ReplyDelete
  2. command "show translation" -> command "core show translation"

    ReplyDelete
  3. Thanks for the correction Isanderthul, I may have written this guide for an older version.

    ReplyDelete
  4. Awesome! Just what I needed. Thanks dude!

    ReplyDelete
  5. Hi I Loaded the codec in the modules directory , now asterisk is going crazy , restarting the whole time . Can't find the module directory to remove the codec again . NEED HELP PLEASE

    ReplyDelete
  6. Why don't you run a "updatedb" & "slocate" the file? Also please take note of the disclaimer on the site.

    ReplyDelete
  7. Thanks a million.
    This helped me to resolve an incoming call issue for a sip trunk.

    ReplyDelete
  8. Brilliant work dude! I have a Quad core Intel and used the core2, works up a storm!

    Thanks man
    Shaun (South Africa)

    ReplyDelete
  9. AndrĂ© (South Africa)February 23, 2012 at 2:00 AM

    I get an error: "unable to load module..."

    Am I doing something wrong?

    ReplyDelete
    Replies
    1. André this guide is rather old, it's possible you are running a newer version of asterisk (maybe 1.6)? I haven't tested the module on that version so I can't say if it works for sure. You may want to try compiling the source yourself, instead.

      Delete
  10. The Codec is ok i have tasted on VPN lines using softphones!!

    ReplyDelete
  11. Great thanks for sharing this.. this is very helpful for all trixbox users ,,,thanks once again
    trixbox resellers in UK

    ReplyDelete
  12. Thanks for telling in detail and with screen shots..very helpful guidance..trixbox resellers in UK

    ReplyDelete