Fax and DDI

Hello.

I asked a few days ago a question about fax to email with asterisk.

But my question wasnot very clear.

What i would like to do is to receive fax with asterisk on a idsn line… and send it to an e-mail depending of the DDI of the caaling number.

If a fax is recived in DDI 5551254 i send it to an email.
if it is received in DDI 5551255 i send it to an other email
et…

it is possible ???

Whit wich card can i do that ?

Thank you for your answer.

i forget to tell that these DDI will ONLY receuve fax. They will never receive voice calls.

people who call these DDI must think that there is a fax machine that is answering.

Thank you for your help.

Do the following:

  1. In zapata.conf set faxdetect = no on your PSTN lines. This will give you more control over faxes in the dialplan, if you have faxdetect = yes, then if any faxtone is detected on the incoming call then it is switched to the exten => fax,1,… in extensions.conf, instead of using the did number to control it.

  2. go to www.soft-switch.org and download the source for spandsp and the corresponding app_rxfax.c, app_txfax.c and app_makefile.patch. You will see a directory called 0.0.2pre21, download the .tgz file in here. If you are using Asterisk 1.2beta1 then download the files in asterisk-1.1.x directory, if you are using Asterisk 1.0.9 or below then use the files in asterisk-1.0.x directory.

  3. follow the instructions to build the spandsp (from the .tgz file), and copy the app_rxfax.c and app_txfax.c into the apps directory in Asterisk, this is all documented in the spandsp documentation. Rebuild Asterisk and restart.

  4. when built and installed you should be able to do a show application rxfax in the Asterisk CLI and see the output of the help for this app. If it says ‘application not registered’ then you have not done the spandsp stuff properly otherwise you are ready to edit extensions.conf.

  5. In extensions.conf, do the following:

exten => _5551254,1,Answer()
exten => _5551254,2,SetVar(EMAIL=bob@acme.com)
exten => _5551254,3,rxfax(/var/spool/asterisk/${UNIQUEID}.tiff|debug)

exten => _5551255,1,Answer()
exten => _5551255,2,SetVar(EMAIL=fred@acme.com)
exten => _5551255,3,rxfax(/var/spool/asterisk/${UNIQUEID}.tiff|debug)

exten => h,1,system(/var/lib/asterisk/scripts/recvfax ${EMAIL} ${UNIQUEID}.tiff ${FAXPAGES} ${CALLERIDNUM})

This will answer the call and start up the soft fax machine that rxfax application / spandsp gives. The fax will be put in to the /var/spool/asterisk directory under the name ${UNIQUEID}.tiff.

When the fax completes the line will hangup and the exten => h,1 will be called. This calls a script (that you have to write) to email it to the end user. Sample script follows:

#!/bin/bash

EMAIL=$1
FILENAME=$2
FAXPAGES=$3
CALLERIDNUM=$4

echo . | mail -s “You have a new fax from ${CALLERIDNUM} of ${FAXPAGES} pages” -a /var/spool/asterisk/${FILENAME}.tiff ${EMAIL}

  1. You can change the directories and anything else but make sure the target directory exists, otherwise rxfax will answer the fax machine but will never write any faxes. The mail command is Linux distro dependent, the -a to attach files works on SuSE, but not on Debian which uses uuencode to encode the attachment, just modify this for your distro.

thank you for your help.

Juste a little question. Is the fax receiving whit spandsp woks also with a bri and a quadbri junghanns card ?

Thank you.