System information
$ sudo yum -y install ghostscript
and in Ubuntu with:
$ sudo apt-get install ghostscript
Once installed, ghostscript can convert the PDF into an Asterisk-compatible TIFF file
with the following command:
$ gs -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -sPAPERSIZE=letter -sOutputFile=<dest> <src>
Replace <dest> with the name of the output file, and specify the location of your source
PDF with <src>.
The ghostscript program should create a TIFF file from your PDF that will be suitable
for transmission using Asterisk SendFax().
An Experiment in Email to Fax
Many users would like to be able to send emails as fax documents. The primary chal-
lenge with this is ensuring that what the users submit is in a format suitable for faxing.
This ultimately requires some form of application development, which is outside the
scope of this book.
What we have done is provided a simple example of some methods that at least provide
a starting point for delivering email to fax capabilities.
One of the first changes that you would need to make in order to handle this is a change
to your /etc/aliases file, which will redirect incoming faxes to an application that can
handle them. We are not actually aware of any app that can do this, so you’ll have to
write one. The change to your /etc/aliases file would look something like this:
fax: "| /path/to/program/that/will/handle/incoming/fax/emails"
In our case, Russell built a little Python script called fax.py, so our /etc/aliases file would
read something like this:
fax: "| /asteriskpbx/fax.py"
We have included a copy of the Python script we developed for your reference in
Example 19-1. Note that this file is not suitable for production, but merely serves as an
example of how a very basic kind of email to fax functionality might be implemented.
Example 19-1. Proof of concept email to fax gateway, fax.py
#!/usr/bin/env python
"""Poor Man's Email to Fax Gateway.
This is a proof of concept email to fax gateway. There are multiple aspects
that would have to be improved for it to be used in a production environment.
Copyright (C) 2010 - Russell Bryant, Leif Madsen, Jim Van Meggelen
Asterisk: The Definitive Guide
"""
Outgoing Fax Handling | 451