Fax Integration with by sir68701


									Fax Integration with *

   Hylafax + Iaxmodem
 A more flexible approach
What is HylaFax?
HylaFAX is a telecommunication system for *NIX systems.

It supports:

•   sending facsimile
•   receiving facsimile
•   polled retrieval of facsimile
•   transparent shared data use of the modem
•   sending alpha-numeric pages

Facsimile can be any size (e.g. A4, B4), either 98 or 196 lpi, and
transmitted/received as either 1D-encoded or 2D-encoded facsimile data
(2D encoded data is frequently more compact and hence takes a shorter
time to communicate). Any modem that supports one of the standard interfaces
for facsimile operation can be used; i.e. any Class 1, Class 2, or Class 2.0
What is IAXmodem
IAXmodem is a software modem written in C
that uses an IAX channel instead of a
traditional phone line and uses a DSP
library instead of DSP hardware chipsets.

Making it an excellent application to use with
Benefits of integrating IAXmodem
   and HylaFax with Asterisk
•   Increased stability of your asterisk system by not using fax channel drivers,
    or app_txfax and app_rxfax

•   Ability to have the fax system independent of the Asterisk system

•   Flexible fax handling capabilities configurable by HylaFAX configuration

•   HylaFax is an enterprise class application with the ability to handle
    thousands of faxes a day!
Preflight Checklist
• Asterisk with IAX2 support installed.

• IAXmodem requires SPANDSP

• HylaFax requires the following additional packages
   – libtiff-3.5.5 or better
   – ghostscript-5.50 or better
   – ghostscript-fonts-5.50 or better
Next setup a user account for a virtual modem in

Setup the IAXmodem config file in

Filename - ttyIAX1

device /dev/ttyIAX1
port 4571
refresh 60
server localhost
peername iaxmodem1
secret 1234
cidname Companyx
cidnumber 4165980000
codec ulaw
Next Startup iaxmodem, a good way to start
iaxmodem for debugging purposes is to start
the iaxmodem process calling a specific
config file and placing it on a screen
session like so :

screen 00 command iaxmodem ttyIAX1
This will allow you to attach back to the
screen session and see the debug output in
To verify your specified iaxmodem is
connected and the latency is good you can
do an asterisk –rx “iax2 show peers” to see
your current iax connection stats.

Ex output

iaxmodem1/iaxmo   (D) 4571   OK (3 ms)
Next setup Hylafax,

You will have to run faxsetup first to allow
HylaFax to run its initial system config setup.

In most cases you don’t need to do anything
here so feel free to mash the enter key.
Next run faxaddmodem

You will be asked a series of questions as follows

•     Country code (1 for Canada)
•     Area code
•     Phone number of fax modem
•     Local identification string (this should be something like 'My Fax Server' as it is printed on the tag line of outgoing faxes)
•     Long distance dialing prefix (1 in US)
•     International dialing prefix (011 in US)
•     Dial string rules file (accept the default)
•     Tracing during normal server operation (accept the default)
•     Tracing during send and receive operations (accept the default)
•     Protection mode for received fax - enter 0644
•     Protection mode for session logs - enter 0644
•     Protection mode for tty - enter 0666
•     Rings to wait before answer
      Note: The default is 1 but setting it to 0 establishes your server as a "Send Only" fax system
•     Modem speaker volume (valid values are OFF QUIET LOW MEDIUM HIGH Command line arguments for getty (accept the default)
•     Pathname of TSI ACL file (accept the default)
•     Pathname of Caller-ID ACL file (accept the default)
•     Tag line font file (accept the default)
•     Tag line format string (accept the default)
•     Time before purging UUCP lock (accept the default)
•     Hold UUCP lockfile during data calls (accept the default)
•     Hold UUCP lockfile during voice calls (accept the default)
•     Percent good lines to accept (accept the default)
•     Max consecutive bad lines to accept (you may want to reduce the default 5 to 3)
•     Max number of pages to accept in a received fax (you may want to increase the default value of 25)
•     Syslog facility name for ServerTracing messages (the default is 'daemon' but you could change it to 'local7' if you're logging to a remote
      syslog server)
•     Set UID to 0 (accept default)
•     Use priority job scheduling (accept default)
Next you will want to edit the hosts.hfaxd file
(this controls what hosts can fax through HylaFax)

This is usually found in


You can add host name or ip address
or specify ranges like this .

Fax routing is setup in the file called

Ex config
SENDTO=pmullis@syx.ca;                           # by default email to FaxMaster
FILETYPE=tif;                             # in PDF format

## This excerpt from the man page gives you an idea of what's possible here
## You can route by sender's TSI

#case "$SENDER" in
#    *1*510*526*1212*) SENDTO=sam;;     # Sam's test rig in Berkeley
#    *1*415*390*1212*) SENDTO=raster@asd;; # 7L Xerox room, used for scanning
#    *5107811212)    SENDTO=peebles@mti;; # stuff from home

## and/or by device
#case "$DEVICE" in
#    ttyIAX0) SENTO=henrys@syx.ca; FILETYPE=tif;; # all faxes received on ttyS1
#    ttyLT0)       SENDTO=mary@home;; # all faxes received on ttyLT0

## and/or by caller id

case "$CALLID4" in

9053628073) SENDTO=philip.mullis@syx.ca; FILETYPE=pdf;;
9053628000) cp $FILE /var/spool/hylafax/recvq/somedir/$FILENAME.tif; chmod a+r /var/spool/hylafax/recvq/somedir/$FILENAME.tif; lpr -PAR-
     M455N /var/spool/hylafax/recvq/logistic/$FILENAME.tif;;
Asterisk Incoming Dial plan examples.
exten => 9053628073,1,Dial(IAX2/iaxmodem1)
 or set up a bank like this 

