Here is a quick and dirty HowTo on getting SpanDSP to work with the latest editions of Asterisk 1.4. If you have any issues let me know in the comments and we’ll get them sorted out.

First we’ll have to download the asterisk source from their site.

# cd /usr/src
# wget ftp://ftp1.digium.com/pub/asterisk/asterisk-1.4.5.tar.gz
# tar xzvf asterisk-1.4.5.tar.gz

Now we’ll have to grab the latest SpanDSP from Soft-Switch. We’ll also have to compile this and make sure no other SpanDSP versions are available on our server. The paths may change if you are using /usr/local so edit the following commands appropriately.

# cd /usr/lib
# rm -rf *spandsp*
# cd /usr/include
# rm -rf *spandsp*
# cd /usr/src
# wget http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.4pre3.tgz
# tar xzvf spandsp-0.0.4pre3.tgz
# cd spandsp-0.0.4pre3
# ./configure && make && make install
# ldconfig -v

Now that SpanDSP has been compiled and installed, we can continue with the integration to Asterisk 1.4.

First we will need to copy the app_txfax.c and app_rxfax.c into the Asterisk Applications directory. This can be done like this:

# cd /usr/src
# cd asterisk-1.4.5
# cd apps
# wget http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/app_rxfax.c
# wget http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/app_txfax.c
# cd ..

Now we’ll have to add the SpanDSP support to Asterisk in order to make use of these applications. I prefer to manually apply the patch file from Soft-Switch because it almost always fails. You can try either way you want.

Open up the patch file in a web browser so you can easily see what lines need to change, the patch file is located here

patch file: http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/asterisk.patch

Now we’ll need to manually apply these lines. Assuming you know something about patch files it should be pretty easy for you to modify the files, I’ll briefly outline what needs to be done below.

First, Make sure you are in the Asterisk source directory.

# cd /usr/src/asterisk-1.4.5

Now, We’ll have to modify the menuselect dependencies.

# nano build_tools/menuselect-deps.in

Search for RADIUS=@PBX_RADIUS@ and directly below this line put in the following new line

SPANDSP=@PBX_SPANDSP@

Exit and save the file.

Now you’ll have to add a line to configure.ac

# nano configure.ac

