G.729 is a VoIP codec for low bandwidth situations, it’s also patent encumbered as is usual for these sorts of things. The fine folks at FreeSwitch support G.729 as passthru by default, but if you need to transcode or deal with it directly you would (ideally) purchase the G.729 module.

Unfortunately for yours truly, it comes with this disclaimer

Currently supports Linux i386 and x86_64, will not currently work under OpenVZ

So we’re out of luck on FreeBSD. I’ve found a delightful project by xadhoom called mod_bcg729 that creates a FreeSwitch G.729 module using the Bcg729 code created by belledonne communications for use in the linphone project.

We’re going to build a copy of mod_bcg729 on FreeBSD for use with FreeSwitch. I need to point out that doing this does in no way free you from the obligations of licensing the approprirate patents in your country as required. Head over to Spiro and get that sorted out.

I’m going to assume you’ve already got FreeSwitch installed, the FreeBSD instructions work well enough. FreeSwitch did have a FreeBSD Port but it was removed in December of 2013.

Anyways, we’re going to need git for this, and you’ll probably have it installed by now, but if not a pkg install git will get you sorted out. Now you may choose to use xadhoom’s original project, but his Makefile is for GNU make and won’t work for what we need. You could choose to use gmake (pkg install gmake) but I’ve forked his project and created a suitable BSD makefile.

git clone https://github.com/raruler/mod_bcg729.git

Edit the Makefile.bsd and change

FS_INCLUDES=/usr/local/freeswitch/include
FS_MODULES=/usr/local/freeswitch/mod

to whatever directories you’ve got FreeSwitch installed to. Then it’s just a matter of using the BSD Makefile

make -f Makefile.bsd install

It will fetch everything it requires and install it into the modules directory.

Now we’ll need to edit modules.conf.xml and comment out the existing mod_g729 and add the line for mod_bcg729

<!--<load module="mod_g729"/>-->
<load module="mod_bcg729"/>

Restart FreeSwitch

If you hop over to fs_cli and use show codecs you should see

codec,G.729,mod_bcg729

You’ll also need to add G729 to your codec list, or just add it to the global_codec_prefs option in vars.xml

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,G722,PCMU,PCMA,G729,GSM"/>