[Asterisk-Users] Re: Fax Support

trixter aka Bret McDanel trixter at 0xdecafbad.com
Sat Dec 31 16:08:13 MST 2005


On Sat, 2005-12-31 at 16:45 -0600, LJ wrote:
> exten => 1234567,1,rxfax(/home/steveu/testfax.tif)

I email pdf files, this requires a few extra packages, but I feel its
the easiest way to deal with it.  I have a macro that calls a shell
script and all to do  this.  Its based off work of others, I dont know
who they are, but here is what I do.  Its fairly trivial and fairly
painless if the underlying components are installed and working.

DEPENDS:
	spandsp & rxfax
	libtiff (should include tiff2pdf)
	mime-construct
	everything else should be standard on an asterisk server
          (bourne shell, asterisk, etc)


in AEL
macro faxreceive( email ) {
        rxfax(/tmp/${UNIQUEID}.tiff);
        system(/usr/sbin/mailfax /tmp/${UNIQUEID}.tiff ${email}
${CALLERIDNUM});
};


In extensions.conf

[macro-faxreceive]
exten => s,1,rxfax(/tmp/${UNIQUEID}.tiff)
exten => s,2,system(/usr/sbin/mailfax /tmp/${UNIQUEID}.tiff ${arg1}
${CALLERIDNUM})


Then just call it 
in AEL
&faxreceive(moo at ojnk.com);

extensions.conf
exten => 12345,1,macro(faxreceive,moo at ojnk.com)

Using a database or something you can dynamically get the email address
on a per user basis.  Fairly trivial to do, course an AGI could do this
as well.


The mailfax script
#!/bin/sh

FAXFILE=$1 
RECIPIENT=$2
FAXSENDER=$3 
PDFTMPFILE=${FAXFILE}.pdf
PDFFILE=`date +fax-%Y%m%d%H%M%S.pdf`

tiff2pdf -o /tmp/${PDFTMPFILE} -z -p letter \
  -c "creator such as your company name" \
  -a "author such as your company name" \
  -t "Fax from ${FAXSENDER} to ${RECIPIENT}" \
  -s "Fax from ${FAXSENDER} to ${RECIPIENT}" ${FAXFILE}

mime-construct --to $RECIPIENT \
  --subject "Fax from $FAXSENDER" \
  --attachment ${PDFFILE} --type application/pdf \
  --file /tmp/${PDFTMPFILE}

rm -f /tmp/${PDFTMPFILE} /tmp/${FAXFILE}



-- 
Trixter http://www.0xdecafbad.com     Bret McDanel
UK +44 870 340 4605   Germany +49 801 777 555 3402
US +1 360 207 0479 or +1 516 687 5200
FreeWorldDialup: 635378
http://www.sacaug.org/ Sacramento Asterisk Users Group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20051231/2ce0cd70/attachment.pgp


More information about the asterisk-users mailing list