System information

Transmitting a Fax from Asterisk
To transmit a fax from Asterisk, you must have a TIFF file. How you generate this TIFF
is important, and may involve many steps. However, from Asterisk’s perspective the
sending of a fax is fairly straightforward. You simply run the SendFAX() dialplan appli-
cation, passing it the path to a valid TIFF file:
exten => faxthis,1,SendFAX(/path/to/fax/file,d)
In practice, you will normally want to set some parameters prior to transmission, so a
complete extension for sending a fax using Digium’s Fax For Asterisk might look
something like this:
exten => faxthis,1,Verbose(2,Set options and transmit fax)
; some folder where your outgoing faxes will be found
same => n,Set(faxlocation=/tmp)
; In production you would probably not want to hardcode the filename
same => n,Set(faxfile=faxfile.tif)
same => n,Set(FAXOPT(headerinfo)=Fax from ShiftEight.org)
same => n,Set(FAXOPT(localstationid=4169671111)
same => n,SendFax(${faxlocation}/${faxfile})
File Format for Faxing
The real trick of sending a fax is having a source file that is in a format that the fax
engine can handle. At a basic level, these files are known as TIFF files; however, the
TIFF spec allows for all sorts of parameters, not all of which are compatible with fax
and not many of which are documented in any useful way. Additionally, the types of
TIFF formats that spandsp can handle are different from those Digium FFA will handle.
In the absence of one simple, clear specification of what TIFF file format will work for
sending faxes from Asterisk, we will instead document what we know to work, and
leave it up to the reader to perform any experimentation required to find other ways to
generate the TIFF.
*
Digium’s Fax For Asterisk Administration Manual documents a process for converting
a PDF file into a TIFF using commonly available Linux command-line tools. While
kludgy, this method should allow you to build Linux scripts to handle the file conver-
sion, and your users will be able to submit PDFs as fax jobs.
You will need the ghostscript PDF interpreter, which can be installed in CentOS by the
command:
* One format we tried was using the Microsoft Office Document Image Writer, which offers “TIFF-
monochrome fax” as an output format. This seemed too good to be true, which is exactly what it turned out
to be (neither spandsp nor Digium FFA could handle the resulting file). It would have been ideal to have
found something common to Windows PCs that could be used by users to “print” an Asterisk-compatible
TIFF file.
450 | Chapter 19:Fax