[Asterisk-Users] Working exten=> fax...

Anton Krall akrall-lists at intruder.com.mx
Thu May 5 00:40:31 MST 2005


On the default incoming context for your zap or whatever cards
 
exten => fax,1,Goto(fax,s,1)

then make this context
 
[macro-faxreceive]
exten => s,1,SetVar(FAXFILE=/var/spool/asterisk/fax/${TIMESTAMP})
exten => s,2,DBGet(EXTMAIL=${MACRO_EXTEN}/xEmail)
exten => s,3,NoOP()
exten => s,4,DBGet(EXTNAME=${MACRO_EXTEN}/xName)
exten => s,5,NoOP()
exten => s,6,rxfax(${FAXFILE}.tif)
exten => s,103,SetVar(EXTMAIL=EMAIL-WHERE-TO-SEND-FAXES)
exten => s,104,Goto(3)
exten => s,105,SetVar(EXTNAME=Anton Krall)
exten => s,106,Goto(5)
 
[fax]
exten => s,1,Macro(faxreceive)
exten => h,1,System(/usr/local/bin/mailfax.sh "${CALLERIDNUM}"
"${CALLEDFAX}" "${EXTNAME}" "${EXTMAIL}" "${FAXFILE}")

also make a mailfax.sh script file that does the processing and conersion to
pdf like this for example:
 
#!/bin/bash
echo Received paramters $1 $2 $3 $4 $5 >>/var/log/faxmail.log
DATETIME=`date +"%A %d %b %Y %H:%M"`
if [ -e $5.tif ]
then
 echo fax file $5.tif found. Sending email to $4 .... >>/var/log/faxmail.log
 PAGES=$(tiffinfo $5.tif | grep "Page")
 DT=$(tiffinfo $5.tif | grep "Date")
 COUNT=${PAGES#*-}
 rm -f $5.txt
/usr/bin/tiff2ps -2eaz -w 8.5 -h 11 $5.tif > $5.ps
/usr/bin/ps2pdf $5.ps $5.pdf
 echo "Estimado $3," >>$5.txt
 echo "" >>$5.txt
 echo "Acaba de recibir un fax. A continuacion se muestran los detalles:"
>>$5.txt
 echo "" >>$5.txt
 echo "De      : $1" >>$5.txt
 echo "Para    : $2" >>$5.txt
 echo "Fecha   : $DATETIME" >>$5.txt
 echo "Paginas : $COUNT" >>$5.txt
 echo "" >>$5.txt
 echo "" >>$5.txt
 echo "Intruder Consulting PBX" >>$5.txt
 echo sendEmail -f INSERT-FROM-EMAIL -t $4 -u "New fax received" -a $5.pdf
>> /var/log/faxmail.log
 echo "<<<<<<<<<<<<<<<<<<<<---------------->>>>>>>>>>>>>>>>>>>>>>>>>" >>
/var/log/faxmail.log
 /usr/local/bin/sendEmail -q -f  <mailto:asterisk at intruder.com.mx>
INSERT-FROM-EMAIL -t $4 -u "Nuevo Fax Recibido" -a $5.pdf -m < $5.txt
rm -f $5.*
else
 rm -f $5.txt
 echo "Estimado $3," >>$5.txt
 echo "" >>$5.txt
 echo "Recibimos una llamada que parecia ser un fax, sin embargo, ningun fax
fue recibido. A continuacion se muestran los det
alles:" >>$5.txt
 echo "" >>$5.txt
 echo "De      : $1" >>$5.txt
 echo "Para    : $2" >>$5.txt
 echo "Fecha   : $DATETIME" >>$5.txt
 echo "Paginas : $COUNT" >>$5.txt
 echo "" >>$5.txt
 echo "" >>$5.txt
 echo "Intruder Consulting PBX" >>$5.txt
 echo sendEmail -f  <mailto:asterisk at intruder.com.mx> INSERT-FROM-EMAIL -t
$4 -u "New fax received" -a $5.pdf >> /var/log/faxmail.log
 echo "<<<<<<<<<<<<<<<<<<<<---------------->>>>>>>>>>>>>>>>>>>>>>>>>" >>
/var/log/faxmail.log
 /usr/local/bin/sendEmail -q -f INSERT-FROM-EMAIL -t $4 -u "Recepcion
Erronea de Fax" -m < $5.txt
rm -f $5.*
 exit
fi

Hope this helps... works great for me.


  _____  

From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tim Connolly
Sent: Jueves, 05 de Mayo de 2005 01:32 a.m.
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: [Asterisk-Users] Working exten=> fax...



Can someone send me an example of a CVS-head extension.conf excerpt that
utilizes the faxdetect and "fax" extension feature. I'm tired of seeing
these:

Apr 29 17:33:15 NOTICE[3541] chan_zap.c: Fax detected, but no fax extension

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050505/85a221ec/attachment.htm


More information about the asterisk-users mailing list