HylaFax on Ubuntu 11.10

Introduction

Buying the hardware

There are plenty of modems you can buy but it's getting harder and harder to find a device capable of handling faxex in hardware and thus suitable for HylaFax. You should choose an external serial modem, this page will help you: http://www.hylafax.org/content/Handbook:Basic_Server_Configuration:Choos...

Checking the modem connection

First thing to do is check that the modem works and talks with the computer you're using, let's install a communication program and check which serial ports are available:
apt-get install cu
dmesg | grep tty
You should make sure that your user is member of the "dialout" group (or whichever group has permission on the tty device), for example:
ls -l /dev/ttyUSB1 
nano /etc/group
Now, let's try the connection to the modem; we'll run run a few command, to interrupt the communication just type the character "~", wait a few seconds, type the character "." and return.
In this example the modem is connected through an USB<->Serial adapter on /dev/ttyUSB1.
host% cu -l /dev/ttyUSB1
Connected
at+fclass=?
0,1,2,1.0
OK
~[host].
Disconnected 
The at+fclass=? command asks the modem to report which classes it is capable of supporting. Class 0 is for data use. Class 1, Class 1.0, Class 2, Class 2.0 and Class 2.1 are for facsimile use. Other classes may be reported, for example, for modems that provide digitized voice support. HylaFAX™ can be used with any modem that supports Class 1, Class 1.0, Class 2, Class 2.0 or Class 2.1.

Installing Hylafax

Let's install the package:
apt-get install hylafax-server
Now just follow through the wizard configuration provided by HylaFax:
faxsetup
Here are the important snippets with example answers:
	HylaFAX configuration parameters are:
 
	[1] Init script starts faxq:		yes
	[2] Init script starts hfaxd		yes
	[3] Start paging protocol:		no
Are these ok [yes]? yes
You have a HylaFAX scheduler process running.  faxq will be
restarted shortly, as soon as some other work has been completed.
Can I terminate this faxq process (9826) [yes]? yes
Should I restart the HylaFAX server processes [yes]? yes
Now let's configure our first modem (you can easily have more than one):
faxaddmodem
Take care with the serial port:
Serial port that modem is connected to [ttyS0]? ttyUSB1
the default parameters are usually ok but some change depending on your location, you can even translate the headings (in this example in Italian):
Country code [1]? 39
Area code [415]? 041
Phone number of fax modem [+1.999.555.1212]? +39.041.123456
Local identification string (for TSI/CIG) ["NothingSetup"]? "Customer Name"
Long distance dialing prefix [1]? 0
International dialing prefix [011]? 00
Dial string rules file (relative to /var/spool/hylafax) [etc/dialrules]? 
Tracing during normal server operation [1]? 
Tracing during send and receive sessions [11]? 
Protection mode for received facsimile [0600]? 
Protection mode for session logs [0600]? 
Protection mode for ttyUSB1 [0600]? 
Rings to wait before answering [1]? 5
Modem speaker volume [off]? 
Command line arguments to getty program ["-h %l dx_%s"]? 
Pathname of TSI access control list file (relative to /var/spool/hylafax) [""]? 
Pathname of Caller-ID access control list file (relative to /var/spool/hylafax) [""]? 
Tag line font file (relative to /var/spool/hylafax) [etc/lutRS18.pcf]? 
Tag line format string ["From %%l|%c|Page %%P of %%T"]? "Da %%l|%c|Pagina %%P di %%T"
Time before purging a stale UUCP lock file (secs) [30]? 
Hold UUCP lockfile during inbound data calls [Yes]? 
Hold UUCP lockfile during inbound voice calls [Yes]? 
Percent good lines to accept during copy quality checking [95]? 
Max consecutive bad lines to accept during copy quality checking [5]? 
Max number of pages to accept in a received facsimile [25]? 
Syslog facility name for ServerTracing messages [daemon]? 
Set UID to 0 to manipulate CLOCAL [""]? 
Use available priority job scheduling mechanism [""]? 
The script will then probe the modem, this is an important step and if it fails or the connection with the modem is too slow you're in trouble and the modem is not working out-of-the-box with HylaFax. If the probing looks good you'll probably have to choose the Class for the modem, "1" is usually a good one:
This modem looks to have support for Class 1.0, 1 and 2.
How should it be configured [1.0]? 1.0
after that the script asks for special command for your modem, the default are usually ok but if things do not work well you may want to search on the internet for different commands and control-flow settings.

Configuring and running Hylafax

After the modem configuration you should restart HylaFax:
/etc/init.d/hylafax restart
and check with the faxstat command that it is listening with the correct modem(s).
user@host:~$ faxstat
HylaFAX scheduler on host: Running
Modem ttyUSB1 (+39.041.123456): Running and idle

Adding users

You can change the admin password with this command:
faxadduser –a <newpassword>
and to add a new user just use this command:
faxadduser –p <password> <username>
The file on which users and network permission are store is /var/spool/hylafax/etc/hosts.hfaxd.

Receiving fax and notification by mail

To receive fax by mail you'll just have to create a configuration file:
nano /var/spool/hylafax/etc/FaxDispatch
with the following lines:
TEMPLATE=it;
FILETYPE=pdf;
SENDTO="fax@example.com";
You'll then have to check where postfix saves his aliases:
postconf alias_database
and change that file appropriately, for example in /etc/aliases:
FaxMaster:      fax@example.com
and you should be sure that postfix is sending mail in a way that they are not flagged as spam.

GUI Clients

Windows

# WPHF Reloaded is one of the best open source client for windows http://sourceforge.net/projects/wphf-reloaded/

Linux

# This cross-platform client in Java is suitable for usage within a Linux Desktop Environment and it doesn't even need installation. http://sourceforge.net/projects/jhylafax/files/JHylaFAX/1.4.0/

Mac OS X

Monitoring HylaFax

You should use the command faxstat which allows to see both the receive and sender queue.

Visit the website of the company behind these tutorials: www.qaniklab.it