HylaFax on CentOS

by Mike on May 25, 2010 · 1 comment

in Server Management

HylaFax provides a way to receive faxes on your server and send them as email attachments to a user or number of users on your network.  You can also send faxes from the server.  This tutorial will show you how to set up HylFax on a CentOS server so that you can receive faxes.  You will need a modem for this and certainly it makes sense to check the website for HylaFax to determine the easiest modem to set up.

Install Dependencies
You will have several dependencies, when you install these they will also pull down some additional dependencies.

yum  install ghostscript sharutils

Install from RPMForge Repositories
In order to install from the RPMForge repositories you will need to add RPMForge in the yum.repos.d directory.

yum install hylafax

Find tty
It is imperative that you  locate the modem and how it connects to the server, which is indicated by a tty.  You have valuable information in the kernl buffer, dmesg.  The example below finds the information by looking at both the ttys and the usb connections as this is a USB modem.

dmesg | grep tty
serial8250: ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A
00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
cdc_acm 3-1:2.0: ttyACM0: USB ACM device

dmesg | grep usb
usbcore: registered new driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters

The serial connection you need to use is ttyACM0 for this modem, yours will likely be different.

Configure HylaFax

Begin the  config process with this command:

/usr/sbin/faxsetup

As you work through the process be sure to enter your area code, the name of your company, phone number for the fax and the correct modem information that gathered in the previous step.  Also be sure to indicate the correct permissions that are highlighted.

No scheduler config file exists, creating one from scratch.
Country code [1]?
Area code [000]? 113
Long distance dialing prefix [1]?
International dialing prefix [011]?
Dial string rules file (relative to /var/spool/hylafax) ["etc/dialrules"]?
Tracing during normal server operation [1]?
Default tracing during send and receive sessions [0xFFF]?
Continuation cover page (relative to /var/spool/hylafax) []?
Timeout when converting PostScript documents (secs) [180]?
Maximum number of concurrent jobs to a destination [1]?
Define a group of modems []?
Time of day restrictions for outbound jobs ["Any"]?
Timeout before purging a stale UUCP lock file (secs) [30]?
Max number of pages to permit in an outbound job [0xffffffff]?
Syslog facility name for ServerTracing messages [daemon]?

The non-default scheduler parameters are:

AreaCode:        113

Are these ok [yes]?
Country code [1]?
Area code [113]?
Phone number of fax modem [+1.999.555.1212]? 1.113.234.1234
Local identification string (for TSI/CIG) ["NothingSetup"]? MyCompany.com

Long distance dialing prefix [1]?
International dialing prefix [011]?
Dial string rules file (relative to /var/spool/hylafax) [etc/dialrules]?
Tracing during normal server operation [1]?
Tracing during send and receive sessions [0xFFF]?
Protection mode for received facsimile [0600]? 644
Protection mode for session logs [0600]? 644
Protection mode for ttyS0 [0600]? 666

