Initially, the only way to handle faxing in Asterisk was
through the spandsp
library. spandsp provides a
multitude of Digital Signal Processing (DSP) capabilities, but in this
context all we are interested in is its fax functionality.
Asterisk has the hooks built in to make use of spandsp, but due to incompatible licenses, the spandsp libraries must be downloaded and compiled separately from Asterisk. Also, since spandsp was not written only for Asterisk, it will not assume that it is being installed for Asterisk. This means that a few extra steps will be required to ensure Asterisk can use spandsp.
As of this writing, the current version of spandsp is 0.0.6.
Download and extract the spandsp source code as follows:
$
mkdir ~/src/asterisk-complete/thirdparty
$
cd ~/src/asterisk-complete/thirdparty
$
wget http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6pre17.tgz
$
tar zxvf spandsp-0.0.6pre17.tgz
$
cd spandsp-0.0.6
The spandsp software should compile and install with the following commands:
$
./configure
$
make
$
sudo make install
This will
install the library in the /usr/local/lib/
folder.
On many Linux systems this folder is not automatically part of the
library path (libpath
), so it will need to be added
manually.
In order to make the spandsp
library
visible to all applications on the system, the folder where it is
located must be added to the libpath
for the
system. This is typically done by editing files in the
/etc/ld.so.conf.d/
directory. You simply need to
ensure that one of the files in that directory has
/usr/local/lib
listed. If not, the following command
will create a suitable file for you:
$
sudo cat >> /etc/ld.so.conf.d/usrlocallib.conf /usr/local/lib
Press Ctrl+D to save the file, then run the ldconfig command to refresh the library paths:
$
sudo ldconfig
You are now ready to recompile Asterisk for spandsp support.
Since the spandsp
library was probably
not installed on the system when Asterisk was first compiled, you will
need to do a quick recompile of Asterisk in order to have the spandsp
support added:
$
cd ~/src/asterisk-complete/asterisk/1.8/
$
./configure
$
make menuselect
Ensure that under the Resource Modules heading, the section for spandsp looks like this:
[*] res_fax_spandsp
XXX res_fax_spandsp
It means that Asterisk was not able to find the
spandsp
library.
Once you have verified that Asterisk can see spandsp, you are ready to recompile. Save and exit from menuselect, and run the following:
$
make
$
make install
You can verify that spandsp is working with Asterisk by issuing the following command from the Asterisk CLI:
*CLI>
module show like res_fax_spandsp.so
At
this point the SendFAX()
and
ReceiveFAX()
dialplan applications will be available
to you.
The spandsp
library and the Digium fax
library, discussed in the next section, are mutually exclusive. If you
want to try out the Digium fax product, you will need to ensure that
spandsp does not load. To disable spandsp in Asterisk, simply edit your
/etc/asterisk/modules.conf
file as follows:
noload => res_fax_spandsp.so
Save the changes and restart Asterisk.