trixbox-, Postfix, Iaxmodem 1.1.1, Hylafax+ 5.2.5, Avantfax 3.1.3


trixbox-, Postfix, Iaxmodem 1.1.1, Hylafax+ 5.2.5, Avantfax 3.1.3
其实这个例子完全可以在elastix, freepbx 上面玩。

I owe a lot to the guides of Lamarmora, Kspare & Giuliano for this compilation.
avantfax = web interface
hylafax = fax software
iaxmodem = software modem
My starting point was a SOHO functional TB 2.6.1
As always, please don’t use my step-by-step guide straight on yourworking box, but try it first on a spare one! Differences in hardwaremay account for appropriate adjustments.
Major steps of installations:
1. Install necessary packages
2. Install POSTFIX if not your default, skip if you prefer SENDMAIL
a. Configure postfix
3. UPGRADE TO PHP5 if necessary
4. Update system to the latest stable versions (Don’t do that unless you’re a master in passwords changes)
5. Install Hylafax +
6. Install IAXMODEM
a. Configure Trixbox
i. Configure Asterisk IAX2 fax Extension
ii. Configure asterisk to use this extension for faxes
iii. Configure route
b. Configure IAXModem
c. Configure Hylafax
7. Verifying functionality
8. Install Avanfax
9. Avantfax configuration
10. Testing
1) Install necessary packages
Can be done in a single row writings: yum -y install package package ….
For clarity they are written separately.
yum -y install ghostscript
yum -y install sharutils
yum -y install mgetty-voice
yum -y install gcc*
yum -y install make
yum -y install iaxmodem
yum -y install ImageMagick
yum -y install libtiff
yum -y install netpbm-progs
yum -y install netpbm
yum -y install libungif
yum -y install sudo
yum -y install a2ps
yum -y install psutils
yum -y install expect
yum -y install php-pecl-Fileinfo
yum -y install php-devel
pear install MDB2_driver_mysql
pear install db mail Mail_Mime
pear upgrade-all
pear channel-update
ln -s /usr/share/fonts/default/ghostscript/ /usr/share/ghostscript/fonts
Skip this step if you have working Sendmail.
Skip this step if you have Posfix installed.
rpm -e –nodeps sendmail (removal of sendmail)
yum -y install postfix
Configure postfix
Can be done manually, or via webmin
vi /etc/postfix/
insert this line:
relayhost = (use your smtp server)
check that all the other lines with “relayhost=xyz….” are commented out.
close an save /etc/postfix/
service postfix start
Authentication in Postfix the simplest way
[url=][/url] [by Vrillusions]
For those that need to authenticate.
Go to the trixbox admin then choose Settings -> General Settings.
Enter all the mail information there: your-SMTP-server .
Authorization name your-mail-user-name
Password: your-mail-password
After it saves go into console and type the following:
postmap /etc/postfix/saslpasswd
This will build the /etc/postfix/saslpasswd.db file that postfix needs.
Then do
/etc/init.d/postfix restart
to restart postfix which will trigger it trying to send all messages in its queue.
Just remember if you change something in the general settings you have to rerun postmap
Skip if you’ve PHP5 ( e.g. TB 2.6.xx)
vi /etc/yum.repos.d/CentOS-Base.repo
Go to ” and centosplus” and change “enable=0″ to enable=1
yum upgrade php
ln -s /usr/lib/php/modules/* /usr/lib/php4/
mysql_fix_privilege_tables –user=root –password=passw0rd
chown -R asterisk:asterisk /var/lib/php/session
vi /etc/yum.repos.d/CentOS-Base.rep
Go to ” and centosplus” and set back “enable=1” to enable=0
4) Update system to the latest stable versions
Again you’re forewarned, don’t do that unless familiar with theintricate password system and knows how to revert to your passwords, asupdating creates havoc with the system passwords which are dispersedall over, several of them return to defaults!!!
yum –y update
Anyone who follows this tutorial, if you are prone to doing yum updatesyou must exclude hylafax because the box may try to over write hylafax+
Now download the latest binaries
cd /usr/src
wget [url=][/url]
rpm -i hylafax-5.2.5-1.el5.rf.i386.rpm
cd /usr/src
Now download the latest binaries
wget [url=]…[/url]
tar zxvf iaxmodem-1.1.1.tar.gz
cd iaxmodem-1.1.1
./build static
cd /usr/sbin
mv iaxmodem iaxmodemold
cp /usr/src/iaxmodem-1.1.1/iaxmodem iaxmodem
ln -s /usr/share/fonts/default/ghostscript/ /usr/share/ghostscript/fonts
Configurations done in Trixbox:
Configure Asterisk Extension
Edit the iax.conf (through FreePBX) web GUI
Log into the FreePBX control panel with your browser and Click:
Setup -> Extensions -> IAX2 (create a new IAX2 extension)
And enter the following:
Extension Number: 9001 ( 9001 [my chosen number, chose what’s suitable for you] and go up to as many extensions as you need.)
Display Name: Digital Modem 1 (chose whatever name which suits you)
Record Incoming: Never
Record Outgoing: Never
Secret: extension-password
Perform this step once for each channel on which you wish to receivefaxes changing the extension number each time. The example above uses asingle channel and a single extension: 9001
Don’t Forget Click Submit and then the red bar at the top!
Finishing this step the Fax extension should show as follows:
Display Name: Digital Modem 1
Extension Number: 9001
secret your_password
notransfer yes
context from-internal
host dynamic
type friend
port 4570 (should be entered/changed in accordance with IAXMODEN settings, explained there)
qualify yes
disallow all
allow slinear (or alaw, must match IAXMODEN configuration)
dial IAX2/9001
mailbox 9001@device
Record Incoming: Never
Record Outgoing: Never
Configure asterisk to use this extension for faxes:
PBX Settings -> Setup -> General Settings -> Fax Machine ->Extension of fax machine Extension of fax machine for receiving faxes:Digital Modem 1 <9001>
Don’t Forget Click Submit Changes and then the red bar at the top!
Configure route
In my case the simplest – any DID / any CID
Fax extension 9001
Fax email (blank)
Fax detection type None
Clear destination IVR MainMenu
Configure IAXModem
You need a config file for each Zaptel channel on which you wish toreceive faxes. The iaxmodem RPM sets up only one config file by default.
Edit Config Files (using vi nano or from shell through WinSCP )
device /dev/ttyIAX1 (edit each file to reflect the device, IE. ttyIAX1 would go in iaxmodem-cfg.ttyIAX1 etc.
cd /etc/iaxmodem
nano iaxmodem-cfg.ttyIAX
owner uucp:uucp
mode 660
port 4570 (should be the same on the corresponding IAX2 fax extension)
refresh 60 (you can leave 300 but you’ll get nasty messages on”/var/log/asterisk/full”)
peername 9001 (change this to your corresponding IAX2 extension # )
secret your-password (iax2 password you used when you created the extension)
cidname CUSTOMER (Customer name)
cidnumber CUSTOMER-NUMBER (Customer fax number)
codec slinear (leave this recommended but for some countries you canuse alaw, don’t forget to put the same codec in the IAX2 fax extensionin your TrixBox!
cd /etc/iaxmodem
(copy default base configuration to iaxmodem devices as many as defined
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX1
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX2
cp iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX3

edit each for suitable corresponding parameters:
peername (change this to your corresponding IAX2 extension # etc)
secret (iax2 password you used when you created the extension)
cidname (Customer name)
cidnumber (Customer fax number)
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX1
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX2
nano /etc/iaxmodem/iaxmodem-cfg.ttyIAX3

Setup Logs
make sure it can log properly:
mkdir /var/log/iaxmodem
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).
You need one of these for each channel, so a T1/PRI would require 23lines. The last argument to faxgetty (‘ttyIAX’ in this case) is thedevice name (i.e. /dev/ttyIAX) on which to connect to iaxmodem.
I put these at the very bottom:
nano /etc/inittab
t0:23:respawn:/usr/sbin/faxgetty ttyIAX1
t1:23:respawn:/usr/sbin/faxgetty ttyIAX2
t2:23:respawn:/usr/sbin/faxgetty ttyIAX3

Configure Hylafax
There are a number of important files used by Hylafax. Most of them reside in the /var/spool/hylafax/etc directory.
Create the necessary files and permissions for incoming fax reporting:
cd /var/spool/hylafax/etc
touch xferfaxlog
chown uucp:uucp xferfaxlog
Enter appropriate parameters, mostly yes or default to:
Do you want to run faxaddmodem to configure a modem [yes]? no
It can be done also by editing the hylafax iax settings. You onlyneed to edit the top to reflect your fax numbers in the base file andcopy it out the suitable number of times.
nano /var/spool/hylafax/etc/config.ttyIAX
CountryCode: 1 (put your country code)
AreaCode: 306 (put your area code, omit preceding zero)
FAXNumber: +1.306.555.1212 (put your fax number)
LongDistancePrefix: 1 (put your NDD Prefix (National Direct Dialing))
InternationalPrefix: 011 (put your appropriate IDD Prefix (International Direct Dialing))
DialStringRules: etc/dialrules
ServerTracing: 0xFFF
SessionTracing: 0xFFF
RecvFileMode: 0600
LogFileMode: 0600
DeviceMode: 0600
RingsBeforeAnswer: 1
SpeakerVolume: off
GettyArgs: “-h %l dx_%s”
LocalIdentifier: “Your Customer”
TagLineFont: etc/lutRS18.pcf
TagLineFormat: “From %%l|%c|Page %%P of %%T”
MaxRecvPages: 200
cd /var/spool/hylafax/etc
nano config.ttyIAX
cp config.ttyIAX config.ttyIAX1
cp config.ttyIAX config.ttyIAX2
cp config.ttyIAX config.ttyIAX3

chown uucp:uucp config.ttyIAX1
chown uucp:uucp config.ttyIAX2
chown uucp:uucp config.ttyIAX3

FaxDispatch file
One of the most important files is the FaxDispatch script.
Edit fax dispatch file to control where the faxes are emailed to,you’ve to create it as it doesn’t exist in the default installation.This file is not needed if you intend to install Avantfax
nano /var/spool/hylafax/etc/FaxDispatch; # by default email to FaxMaster
FILETYPE=pdf; # in PDF format
## and/or by device
#case “$DEVICE” in
# ttyS1) SENDTO=john;; # all faxes received on ttyS1
# ttyLT0) SENDTO=mary@home;; # all faxes received on ttyLT0
You can also edit it to forward faxes based on the device.
Simple single E-Mail FaxDispatch example
Here is a simple example that routes faxes to my email address:
# —————- Start FaxDispatch Example 1 ——————–
# —————- Stop FaxDispatch Example 1 ———————
More complex examples, such as inbound DID routing to separate email addresses can be tailored.
chown uucp:uucp FaxDispatch
Modify how faxes are sent
chkconfig iaxmodem on
nano /var/spool/hylafax/bin/faxrcvd
TIFF2PS=tiff2ps (address errors are sent to) (address faxes appear to come from
Finish Up
7) Verifying functionality
Start Up IAXModem:
service iaxmodem start
check the log:
tail -f /var/log/iaxmodem/iaxmodem
tail -f /var/log/iaxmodem/iaxmodem-cfg.ttyIAX1
Start Up Faxgetty:
telinit q
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
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 – will display some fax stats
cd /anywhere_you_untarred_the_sources/avantfax-3.1.3 (download the latest version)
chown -R asterisk:asterisk avantfax
mv avantfax /var/www/html/
mysql -uroot -ppassw0rd < create_user.sqlmysql -uavantfax -pd58fe49 avantfax < create_tables.sqlcd /var/www/html/avantfax/includes/cp -a local_config-example.php local_config.phpvi local_config.phpand change "$dft_config_lang = "en";" to your languagechmod -R 777 /var/www/html/avantfax/tmpchmod -R 777 /var/www/html/avantfax/faxescd /var/spool/hylafax/binmv faxrcvd faxrcvd.oldmv notify notify.oldln -s /var/www/html/avantfax/includes/faxrcvd.php /var/spool/hylafax/bin/faxrcvdln -s /var/www/html/avantfax/includes/notify.php /var/spool/hylafax/bin/notifymv /usr/bin/faxcover /usr/bin/faxcover.oldln -s /var/www/html/avantfax/includes/faxcover.php /usr/bin/faxcover/usr/sbin/faxadduser -a your-asterisk-password asterisk/usr/sbin/faxdeluser localhost/usr/sbin/faxdeluser >> /var/spool/hylafax/etc/hosts.hfaxd
vi /etc/sudoers
and add the following line (all on one line, best – cut and past):
asterisk ALL = NOPASSWD: /sbin/reboot, /sbin/halt, /usr/sbin/faxdeluser, /usr/sbin/faxadduser -u * -p * *
vi /etc/crontab
and add the following 2 lines:
0 * * * * /var/www/html/avantfax/includes/phb.php
0 0 * * * /var/www/html/avantfax/includes/remold.php
To avoid “Fatal error: Call to a member function get_name() on a non-object in /var/www/html/avantfax/sendfax.php on line …”
You must set register_globals to off ( php.ini )
Edit both of your php.ini
and change:
and restart apache
apachectl restart
To access Avantfax for the first time use
user: admin
password: password (you’ll be asked to change it to a strong password on first logging)
Now point your browser to:
and configure a user for AVANTFAX
and then to
to login with the user you just created.
Using Avantfax you can only attach PostScript (.ps), PDF (.pdf), andTIFF (.tif) files for faxing, otherwise you’ve to convert to either ofthese formats or use some other solution such as Hylafax client orSambafax.


打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022年 8月 26日 下午3:26
下一篇 2022年 8月 26日 下午3:27



您的电子邮箱地址不会被公开。 必填项已用*标注



在线咨询: QQ交谈