[Asterisk-Users] RxFax/spandsp: file-naming of received faxes

Scott Laird scott at sigkill.org
Sun Mar 28 07:10:25 MST 2004


On Mar 28, 2004, at 5:21 AM, Nicolas Gudino wrote:

> Hi Jan,
>
> Try this:
>
> exten => _3XX,1,SetVar(FAXFILE=/tmp/faxfor-${EXTEN}-${TIMESTAMP}.tif)
> exten => _3XX,2,rxfax(${FAXFILE})

Or

   exten => 
_3XX,1,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID}.tif)

If you want a unique id, why not use the one that Asterisk provides?

In case anyone's interested, I spent a bit of time on incoming faxes 
yesterday, prototyping a DID FAX-type setup.  Here are a few snippets, 
in case anyone's interested.

[macro-faxreceive]
   exten => s,1,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID}.tif)
   exten => s,2,DBGet(EMAILADDR=extensionemail/${MACRO_EXTEN})
   exten => s,3,rxfax(${FAXFILE})
   exten => s,103,SetVar(EMAILADDR=defaultuser at example.com)
   exten => s,104,Goto(3)

[fax]
   exten => 2201,1,Macro(faxreceive)
   exten => 2202,1,Macro(faxreceive)
   exten => 2203,1,Macro(faxreceive)

   exten => h,1,system(/usr/local/sbin/mailfax ${FAXFILE} ${EMAILADDR} \
      "${CALLERIDNUM} ${CALLERIDNAME}")

; I'm using a shared analog line for testing this, so I'm using the fax
; autodetection code to yank faxes out of my IVR and into the 'fax'
; pseudo-extension
[outside]
   ...
   exten => fax,1,Goto(fax,2201,1)


Finally, here's /usr/local/sbin/mailfax:

#!/bin/sh

FAXFILE=$1
RECIPIENT=$2
FAXSENDER=$3

tiff2ps -2eaz -w 8.5 -h 11 $FAXFILE |
   ps2pdf - |
   mime-construct --to $RECIPIENT --subject "Fax from $FAXSENDER" 
--attachment fax.pdf --type application/pdf --file -

In Debian, tiff2ps comes in libtiff-tools, ps2pdf is part of 
Ghostscript, and mime-construct is its own package.

To set the email address associated with each extension, do 'database 
put extensionemail EXTEN user at example.com'


Scott




More information about the asterisk-users mailing list