Howto: Asterisk and Opensource implementation of G.729 codec

DISCLAIMER:
You might still have to pay royalty fees to the G.729 patent holders for using their algorithm

With Asterisk when you place a call or receive a call you’ll get a warning about translation from ulaw to g729.
For example:

[Dec 16 09:48:56] WARNING[1143]: channel.c:2811 set_format: Unable to find a codec translation path from ulaw to g729

With little googling I found out this is rather easy problem to fix.


You can download the source or binary G.723 or G.729 codecs from here.

This what I did to implement the G.729 codec.

Download:
First off I downloaded the binary codec for the version of Asterisk and processor type needed and the MD5SUM file on the machine I running Asterisk on.

$ wget http://asterisk.hosting.lv/bin/codec_g729-ast14-gcc4-glibc-pentium.so ; wget http://asterisk.hosting.lv/bin/MD5SUM

Checked the MD5SUM to make sure the downloaded binary is ok

$ md5sum -c MD5SUM

Installation:
Now to copy or move the binary into Asterisk modules directory as root (login if needed)

# cp codec_g729-ast14-gcc4-glibc-pentium /usr/lib/asterisk/modules/

All that is left to do is load the module into Asterisk as root

First log into Asterisk’s CLI

# asterisk -r

Now to load the module

localhost*CLI> module load codec_g729-ast14-gcc4-glibc-pentium.so

All that is left to do is to check the module has loaded correctly and that is done by typing

localhost*CLI> core show translation recalc 10

Above command will take little bit to calculate and show and ouput
Example output

localhost*CLI> core show translation recalc 10
         Recalculating Codec Translation (number of sample seconds: 10)

         Translation times between formats (in milliseconds) for one second of data
          Source Format (Rows) Destination Format (Columns)

          g723 gsm ulaw alaw g726aal2 adpcm slin lpc10 g729 speex ilbc g726 g722
     g723    -  58   13   13       32    14   12    43  117   210    -   32    -
      gsm  350   -   21   21       40    22   20    51  125   218    -   40    -
     ulaw  331  47    -    1       21     3    1    32  106   199    -   21    -
     alaw  331  47    1    -       21     3    1    32  106   199    -   21    -
 g726aal2  349  65   20   20        -    21   19    50  124   217    -    1    -
    adpcm  331  47    2    2       21     -    1    32  106   199    -   21    -
     slin  330  46    1    1       20     2    -    31  105   198    -   20    -
    lpc10  354  70   25   25       44    26   24     -  129   222    -   44    -
     g729  358  74   29   29       48    30   28    59    -   226    -   48    -
    speex  370  86   41   41       60    42   40    71  145     -    -   60    -
     ilbc    -   -    -    -        -     -    -     -    -     -    -    -    -
     g726  348  64   19   19        1    20   18    49  123   216    -    -    -
     g722    -   -    -    -        -     -    -     -    -     -    -    -    -

As you can see our newly installed codec is working :-)

References:
Asterisk G.729 Licensing
G.729 and G.723.1 codecs x86 (and x86_64) Linux and FreeBSD binaries for Asterisk open source PBX

Leave a Reply