Professional Documents
Culture Documents
This howto is for Trixbox 1.1.1 (which is based on CentOS 4.4) It should work through at least Trixbox 2.6.1.13. Please let me know if it doesn't. Also, please note that this Howto assumes that your connection to the PSTN network is clean, free of static, free of echo, and sounds good when using a phone. If it's not, don't be surprised if faxing doesn't work. For analog lines and Zaptel hardware, there are things you can change that might help (i.e. RX/TX gain), but tuning an analog card is completely outside the scope of this howto.
Contents
[hide]
1 Getting Started o 1.1 Got Root? o 1.2 Setup Build Dirs o 1.3 Download Software o 1.4 Download Third Party RPM (if you dare) o 1.5 Satisfy HylaFax Deps o 1.6 Satisfy Unspoken HylaFax Deps o 1.7 HylaFax Install o 1.8 Configure Hylafax o 1.9 IAXModem Install 2 Configure Asterisk (FreePBX) o 2.1 Edit iax.conf (through FreePBX) o 2.2 Edit extensions.conf (through FreePBX) o 2.3 Edit extensions.conf (through SSH) 3 Configure IAXModem o 3.1 Edit Config Files o 3.2 Setup Logs o 3.3 Add faxgetty to /etc/inittab 4 Configure HylaFax o 4.1 FaxDispatch 4.1.1 Simple single E-Mail FaxDispatch example 4.1.2 Inbound DID routing FaxDispatch example o 4.2 config.ttyIAX 5 Finish Up o 5.1 Start Up IAXModem o 5.2 Start Up Hylafax o 5.3 Add Automatic Log Rotation for IAXModem logs
o o o
Getting Started
Got Root?
su -
Download Software
For latest HylaFax builds see here: ftp://ftp.hylafax.org/binary/linux/redhat/RPMS/i386/
wget 'ftp://ftp.hylafax.org/binary/linux/redhat/RPMS/i386/hylafax-4.3.02rhel4.i386.rpm'
HylaFax Install
rpm -Uvh hylafax-4.3.0-2rhel4.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
IAXModem Install
rpm -Uvh iaxmodem-0.1.14-1.i386.rpm
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!
Don't Forget Click Submit Changes and then the red bar at the top!
Configure IAXModem
Edit Config Files
Change the 'peername' value from 'iaxmodem' to '1100' (this is the extension we created in the last step), also change the secret to reflect FreePBX extension secret:
vi /etc/iaxmodem/iaxmodem-cfg.ttyIAX
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.ttyIAX
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 if you have any problems and I'll try to help you solve them.
config.ttyIAX
Another important file is the config.ttyIAX file. This file tells the faxgetty daemon(s) how to communicate with the iaxmodem /dev/ttyIAX* files. Here is an example:
# ---------------- Start config.ttyIAX Example -------------------CountryCode: 1 AreaCode: 423 FAXNumber: 1.111.111.1111 # replace this with a real phone number LongDistancePrefix: 1 InternationalPrefix: 011 DialStringRules: etc/dialrules ServerTracing: 0xFFF SessionTracing: 0xFFF RecvFileMode: 0600 LogFileMode: 0600 DeviceMode: 0600 RingsBeforeAnswer: 1 SpeakerVolume: off GettyArgs: "-h %l dx_%s" LocalIdentifier: "IAXmodem" TagLineFont: etc/lutRS18.pcf TagLineFormat: "From %%l|%c|Page %%P of %%T" MaxRecvPages: 600 # # # Modem-related stuff: should reflect modem command interface
# and hardware connection/cabling (e.g. flow control). # ModemType: Class1 # use this to supply a hint # # The modem is taken off-hook during initialization, and then # placed back on-hook when done to prevent glare. # ModemResetCmds: "ATH1\nAT+VCID=1" # enables CallID display ModemReadyCmds: ATH0 Class1AdaptRecvCmd: Class1TMConnectDelay: Class1RMQueryCmd: well AT+FAR=1 400 # counteract quick CONNECT response "!24,48,72,96" # V.17 fast-train recv doesn't work
CallIDPattern: "NMBR=" CallIDPattern: "NAME=" CallIDPattern: "ANID=" CallIDPattern: "NDID=" # Uncomment these if you really want them, but you probably don't. #CallIDPattern: "DATE=" #CallIDPattern: "TIME=" #20060302 JDG - Fix for broken libtiff JBIG support in tiff2pdf Class1JBIGSupport: no # ---------------- Stop config.ttyIAX Example ---------------------
Finish Up
Start Up IAXModem
service iaxmodem start
Start Up Hylafax
service hylafax start
See if modems are up and recognized (give a few secs for init)
faxstat -s
Check the logs to verify proper operation and registration of iaxmodem to asterisk (verify that there are no registration errors in the log):
tail -f /var/log/iaxmodem/iaxmodem-cfg.ttyIAX tail -f /var/log/iaxmodem/iaxmodem
Start Up Faxgetty
Tell init to reload it's config (this starts faxgetty):
telinit q
Oct 18 17:15:34 asterisk1 sendmail[17145]: k9ILFYxx017145: from=<fax@asterisk1.local>, size=67575, class=0, nrcpts=1, msgid=<200610182115.k9ILFXIg017123@asterisk1.local>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1] 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=DHERSA-AES256-SHA, bits=256/256 Oct 18 17:15:35 asterisk1 sendmail[17147]: k9ILFYxx017145: to=<jesse@guardiani.us>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=187575, relay=mail.guardiani.us. [192.168.88.97], dsn=2.0.0, stat=Sent (ok 1161206135 qp 10280)
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