System information
software would have a difficult time making sense of). In other words, unless you ded-
icate a DID to each user who might receive a fax, Asterisk isn’t going to be able to do
much more than send all faxes to a single email address. You could code something in
the dialplan to handle this, though, or have an external cron job or other daemon handle
distributing the received faxes.
A simple dialplan to handle fax to email might look something like this (you will need
the mail program mutt installed on your system):
exten => fax,1,Verbose(3,Incoming fax)
; folder where your incoming faxes will initially be stored
same => n,Set(FAXDEST=/tmp)
; put a timestamp on this call so the resulting file is unique
same => n,Set(tempfax=${STRFTIME(,,%C%y%m%d%H%M)})
same => n,ReceiveFax(${FAXDEST}/${tempfax}.tif)
same => n,Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
; *** This line should not have any line breaks
same => n,System(echo | mutt -a ${FAXDEST}/${tempfax}
-s "received fax" somebody@shifteight.org)
Obviously, this sample would not be suitable for production (for example, it does not
handle fax failure); however, it would be enough to start prototyping a more fully
featured incoming fax handler.
Fax to PDF
Delivering a fax to a user as a PDF is a popular request. Since PCs, Macs, and Linux
desktops can natively read TIFF files without any conversion required, this isn’t strictly
required. Nevertheless, many people insist on this functionality.
You can use a utility such as ghostscript to perform the conversion.
Fax Detection
You may have a dedicated phone number for receiving faxes. However, with Asterisk,
that is not a requirement. Asterisk has the ability to detect that an incoming call is a
fax and can handle it differently in the dialplan. Fax detection is available for both
DAHDI and SIP channels. To enable it for DAHDI, set the faxdetect option in /etc/
asterisk/chan_dahdi.conf. In most cases, you should set this option to incoming.
Table 19-1 lists the possible values for the faxdetect option in chan_dahdi.conf.
448 | Chapter 19: Fax