Hylafax and postfix integration

This document will describe how to configure hylafax to receive fax and send it to your email mail box and vice-versa(sending an email from your local network and send it out as a fax). This article assumes that you have a working dial-up modem configured for receiving and sending faxes and a running postfix MTA.

The configuration explained here might also work on other distributions.

Installation
Emerge :

Hylafax Configuration
now that we have hylafax compiled we need to do some basic configuration :
 * 1) receiving fax
 * 2) setup a modem

for the first step we need to run the command : faxsetup

(this will give a basic server configuration about how to deal whit incoming fax calls) if we haven't setup a modem yet ... the faxsetup command will ask us to.

more info: http://www.hylafax.org/content/Handbook:Basic_Server_Configuration:Faxsetup

if you choose to skip this part and do it latter we need to run the command :

faxaddmodem

to give a specific information about how to handle that device.

more information about how to configure a specific modem can be found at : http://www.hylafax.org/content/Handbook:Basic_Server_Configuration:Faxaddmodem

now that we finish with that configuration part lets get down to business.

Fax routing
there are a few ways to decide which fax goes where, I will give a simple example and give a location of a good page for more complex configuration.

lets setup a device per script that will send the given fax to my email account

so the first think we should do is create a file that hylafax can read and understand that rules. this file is written with a "bash" syntax of the "case" statement.

first lets create the file:

creating a fax routing file

now that we created the file, lets edit it :

editing the fax dispatch file the case stat that every fax that I receive to the "modem" device will be sent to "me@example.com"

and the configuration that are not in the case statement are for global configuration ... how to handle the faxes.

more info: http://www.hylafax.org/man/current/faxrcvd.1m.html

starting hylafax server
* Check hylafax server configuration... ... * Use spool directory /var/spool/fax * Starting HylaFAX server daemons ... * Starting /usr/sbin/faxq ... * Starting /usr/sbin/hfaxd with args -l 127.0.0.1 -q /var/spool/fax -i hylafax -d          [ ok ]

if everything is o.k. you should receive the message above.

receiving faxes
now there is one more think left to do ... because we are using a device to receive faxes ( our modem ) we need to configure the inittab to accept incoming call on that device and use faxgetty to translate the device information. so will be adding the next line to the /etc/inittab file:

editing inittab

and now we will tell init to reread the configuration file:

Don't forget to add it to boot and default

and that is it ... we are good to go to receive faxes into our email account.

Postfix Configuration
this part is relatively easy we need to configure postfix to use hylafax as a fax server and restrict it to send only from local network first we need to add a low level user to send the fax with ...(it can be nobody) but I want a diffrent user to manage the send fax option.

adding a user account
add user :

useradd -M fax

editing master.cf file
now lets edit the master.cf

master.cf and now we will create a transport table for the fax mail:

creating a transport file

 * you need a transport file to tell the incoming faxes to be directed to your localhost machine

transport file

editing main.cf file
and now to configure it on main.cf

main.cf file

The process limit of 1 in the master.cf file is necessary with fax software that cannot handle multiple requests at the same time. It won't hurt otherwise.

The "fax_destination_recipient_limit" entry (by Simon, Mr. Simix) is necessary with fax software that can't have more than one destination on its command line. It won't hurt otherwise.

Specify dbm instead of hash if your system uses dbm files instead of db files. To find out what map types Postfix supports, use the command postconf -m.

Note: be sure to not advertise fax.your.domain in the DNS :-)

reloading the configurations
now reload the postfix server

SpamAssassin configuration
if you are using SpamAssassin like I do make sure to configure the localhost on your white list :

spam editing

sending a fax
if you want to send fax send it to : @fax.example.com

like so: 097522145@fax.example.com

that all :)