Here’s how I did it. You can send it straight tto a printer or off in an email.
Three packages are required and must be built together (from the same release):
spandsp:
A DSP library, builds in /usr/local/lib - add the ld path to /etc/ld.so.conf.d/local.conf
Download from: soft-switch.org/downloads/spandsp
the latest end-user release version, then from an asterisk subdirectory there, get:
app_rxfax app_txfax:
Asterisk modules for fax send and receive
These go in the asterisk-1.2.x/apps directory, along with apps_Makefile.patch - which should be applied to the Makefile in the asterisk-1.2.x/apps subdirectory
app_nv_backgrounddetect or app_nv_faxdetect or both:
These are required where a shared line (voice/fax) is used. When fax-tones are detected, the call is sent to exten => fax
newmantelecom.com/download/a … ct/(latest
fix include for stdio, for the first include:
#include <stdio.h>
find the line with (what happened??) and remove one ?
…(what happened?)\n):
add to the apps/Makefile:
APPS+=app_nv_backgrounddetect.so
I used backgrounddetect to play a recorded message on answer while listening for FAX tones:
exten => s,2,NVBackgroundDetect(welcome)
Alernatively, faxdetect with a five second wait with ring indicator can be used:
exten => s,4,NVFaxDetect(4|dt)
If dedicated fax DID is used, these detection routines aren’t required, just send it straight to a fax context.
See the wiki for details and bug-fixes:
voip-info.org/tiki-index.php … VFaxDetect
A perl script mime-construct is required for emailing:
argon.org/~roderick/(latest
Other perl modules may be required (mime) you can pull from CPAN:
perl -MCPAN -e ‘shell’
A script for delivering incoming fax to email:
#!/bin/sh
FAXFILE=$1 RECIPIENT=$2 FAXSENDER=$3 FAXID=/bin/date +%j%H%M%S
.pdf
/usr/bin/tiff2pdf -p letter $FAXFILE | /usr/local/bin/mime-construct --to $RECIPIENT --subject “Fax from $FAXSENDER” --attachment $FAXID --type application/pdf --file -
I also just use straight to a properly configured postscript printer rather than invoking a script at all:
[fax]
; Receive Fax on exten 2777
exten => 2777,1,Macro(faxreceive)
; on hangup ship the fax out
exten => h,1,system(/usr/bin/tiff2pdf -p letter -f ${FAXFILE} |/usr/bin/lpr -T"FAX from ${CALLERIDNUM} ${CALLERIDNAME}" -Plaser)
extensions.conf:
[incoming]
…
exten => s,2,NVBackgroundDetect(welcome) ; listen for fax tones
…
[fax]
; Receive Fax on exten 2115
exten => 2115,1,Macro(faxreceive)
; on hangup ship the fax out
exten => h,1,system(/usr/local/sbin/mailfax ${FAXFILE} ${EMAILADDR} “${CALLERIDNUM} ${CALLERIDNAME}”)
[macro-faxreceive]
exten => s,1,Set(FAXFILE=/var/spool/asterisk/fax/incoming/${UNIQUEID}.tif)
exten => s,2,Set(EMAILADDR=info@seawall.com)
exten => s,3,rxfax(${FAXFILE})
[localexten]
include => parkedcalls
…
; If fax is detected
exten => fax,1,Goto,fax|2115|1
exten => 2115,1,Goto,fax|2115|1
…
This is on RHEL4 and friends with tiff2pdf installed, ignore my extensions, etc., these are from working examples.
Good luck, all of the above is my very short digest (cheat sheet) of pretty much readily available information. As always, your mileage may vary…
Andy