Hylafax How TO
That would be great to put in the wiki
Kerry Garrison
Sr. Product Manager, trixbox
http://voipspeak.net - http://asterisktutorials.com
I already created some basic info under Tutorials ;) - it would probably be best to add your info to a new page under here:
http://forge.trixbox.org/gf/project/trixbox2/wiki/?section=projec...
The wiki is awesome!
Here's the start of it... I just haven't had time to make a step by step, but I will do that later on. But this will definitely help you!
Setup Build Dirs
cd /usr/src/
wget http://ksp.ca/asterisktools/hylafax-4.3.3-1rhel4.i386.rpm
yum -y install ghostscript
yum -y install sharutils
yum -y install mgetty-voice
ln -s /usr/share/fonts/default/ghostscript/ /usr/share/ghostscript/fonts
yum -y install iaxmodem
HylaFax Install
rpm -ivh hylafax-4.3.3-1rhel4.i386.rpm
Configure Hylafax
I answered yes or the default to everything except AreaCode and: Do you want to run faxaddmodem to configure a modem [yes]? no
/usr/sbin/faxsetup
Configure Asterisk (FreePBX)
Edit iax.conf (through FreePBX)
Log into the FreePBX control panel with your browser and Click:
Setup -> Extensions -> IAX2
And enter the following:
Extension Number: 1100
Display Name: IAXModem
Record Incoming: Never
Record Outgoing: Never
Secret: password
Perform this step once for each channel on which you wish to receive faxes. Changing the extension number each time. The example above uses a single channel and a single extension: 1100
Don't Forget Click Submit and then the red bar at the top!
Edit extensions.conf (through FreePBX)
Now configure asterisk to use this extension for faxes:
Setup -> General Settings -> Fax Machine -> Extension of fax machine
Select 'system' to have the system receive and email faxes.
Selecting 'disabled' will result in incoming calls being answered more
quickly. for receiving faxes: IAXModem <1100>
Don't Forget Click Submit Changes and then the red bar at the top!
Edit extensions.conf (through SSH)
I also had to append this line to the from-zaptel context. Apparently it doesn't ship with a fax extension. The from-pstn context does ship with a fax extension, but my config uses from-zaptel by default. Go figure.
exten => fax,1,Goto(ext-fax,in_fax,1)
Configure IAXModem
Edit Config Files
Change the 'peername' value from 'iaxmodem' to '1100' (this is the extension we created in the last step):
cd /etc/iaxmodem
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX0
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX1
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX2
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX3
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX0
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX1
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX2
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX2
You need a config file for each Zaptel channel on which you wish to receive faxes. The iaxmodem RPM sets up only one config file by default.
Setup Logs
make sure it can log properly:
mkdir /var/log/iaxmodem
touch /var/log/iaxmodem/iaxmodem-cfg.ttyIAX0
touch /var/log/iaxmodem/iaxmodem-cfg.ttyIAX1
touch /var/log/iaxmodem/iaxmodem-cfg.ttyIAX2
touch /var/log/iaxmodem/iaxmodem-cfg.ttyIAX3
Add faxgetty to /etc/inittab
These correspond to the device lines in the /etc/iaxmodem/* config files. (see previous step, above) I only have an X100p single line card, so I'm just adding one line:
nano /etc/inittab
You need one of these for each channel, so a T1/PRI would require 23 lines. The last argument to faxgetty ('ttyIAX' in this case) is the device name (i.e. /dev/ttyIAX) on which to connect to iaxmodem.
Configure HylaFax
There are a number of important files used by Hylafax. Most of them live in the /var/spool/hylafax/etc directory.
cd /var/spool/hylafax/etc
Create the necessary files and permissions for incoming fax reporting:
touch xferfaxlog
chown uucp:uucp xferfaxlog
FaxDispatch
One of the most important files is the FaxDispatch script.
Simple single E-Mail FaxDispatch example
Here is a simple example that routes faxes to my email address:
vim FaxDispatch
# ---------------- Start FaxDispatch Example 1 --------------------
FILETYPE=pdf;
SENDTO=jesse@guardiani.us;
# ---------------- Stop FaxDispatch Example 1 ---------------------
Inbound DID routing FaxDispatch example
More complex examples, such as inbound DID routing to separate email addresses, you can use something like the following:
# ---------------- Start FaxDispatch Example 2 --------------------
#!/bin/sh
##
## FaxDispatch
## (see `man faxrcvd` for more info)
FILETYPE=pdf;
SENDTO=fax@guardiani.us; # default
# The numbers before the paren correspond to asterisk extensions in
# extensions.conf
case "$CALLID4" in
# customer DID routing:
99995953033) SENDTO=someoneelse@guardiani.us; FILETYPE=pdf;;
99995953133) SENDTO=jesse@guardiani.us; FILETYPE=pdf;;
# everything else goes to default case:
*) SENDTO=fax@guardiani.us; FILETYPE=pdf;;
esac
# ---------------- Stop FaxDispatch Example 2 ---------------------
In order for the above complex DID routing example to work, the inbound DID has to be passed to IAXModem and show up in the CALLID4 variable. To facilitate this, try replacing the following line in extensions.conf:
exten => analog_fax,3,Dial(${DIAL},20,d)
with this:
exten => analog_fax,3,Dial(${DIAL}/${CALLERID(number)},20,d)
In the above example, an inbound DID of 99995953133 should result in an email to jesse@guardiani.us, whereas an inbound DID of 99995953033 should result in an email to someoneelse@guardiani.us, and everything else results in an email to fax@guardiani.us.
NOTE: The inbound DID example is largely untested on trixbox. I have it working on a T1 PRI with normal asterisk + iaxmodem (no trixbox - different OS), but this example has been regurgitated purely from memory and is untested. Feel free to contact me (mailto://jesse@guardiani.us) if you have any problems and I'll try to help you solve them.
cd /var/spool/hylafax/etc
nano config.ttyIAX
cp config.ttyIAX config.ttyIAX0
cp config.ttyIAX config.ttyIAX1
cp config.ttyIAX config.ttyIAX2
cp config.ttyIAX config.ttyIAX3
Another important file is the config.ttyIAX file. This file tells the faxgetty daemon(s) how to communicate with the iaxmodem /dev/ttyIAX* files.
chown uucp:uucp config.ttyIAX0
chown uucp:uucp config.ttyIAX1
chown uucp:uucp config.ttyIAX2
chown uucp:uucp config.ttyIAX3
You'll need one config.ttyIAX* file for each faxgetty instance.
Finish Up
Start Up IAXModem
/etc/init.d/iaxmodem start
See if it's running:
ps auxwww | grep iax
if not, check the log:
tail -f /var/log/iaxmodem/iaxmodem
tail -f /var/log/iaxmodem/iaxmodem-cfg.ttyIAX3
Start Up Faxgetty
Tell init to reload it's config (this starts faxgetty):
telinit q
Make sure faxgetty is running:
ps auxwww | grep faxget
Make sure it's communicating with iaxmodem properly (i.e. no errors):
tail -f /var/log/messages
Verify E-Mail Traffic
You can also check the sendmail log to verify that emails are being sent as expected:
tail -f /var/log/maillog
Here is an example of a successful fax email log:
Oct 18 17:15:34 asterisk1 sendmail[17145]: k9ILFYxx017145: from=
Oct 18 17:15:34 asterisk1 sendmail[17123]: k9ILFXIg017123: to=jesse@guardiani.us, delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=97313, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (k9ILFYxx017145 Message accepted for delivery)
Oct 18 17:15:34 asterisk1 sendmail[17147]: STARTTLS=client, relay=mail.guardiani.us., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Oct 18 17:15:35 asterisk1 sendmail[17147]: k9ILFYxx017145: to=
Reporting
Now test some fax calls and you're done! You can use the following command to view a report of the faxes you receive:
recvstats
that looks really good, just wondering - for the faint of heart - I think all the yum/rpm install stuff can be done through the Trixbox Package Manager - unless the versions are behind there, wouldnt that be best way - kerry?? bubba?? - will installing the Hylafax package intstall all the dependencies?
I think most parts could be from the package manager, but you won't be able to do the rest of the install without going to telnet session anyway, so if you aren't comfortable with that you shouldn't attempt this install. The yum commands are probably the simplest part of the whole install...
Take a look at this:
http://www.guardiani.us/index.php/TrixBox_IAXModem_HylaFax
This was discussed previously on this board. I successfully used these instructions on TB 1.2.3. I don't know if anything changes related to TB 2.0 though.
Ya I know - at some point people would need to hit the terminal, but just thinking of ways to simplify - and make sure that dependencies are handled with the right versions - and all that. Besides that, I think the package manager would have versions that have been tested with trixbox.
Package manager for the more part just uses yum anyway. I don't think it's a big deal either way really.
As for where I started building this, the link above was of GREAT help, I definitely have to give credit to them, I had to change a few things for trixbox 2.0 but 2/3 of the credit definitely goes to them.
Hi,
The wiki link doesn't seemed to work.
By the way, my TrixBox version is 2.2.4. Is this instruction valid for it? I've also noticed in the TrixBox package manager that there is a module for Hylafax + IAX modem. However, I can't seem to find documentation about it. Maybe it is in the wiki which is not working.
Thanks for any heads up information.
Hi
Thanks for the nice write-up.
But I need to install 6 IAXmodems on my Trixbox Server.
I did follow your steps, but I can't get it to start up 6 modems.
Only 1 modem start up. Maybe you can help me with this problem.
Here are the log files:
[mycomaxtest.dyndns.org etc]# ps auxwww | grep faxget
uucp 3943 0.0 0.1 4884 1868 ? Ss 09:19 0:00 /usr/sbin/faxgetty ttyIAX
root 4355 0.0 0.0 3888 672 pts/0 R+ 09:22 0:00 grep faxget
[mycomaxtest.dyndns.org etc]# ps auxwww | grep iax
root 3984 0.0 0.0 2852 408 ? Ss 09:19 0:00 /usr/sbin/iaxmodem
uucp 3985 0.0 0.0 2968 904 ? S 09:19 0:00 /usr/sbin/iaxmodem
uucp 3986 0.0 0.0 2968 880 ? S 09:19 0:00 /usr/sbin/iaxmodem
uucp 3987 0.0 0.0 2968 880 ? S 09:19 0:00 /usr/sbin/iaxmodem
uucp 3988 0.0 0.0 2968 880 ? S 09:19 0:00 /usr/sbin/iaxmodem
uucp 3989 0.0 0.0 2968 880 ? S 09:19 0:00 /usr/sbin/iaxmodem
uucp 3990 0.0 0.0 2968 880 ? S 09:19 0:00 /usr/sbin/iaxmodem
root 4358 0.0 0.0 3892 676 pts/0 R+ 09:23 0:00 grep iax
[mycomaxtest.dyndns.org etc]# tail -f /var/log/messages
May 20 09:22:30 mycomaxtest init: /etc/inittab[57]: duplicate ID field "iax"
May 20 09:22:30 mycomaxtest init: /etc/inittab[58]: duplicate ID field "iax"
May 20 09:22:30 mycomaxtest init: /etc/inittab[59]: duplicate ID field "iax"
May 20 09:22:30 mycomaxtest init: /etc/inittab[60]: duplicate ID field "iax"
May 20 09:22:30 mycomaxtest init: /etc/inittab[63]: duplicate ID field "t2"
May 20 09:22:30 mycomaxtest init: /etc/inittab[64]: duplicate ID field "t2"
May 20 09:22:30 mycomaxtest init: /etc/inittab[65]: duplicate ID field "t2"
May 20 09:22:30 mycomaxtest init: /etc/inittab[66]: duplicate ID field "t2"
May 20 09:22:30 mycomaxtest init: /etc/inittab[67]: duplicate ID field "t2"
May 20 09:22:30 mycomaxtest init: Id "iax" respawning too fast: disabled for 5 minutes
Thanks
I'm still working on getting a config where I can perform email to fax via outlook, exchange 2003 and hylafax. We currently use a product call GFI Faxmaker to integrate faxing into outlook/exchange.
I'd be willing to put up a bounty to make this work if someone was willing to help me out. I have a copy of the email that exchange sends out, it's just a matter of getting hylafax to read it and setup the fax....



Member Since:
2007-02-16