Search for AST_EXT_LIB_SETUP([RADIUS], and directly below this line, put this in

AST_EXT_LIB_SETUP([SPANDSP], [spandsp Library], [spandsp])

Now, in the same file (configure.ac) we also have to add another line. Search for AST_EXT_LIB_CHECK([RADIUS], and directly below this line, add the following all on one line:

AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [fax_init], [spandsp.h], [-ltiff])

Exit and save the file. Now our last file to edit is the make options, which you can do like this

# nano makeopts.in

Search for the line like this RADIUS_LIB=@RADIUS_LIB@, add this directly below it

SPANDSP_INCLUDE=@SPANDSP_INCLUDE@
SPANDSP_LIB=@SPANDSP_LIB@

Exit and save the file.

Now we are almost ready to get the compiling going. But first, we have to copy the plc.h file to the Asterisk source so we won’t get errors during compiling later on. You can do this as such:

# cd /usr/src/asterisk-1.4.5
# cd includes/asterisk
# cp plc.h plc.h.backup
# cp /usr/include/spandsp/plc.h .

Now because we’ve added new options to Asterisk, we’ll have to bootstrap it

# cd /usr/src/asterisk-1.4.5
# ./bootstrap.sh

Now we re-run configure like the following, your options might be different

# ./configure --with-netsnmp --with-ssl --with-spandsp

Now we should go into the menuselect program to ensure that app_rxfax and app_txfax will be included when you compile Asterisk.

# make menuselect

Ensure that both applications are selected under the Applications menu. Exit the menuselect utility by pressing “x” to save your changes if required.

Now we can continue with the regularly scheduled compiling of the program.

# make  
# make install

You should have a brand new copy of app_txfax.so and app_rxfax.so located in /usr/lib/asterisk/modules

Note that you might have to add /usr/local/lib or /usr/lib to your ld.so.conf in /etc in order to make this work, once you add the library path, re-run ldconfig, then try to start asterisk.

Have fun!

Comments

Comment by Florent on 2007-06-28 08:53:35 -0500

Hello

All seems well to occur, but I do not see the applications in the list with “core show applications”. Asterisk can’t find the app_rxfax for receive a fax.
The appplications are selected in “make menuselect”.

Any idea ?

Thanks!

Comment by Florent on 2007-06-28 10:28:44 -0500

[Jun 28 16:07:12] WARNING[14030] loader.c: Error loading module ‘app_txfax.so’: libspandsp.so.0: cannot open shared object file: No such file or directory
[Jun 28 16:07:12] WARNING[14030] loader.c: Module ‘app_txfax.so’ could not be loaded.

Comment by Florent on 2007-06-28 10:56:50 -0500

added /usr/local/lib in /etc/ld.so.conf
ldconfig
it works 🙂

Comment by Matt G on 2007-06-28 13:48:07 -0500

Hi Florent,

Glad you figured it out and thanks for the information. I’ll add this to the howto above.

Thanks, have fun with spandsp 🙂

Matt

Comment by Abed on 2007-07-06 22:14:23 -0500

Nice HowTo!

I just want to ask what are the procedures that I will be adding/skipping if I want to install this on a running Asterisk 1.4.5?

Comment by Matt G on 2007-07-07 13:36:05 -0500

Hello Abed,

Glad you like the howto. If you are starting from an already existing installation of Asterisk 1.4.5, I would just create a backup of your Asterisk Source directory (if you’ve made any customizations). Then follow the howto as per regular order and you should be good to go.

Hope this helps!

Matt

Comment by Chems on 2007-07-09 06:07:28 -0500

Hi all,
I have installed successfully spandsp with asterisk 1.4.5. I can see both the fxfax and rxfax in the core applications. But when I run it from my extensions.conf It crashes asterisk with the following error:
"
Executing [6666@from-hicom:4] TxFAX(“Zap/1-1”, “/var/tmp/mydocument.tif”) in new stack
asterisk: symbol lookup error: /usr/lib/asterisk/modules/app_txfax.so: undefined symbol: span_set_message_handler
"

Any ideas ?!
Rgs,

Comment by Matt Gibson on 2007-07-09 09:09:48 -0500

Hi Chems,

Interesting. I also tried my txfax, and get the same error. I hadn’t seen this before because I was using only app_rxfax. I am unsure as to how to fix this, i’d think that SpanDSP has a bug in it 🙁

If I figure anything out I will let you know.

Thanks for noticing this.
Matt

Comment by Chems on 2007-07-10 02:38:55 -0500

Matt,
I seems that it is already a known problem. But don’t know what they mean by “not fixable” !!
http://bugs.digium.com/print_bug_page.php?bug_id=8576

Comment by Matt Gibson on 2007-07-10 02:46:39 -0500

Chems,

Heh! That’s a report filed by me. I had the same issue before, but on rxfax, not txfax, which is what your logs show.

My issue seemed to “resolve itself” after asterisk 1.4.3, however the quality on rxfax is still sub par, I only receive a few faxes, and sometimes the pages (pdfs) are all black. No joy!

I think I may try out hylafax sometime instead.

Let me know if you find anything out about txfax, I think the issue with mine previously was that I had some resident headers around the system. I cleaned out EVERYTHING related to spandsp out of /usr/local and /usr and etc and then recompiled from source, reinstalled, and then it stopped crashing.

hth!

Comment by JohnD on 2007-08-20 14:20:34 -0500

On a clean install, the app did not show up in menuselect. Makes sense, as the Makefile does not see a need to rebuild the menuselect tree.

To force this, run the following in the asterisk src directory:

touch build_tools/embed_modules.xml
make menuselect-tree

Comment by Sokaris on 2007-09-03 10:38:59 -0500

For execute ./bootstrap.sh it is need to have installed Autoconf 2.60 or higher. You download it in ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz

Sokaris

Comment by diawdji on 2007-09-27 22:34:40 -0500

Hi
I have problem;I’ve done all steps and when I arrive in make menuselect,ihave not seen app_txfax and app_rxfax in application menu
Where the problem?
Regards?

Comment by Matt G on 2007-09-28 03:00:11 -0500

Hi Diawdji,

Yeah, This seems to be happening again now to me as well. What you have to do, is manually edit the menuselect file to add these menu options. Even though they are not resident on the make menuselect page, they should still be compiled. You can verify this after issuing the make install, if the app_txfax.so and app_rxfax.so are available in the asterisk modules directory, then it worked.

Anyhow, just add the lines to the menuselect dependency file, and then you should see it upon make menuselect issue.

This is because ./configure erased what the bootstrapping created for you, as far as I can tell anyway.

Hope this helps,
Matt G

Comment by DaveP on 2007-12-07 10:58:57 -0500

Hi,

I’ve managed to find a location where these files can be downloaded:

http://sourceforge.net/projects/agx-ast-addons

Once I obtained the app_rxfax.c and app_txfax.c files from the tarball I was able to successfully make asterisk-1.4.15

Regards,
Dave.

Comment by javaworldvn on 2007-12-08 06:24:38 -0500

hi all,

I have a problem with my spandsp in my unit,
i have done following your ways, but it still not available, i cannot call functions of spandsp: fax_init(…)

Do you help any hints?
Looking forward to hearing from you as soon as possible.!
Thnks and best regards
/Javaworldvn

Comment by javaworldvn on 2007-12-08 06:32:02 -0500

hi all,

I have a problem with my spandsp in my unit,
i have done following your ways, but it still not available, i cannot call functions of spandsp: fax_init(…)

Do you have any hints?
Looking forward to hearing from you as soon as possible.!
Thnks and best regards
/Javaworldvn

Comment by Wag3Slav3 on 2008-01-19 23:48:48 -0500

To get txfax and rxfax to show up after bootstap.sh do a make distclean.

Comment by Robert on 2008-07-17 16:44:40 -0500

Way beyond good, excellent material it really helped me.

Comment by reda on 2008-08-20 12:08:14 -0500

Hi and thank you for this tuto,

app_txfax.c and app_rxfax.c are no more available on the softswitch website, nor the patch file. Does someone has any copy of them? Otherwise, is there any website from where we can find versions that are known to work correctly?

Thank you.

Comment by Agustina on 2009-11-13 15:04:58 -0500

Hello,
I followed the tuto, I ´ve asterisk 1.4.24 and spandsp 0.0.6 but when I go into menuselect I see the following:
XXX 53. app_rxfax
XXX 69. app_txfax

Thanks for any help!!!

Comment by wangp on 2009-11-16 05:30:14 -0500

spandsp0.0.6 的pcl.h 不适合asterisk1.4.** 编译会有问题
但是和 XXX 53. app_rxfax
XXX 69. app_txfax

和spandsp0.0.6没有关系,还是看看你之前的步骤吧