exten => 9053628073,1,SetVar(NLOGNUM=${EXTEN}) ;
exten => 9053628073,2,Goto(from-pstn,faxbank,1)

exten => faxbank,1,Dial(IAX2/iaxmodem1/${NLOGNUM})
exten => faxbank,2,Dial(IAX2/iaxmodem2/${NLOGNUM})
exten => faxbank,3,Dial(IAX2/iaxmodem3/${NLOGNUM})
exten => faxbank,4,Dial(IAX2/iaxmodem4/${NLOGNUM})
exten => faxbank,5,Dial(IAX2/iaxmodem5/${NLOGNUM})
exten => faxbank,6,Dial(IAX2/iaxmodem6/${NLOGNUM})
exten => faxbank,7,Dial(IAX2/iaxmodem7/${NLOGNUM})
exten => faxbank,8,Dial(IAX2/iaxmodem8/${NLOGNUM})
exten => faxbank,9,Dial(IAX2/iaxmodem9/${NLOGNUM})
exten => faxbank,10,Playtones(congestion)
exten => faxbank,11,Congestion
Once you are done with the configuration, start up hylafax
  (hylafax start)

You can verify that hylafax is running and the status of your
  modem(s) by executing faxstat

You should get input similar to this

HylaFAX scheduler on faxsrv1: Running
Modem ttyIAX5 (548.7550): Running and idle
Modem ttyIAX4 (548.7550): Running and idle
Modem ttyIAX10 (548.7550): Running and idle
Modem ttyIAX1 (548.7550): Running and idle
Modem ttyIAX2 (548.7550): Receiving from"<UNSPECIFIED>"
Modem ttyIAX3 (548.7550): Running and idle
Modem ttyIAX9 (548.7550): Waiting for modem to come ready
To see a history of received faxes HylaFax comes with a nifty
command called recvstats .

It will show you similar out put to this when mashed in 

Sender         CIDName          CIDNumber                   Pages    Time Pg/min Errs TypRate TypData
RightFax               <NONE>                   <NONE>                     44 26:04 1.7 0 9600 2-D MMR
Rightfax              <NONE>                   <NONE>                    132 36:43 3.6 0 9600 2-D MMR
Total                                                   18154 2:59:49 1.7 129
Sending Faxes with Hylafax
There are numerous clients available for sending faxes with HylaFax all for the various operating systems that exist

Here are some of the free/open source ones.

•    AdiXein HFC: Free software to integrate HylaFAX and Microsoft Outlook!
•    Faxfrontend: Fax from a Debian desktop.
•    Frog FaxMail: Free Windows Hylafax Client
•    GFax: GNOME Facsimile Program
•    HylaFAXSender: Java fax client, tested on Mac OS X and Linux.
•    hylafront: Windows/*nix java based advanced gui client
•    hylapex: A multi-platform client written in python
•    IGSuite Integrated Groupware Suite
•    JHylaFAX: Sleek platform independent client written in Java
•    Khylafax
•    Macflex
•    Pyla: A multi-platform client Written in Python with Ldap integration.
•    Respond/PrintFax
•    SDfax: Mac software to send fax via TPC.int, which uses HylaFAX.
•    Sambafax
•    Smbfax: Print to a faxmodem on your Samba server via HylaFAX.
•    SpoolFax: A middleware for faxing from applications
•    Susefax: Java client to HylaFAX, is part of the SuSE Linux distribution.
•    Tkhylafax
•    WHFC: A windows client for HylaFAX
•    W2hfax: Client for Windows 95/98 and NT 4.0.
•    Winflex: 16-bit fax client for the Windows 3.11 platform, but note it uses the old protocol.
•    Winprint HylaFAX: A simple-to-use Windows printer client
•    YajHFC: Yet another Java HylaFAX client
 Quick Setup of a Windows Fax Client
The easiest cleint to setup outbound faxingthat I have
found is Winprint HylaFAX

You can download the package from

Next, you'll be asked what port to use. Select the radio button "create a new
port type." If the installation went well, you should see "Winprint Hylafax" as
one of the options. The drop list might scroll, so it may not be obvious that it's at
the bottom of the list. (If it doesn't appear on the list at all, something went
wrong with your installation.)
Next, a box will pop up for you to name the port. The name doesn't actually
matter, but naming it HFAX1: will help to identify it.
Next, select the printer type. Experience has shown that the Apple
LaserWriter12/640 PS is a good choice.
Of course, name it whatever you want, preferably
something that says, "hey, this is going to a FAX machine."
Do not share the printer. This is rather silly anyway, since you can locally install
Winprint HylaFAX on any system that needs it, and it communicates directly
with the HylaFAX server. Since it pops up the dialog box asking where to send
the FAX job locally, this would be ugly, at best. Also, don't print a test page,
since you're not done configuring the printer yet.

Right-click on the printer to call up its properties, and select the "Ports" tab.
Locate the port you just created.
Press the "Configure Port" button to configure the connection to your HylaFAX server.
Most people who have problems are going to have problems because their HylaFAX server won't let
them connect. Break out your HylaFAX server documentation, and make sure that you have set up the
correct permissions, which can be as simple as putting the IP address of your client into
/var/spool/fax/etc/hosts.hfaxd. You may not need the username -or- password, in which case, you can
leave password blank, but the username is always required, even if it isn't authenticated.

Okay, now you're ready to print a test job. When you send anything to this printer, a dialog box will
•   https://sourceforge.net/projects/iaxmodem
•   http://www.hylafax.org/
•   http://www.asterisk.org/
•   http://winprinthylafax.sourceforge.net/
Thank you for your time now lets hit
         Tobys for beer

To top