Introduction
G.729 is a toll-quality, low-bandwidth audio codec supported by many VoIP providers. The voice quality of a G.729-encoded call is about the same as that of G.711, the codec used for standard PSTN calls. However, the amount of bandwidth needed to carry a G.729 call is much lower than that for a G.711 call. Enterprises using G.729 will make more efficient use of available network bandwidth. G.729 uses roughly 1/8th of the bandwidth of a G.711 (8 kbit/s vs 64 kbit/s).
G.729 is available in two ways:
Passthrough Transcoding
The passthrough method does not require licensing, however it has some limitations. For transcoding method G.729 license is necessary. Freeswitch offers a module and G729 license for transcoding G.729. Freeswitch's G.729 module supports Annex A and Annex B.
Obtaining License
Licences can be purchased from the FreeSWITCH website - see the G.729 tab at the top of the page.
Pricing is $10 per channel.
A single licence provides you with one encoder and one decoder, which is enough for bridging one call.
Licences are only required for channels performing transcoding (for bridging calls a leg uses G.729 and a different leg uses a different codec, and for applications which need to process media). Bridged channels where G.729 is on all legs still use pass-through mode, so that they do not consume a licence.
G.729 Module Installation
Download the fsg729-xxx-installer file from http://files.freeswitch.org/g729
cd /usr/tmp wget http://files.freeswitch.org/g729/fsg729-167-installer sh ./fsg729-167-installer
Note: fsg729-139-installer did not work with FreeSWITCH Version 1.0.head (1), try 136, the previous one if it gave error such as (var/log/sipxpbx/freeswitch.log):
[xecsuser:CRIT] switch_loadable_module.c:882 Error Loading module /usr/local/freeswitch/mod/mod_com_g729.so */usr/local/freeswitch/mod/mod_com_g729.so: undefined symbol: g729_decode_free* -ERR [xecsuser:module load file routine returned an error]
G.729 License Activitation
Run the license validator:
cd /usr/local/freeswitch/bin/ ./validator
Enter the sales code you received from Freeswitch, licenses.zip file will be generated in the current directory. Unzip this file into /etc/freeswitch/
After unzip there will be xxxxxxxxxxxxxxxx.conf in the /etc/freeswitch
Freeswitch Configuration
Sipxconfig should detect this module and add G.729 codec as default to the following:
System/Servers/Server nnn/Media Services/Codec
System/Servers/Server nnn/SIP trunking/SIP/Permitted Codecs (TBD: I don't think this applies – douglas)
Click "Apply" button on each page even though you haven't changed anything to trigger config change and prompt to restart Media Services. Go ahead and restart "Media Services"
freeswitch_licence_server is automatically started by mod_com_g729 if freeswitch is started by root, but in sipXecs freeswitch is not started by root. So you have to start freeswitch_license_server manually: /usr/sbin/freeswitch_license_server
cd /usr/sbin ./freeswitch_licence_server
Putting this in init.d worked for me to make it start with the server:
Create an entry in /etc/rc.d/init.d (ex: G729app) and paste this in:
#!/bin/sh # description: FS_LIC_SVR # chkconfig: 2345 99 00 case "$1" in 'start') /usr/sbin/freeswitch_licence_server touch /var/lock/subsys/G729app ;; 'stop') rm -f /var/lock/subsys/G729app ;; *) echo "Usage: $0 { start | stop }" ;; esac exit 0
if the license server is not working or the license is invalid, freeswitch will complain (var/log/sipxpbx/freeswitch.log):
[ERR] mod_com_g729.c:113 ENCODER CREATE FAILED- 0x9c213b0 (nil) [ERR] switch_core_io.c:882 Codec G.729 encoder error!
Monitoring License
Run the freeswitch console:
cd /usr/local/freeswitch/bin ./fs_cli (First, unload the passthru mod, and licensed one, and reload the licensed one) freeswitch@internal>unload mod_g729 freeswitch@internal>unload mod_com_g729 freeswitch@internal>load mod_com_g729 Here are the g729 commands to run from the fs_cli. These are not available until you load the mod_com_g729 module. I think the FS docs allude to a g729_status, which probably worked on the older binaries, but has since been replaced with these. I think the docs on their site probably need to be changed. Once the mod_com_g729 has successfully loaded, you will see the following option from the "help" command of the fs_cli: g729_available,,return true or false if g729 is available,mod_com_g729 g729_count,,return permitted license count,mod_com_g729 g729_info,,return current g729 usage details,mod_com_g729 g729_used,,return in use encoder and decoders,mod_com_g729 freeswitch@internal>g729_available true freeswitch@internal>g729_count 2 freeswitch@internal>g729_info Permitted G729 channels: 2 Encoders in use: 0 Decoders in use: 0 freeswitch@internal>g729_used 0:0
OK, but WAIT, we are not done! Now we have to activate the licenses in sipx media server and restart media server. We also need to look in /etc/sipxpbx/freeswitch/modules.conf.xml.vm and edit the section "Cedec Interfaces" to say:
\#if(${codecG729}) <load module="mod_com_g729"/> \#else <\!--< load module="mod_g729"/> \--> \#end \#if(${codecG729}) <load module="mod_com_g729"/> \#else <\!--< load module="mod_g729"/> \--> \#end