Rings to wait before answering [1]?
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) [""]?
Tag line font file (relative to /var/spool/hylafax) [etc/lutRS18.pcf]?
Tag line format string ["From %%l|%c|Page %%P of %%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 [""]?

The non-default server configuration parameters are:

CountryCode:        1
AreaCode:        113
FAXNumber:        1.113.234.1234
LongDistancePrefix:    1
InternationalPrefix:    011
DialStringRules:    etc/dialrules
RingsBeforeAnswer:    1
SpeakerVolume:        off
GettyArgs:        ”-h %l dx_%s”
LocalIdentifier:    ”NothingSetup”
TagLineFont:        etc/lutRS18.pcf
TagLineFormat:        ”From %%l|%c|Page %%P of %%T”
MaxRecvPages:        25

Probing for best speed to talk to modem: 38400 OK.

Hmm, this looks like a Class 1 modem.
Product code (ATI0) is “Zoom V.90 USB U052099g -F Z207″.
Other information (ATI3) is “Zoom V.90 USB U052099g -F Z207″.
DTE-DCE flow control scheme [default]?
Modem manufacturer is “Zoom”.
Modem model is “2980″.

Using prototype configuration file lucent…

The modem configuration parameters are:

ModemFlowControl:    rtscts
ModemSetupDTRCmd:    AT&D3

Are these ok [yes]?

Creating new configuration file /var/spool/hylafax/etc/config.ttyACM0…
Creating fifo /var/spool/hylafax/FIFO.ttyACM0 for faxgetty… done.
Done setting up the modem configuration.

Checking /var/spool/hylafax/etc/config for consistency…
…some parameters are different.

The non-default scheduler parameters are:

CountryCode:        1
AreaCode:        113
LongDistancePrefix:    1
InternationalPrefix:    011
DialStringRules:    etc/dialrules

Are these ok [yes]?

Creating new configuration file /var/spool/hylafax/etc/config…

Should an entry be added for the FaxMaster to /etc/aliases [yes]?
Users to receive fax-related mail [root]? user@your_domain

Edit /etc/inittab
You need to add an entry at the end of the file, be sure you use the tty setting for your modem.
# Fax Modem
t2:35:respawn:/usr/sbin/faxgetty ttyACM0

Edit /var/spool/hylafax/etc/FaxDispatch
This file needs to be created to determine who the fax is sent to and to change it so it is a PDF.

SENDTO=user@your_domain;
FILETYPE=pdf;

Add users who will accept faxes.
This users should be the same ones you have entered in the FaxDispatch.
/usr/sbin/faxadduser user_name

Test the Fax
cu -l ttyACM0
Connected.
at+fclass=?
0,1,8

OK

faxstat
HylaFAX scheduler on dklinux1.klausner.com: Running
Modem ttyACM0 (1.650.367.9139): Waiting for modem to come ready

Trial Connection
The  1132341234 is the number of the Fax

sendfax -vv -n -k ‘now +1hour’ -m -d 1132341234 /etc/hosts

Trying localhost (127.0.0.1) at port 4559…
Connected to localhost.localdomain.
220 your_domain.com server (HylaFAX ™ Version 5.2.5) ready.
-> USER root
230 User root logged in.
match against (…, 219)
rule: offset 0 string = “%!” — failed (comparison)
rule: offset 0 short = 0x4d4d — failed (comparison)
rule: offset 0 short = 0×4949 — failed (comparison)
rule: offset 0 short = 0x1da — failed (comparison)
rule: offset 0 short = 0x1f1e — failed (comparison)
rule: offset 0 short = 0x1f9d — failed (comparison)
rule: offset 0 short = 0×506 — failed (comparison)
rule: offset 0 short = 0×5343 — failed (comparison)
rule: offset 0 short = 0xf702 — failed (comparison)
rule: offset 0 string = “GIF” — failed (comparison)
rule: offset 0 long = 0x59a66a95 — failed (comparison)
rule: offset 0 short = 0x1b45 — failed (comparison)
rule: offset 0 short = 0x1b25 — failed (comparison)
rule: offset 0 short = 0x1b26 — failed (comparison)
rule: offset 0 short = 0x1b2a — failed (comparison)
rule: offset 0 string = “%PDF” — failed (comparison)
rule: offset 0 string = “x T psc” — failed (comparison)
rule: offset 0 string = “begin” — failed (comparison)
rule: offset 0 string = “xbtoa” — failed (comparison)
rule: offset 0 string = “P1″ — failed (comparison)
rule: offset 0 string = “P2″ — failed (comparison)
rule: offset 0 string = “P3″ — failed (comparison)
rule: offset 0 string = “P4″ — failed (comparison)
rule: offset 0 string = “P5″ — failed (comparison)
rule: offset 0 string = “P6″ — failed (comparison)
rule: offset 0 string = “WNGZWZSS” — failed (comparison)
rule: offset 0 string = “#Inventor V” — failed (comparison)
rule: offset 0 string = “\x89PNG” — failed (comparison)
rule: offset 0 short = 0xffd8 — failed (comparison)
rule: offset 0 short = 0xd8ff — failed (comparison)
rule: offset 0 string = “#FIG” — failed (comparison)
rule: offset 0 short = 0xd0cf — failed (comparison)
rule: offset 0 ascii = — success (result postscript, rule “%F/textfmt -B -f Courier-Bold    -Ml=0.4in -p 11 -s %s >%o <%i”)
CONVERT “/usr/sbin/textfmt -B -f Courier-Bold    -Ml=0.4in -p 11 -s default > ‘/tmp//sndfaxLbELeQ’ < ‘/etc/hosts’”
Apply DisplayNumber rules to “6503679139″
–> return result “6503679139″
-> FORM PS
200 Format set to PS.
-> TYPE I
200 Type set to Image.
SEND compressed data, 6015 bytes
-> PORT 127,0,0,1,228,198
200 PORT command successful.
-> MODE Z
200 Mode set to ZIP.
-> STOT
150 FILE: /tmp/doc4.ps (Opening new data connection).
SEND 2285 bytes transmitted (2.6x compression)
226 Transfer complete (FILE: /tmp/doc4.ps).
-> JNEW
200 New job created: jobid: 4 groupid: 4.
-> JPARM FROMUSER “root”
213 FROMUSER set to “root”.
-> JPARM LASTTIME 000059
213 LASTTIME set to 000059.
-> JPARM MAXDIALS 12
213 MAXDIALS set to 12.
-> JPARM MAXTRIES 3
213 MAXTRIES set to 3.
-> JPARM SCHEDPRI 127
213 SCHEDPRI set to 127.
-> JPARM DIALSTRING “6503679139″
213 DIALSTRING set to “6503679139″.
-> JPARM NOTIFYADDR “user@your_domain.com”
213 NOTIFYADDR set to “user@your_domain.com”.
-> JPARM VRES 196
213 VRES set to 196.
-> JPARM PAGEWIDTH 209
213 PAGEWIDTH set to 209.
-> JPARM PAGELENGTH 296
213 PAGELENGTH set to 296.
-> JPARM NOTIFY “none”
213 NOTIFY set to “none”.
-> JPARM PAGECHOP “default”
213 PAGECHOP set to “default”.
-> JPARM CHOPTHRESHOLD 3
213 CHOPTHRESHOLD set to 3.
-> JPARM DOCUMENT /tmp/doc4.ps
200 Added document /tmp/doc4.ps as docq/doc4.ps.4.
-> JSUBM
200 Job 4 submitted.
request id is 4 (group id 4) for host localhost (1 file)

{ 1 comment }

Pete July 9, 2010 at 1:47 am

Great walkthrough, thanks!
Also check http://www.sertec.ca/howtos/HylaFAX-server.html

Pete

Previous post:

Next post: