[Asterisk-Users] How to send Fax from Asterisk

Bryce Chidester bryce at rhinoequipment.com
Thu Jul 21 07:07:56 MST 2005


On Thu, 2005-07-21 at 13:00 +0900, Vic wrote:
> Dear all, 
> 
> I had Tom Rymes and several others suggest how I can implement sending
> fax using Asterisk. The idea is to have On-Demand-Fax. 
> 
> Unfortunately, I wrote down the wrong workflow: the real one is: 
> 
>   
> 
> 1. Person will call our phone number
> 2. He will be asked to press 1 for   Office 1 map, 2 for Office 2 map
> and 3 for Office 3 map.
> 3. User presses 1. 
> 
> 4. User is asked to enter his phone number.
> 
> 5. User enters his phone number and hangs up.
> 
> 6. Asterisk calls the number entered by user and sends a fax.
> 
> Can it be done?
> 
> Thanks,
> 
> Vic

Sure, quite easily. Setup said menus that direct through the dialplan
and terminate at something as simple as a System() that executes a
simple shell script that will then create a .call file
in /var/spool/asterisk/outgoing/, specifying the outgoing channel to use
and Application: TxFax. This is mine basically, to give you a start.
------------------------------------------------
exten => x,1,System(/usr/local/bin/asterisk-sendfax "${FAXMACHINE}" "${FAXFILE}" "${LOCALSTATIONID}">/var/spool/asterisk/outgoing/${UNIQUEID}.call)
------------------------------------------------
#/usr/local/bin/asterisk-sendfax "${FAXMACHINE}" "${FAXFILE}" "${LOCALSTATIONID}"
echo "Channel: $1
MaxRetries: 0
WaitTime: 20
Context: incoming-fax
Application: TxFax
Data: $2|caller
SetVar: LOCALSTATIONID=$3"
------------------------------------------------
This was just a quick and dirty hack I made to try out TxFax and it
works. Just a programming note: as stated on the wiki and in various
docs, it's unwise to output straight into a call file due t timing with
when Asterisk may read it and it isn't finished being written, thus it
is always wisest to output to a temporary directory, then perform a mv
operation to place the whole file at once in the directory (not to
mention, its presence isn't written to the filesystem until all the data
is written).

Good luck!

-- 
-Bryce
bryce at rhinoequipment.com

NOTICE: The views expressed in this e-mail do not neccesarily reflect
those of my employer, this company, or its employees. This is a personal
e-mail and as such, the opinions expressed are my own.




More information about the asterisk-users mailing list