We have recently upgraded our Asterisk server to version 1.4. And while almost everything worked, fax portion was broken. In 1.2, we were using spandsp 0.2 and app_rxfax and app_txfax successfully to receive/send faxes.

After the 1.4 upgrade, I tried to compile the 1.4 versions of the apps (located at http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/). For those, you have to apply the patch (asterisk.patch) manually. After that compiling failed.

Then I uninstalled spandsp (it has nice feature of "make uninstall"), and installed 0.3 version, spandsp-20061206.tar.gz, switch to /usr/src/asterisk-1.4.0, run configure, make clean, make menuselect and it showed app_txfax and app_rxfax as XX (unavailable). I put the proper path in /etc/ld.so.conf and run ldconfig, prior to compiling Asterisk as well.

Then after a Digium forum post (Thanks Dnico), I made following changes:

/./build_tools/menuselect-deps
SPANDSP=1
../makeopts
SPANDSP_LIB=-lspandsp

And voila, menuselect was now showing the rxfax and txfax. However, after compiling, and installing, I realized something was still amiss. This time, as soon as rxfax runs in dialplan, Asterisk crashed.

Doing more research, I found one user group post, suggesting to run autoconf, as the patch involved changes to configure.ac. Furthermore, someone suggested to use bootstrap.sh located in asterisk source. Running it on my box, corrupted the configure file.

So to start from scratch, on my test box, I installed spandsp 0.3 (same as above), copied asterisk source files from the production box, to make the changes permanent (for Dnico’s suggestion), I edited menuselect-deps.in and makeopts.in, downloaded latest version of autoconf, 2.60-1, and run the bootstrap.sh. After few warnings, it generated the configure file fine. Then I run the usual suspects, configure, make menuselect, adjust the selections, x to exit and save, run make and finally make install. Voila, finally success.

The incoming faxes are working fine now, I replicated it to the production box as well. I had to hunt down the Newman Telecom’s nvfaxdetect and nvbackgrounddetect scripts, as the author had sold his work to a company. I got my copy from x68k.net and they compiled fine. Now I can detect if the incoming call is a fax and act on it in the dialplan accordingly.

If you need any help compiling rxfax and txfax on Asterisk 1.4, drop in a comment