Installing Digium g.729 codec for Asterisk on an OpenVZ VPS

Installing Digium’s g.729 codec for Asterisk on an OpenVZ VPS requires an Asterisk friendly VPS provider. This is because the installation routine relies on there being an ‘eth0’ device on the server. This is not normally the case with OpenVZ where the network device is called venet0.

An ‘eth0’ device can be created on the VPS by running the following command (this is done on the OpenVZ server) –
(see here for more information – http://wiki.openvz.org/Asterisk_G729)

vzctl set $VEID --netif_add eth0 --save

replacing $VEID with the VPS ID. This doesn’t rename the venet0 device but creates a virtual eth0 device enabling the registration procedure to work

The following is all done on the VPS. The procedure and file names will vary depending on the architecture of the VPS server.

Download and run the Digium register tool –

cd /usr/src
wget http://downloads.digium.com/pub/register/linux/register
chmod 700 register

./register

Follow the menu options and select the G.729 codec entering all of your details.

Download the benchmarking tool. This will run tests on your system and recommend which binary you should download –

wget http://downloads.digium.com/pub/telephony/codec_g729/benchg729/x86-32/benchg729-1.0.7-x86_32
chmod 700 benchg729-1.0.7-x86_32
./benchg729-1.0.7-x86_32

These were my results –

Recommended flavor for this system is 'pentium3m' with an average of 396 milliseconds of CPU time.

Download the recommended binary and copy it to the correct location –

wget http://downloads.digium.com/pub/telephony/codec_g729/asterisk-1.4/x86-32/codec_g729a-1.4_3.1.2-pentium3m_32.tar.gz
tar xvfz codec_g729a-1.4_3.1.2-pentium3m_32.tar.gz
cp codec_g729a-1.4_3.1.2-pentium3m_32/codec_g729a.so /usr/lib/asterisk/modules/

Now restart Asterisk (obviously any calls in progress will be dropped!) –

asteirsk -rv
voip*CLI> restart now

Now connect to the Asterisk console again and you should be able to check that your license was successfully installed –

asterisk -rv

voip*CLI> g729 show licenses
0/0 encoders/decoders of 1 licensed channels are currently in use

Licenses Found:
File: G729-2C8XXXXX.lic -- Key: G729-2C8XXXXX -- Host-ID: 5a:1b:07:cf:xx:xx:xx:xx:xx:05:86:ad:74:9d:2e:c7:91:97:xx:xx -- Channels: 1 (Expires: 2029-07-02) (OK)

You can also check which codecs can be translated. Your system can translate between codecs that have a number where the rows/columns meet.

voip*CLI> show translation
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    -   2    2    2        2     2    1     3    8     -   10    2    -
gsm    6   -    2    2        2     2    1     3    8     -   10    2    -
ulaw    6   2    -    1        2     2    1     3    8     -   10    2    -
alaw    6   2    1    -        2     2    1     3    8     -   10    2    -
g726aal2    6   2    2    2        -     2    1     3    8     -   10    1    -
adpcm    6   2    2    2        2     -    1     3    8     -   10    2    -
slin    5   1    1    1        1     1    -     2    7     -    9    1    -
lpc10    6   2    2    2        2     2    1     -    8     -   10    2    -
g729    6   2    2    2        2     2    1     3    -     -   10    2    -
speex    -   -    -    -        -     -    -     -    -     -    -    -    -
ilbc    6   2    2    2        2     2    1     3    8     -    -    2    -
g726    6   2    2    2        1     2    1     3    8     -   10    -    -
g722    -   -    -    -        -     -    -     -    -     -    -    -    -

5 thoughts on “Installing Digium g.729 codec for Asterisk on an OpenVZ VPS

  1. Peter Briffett

    If you’re looking for G.729 codecs that work with Asterisk have you tried the new G.729 Howlet from Howler technologies?
    Prices start at £3.99 per channel and you can get 500 transcoded calls on a quad core – takes some beating that….

  2. martin

    hi Matt, is this installation different on xen vps?
    i followed exact instructions from digium install g729 codec on two different elastix 2 servers running on xez vps but ended up problems and now I looking for way to undo the installation.
    voice calls are faint and choppy at the called partys side. sometimes they can hear my voice but I hear nothing.
    is there a way to undo these installations?
    thank you

  3. matt Post author

    The installation should be basically the same but you should make sure you are getting the g729 versions that match your Asterisk version plus checking with the bench utility that you get the correct CPU version.

    To undo just delete the files that you copied in to the modules folder (/usr/lib/asterisk/modules/codec_g729a.so ?) and restart Asterisk.

  4. Johan

    How I can use G.729 codec in pass-thru mode as open source. If I have billing server with asterisk and using only calling card service with softphone dialer and outbound provider using g729a, how I can connect my asterisk to him without channels licence cost?Thanks

  5. matt Post author

    Unfortunately the only way to use pass-thru is if your system doesn’t answer the call (say in a SIP to SIP call). If you’re doing calling cards then you have to answer the call so won’t be able to use pass-thru.

Comments are closed.