Installing FAX on FreePBX (Hylafax + IAXModem)

Hi. I went into some trouble to get a fax service working on my Asterisk with FreePBX system. So I compiled the notes that might help other people get it working.

Download, Install and compile Hylafax and IAXModem

Install Hylafax, but do not run faxaddmodem. Use config.ttyIAX that comes with IAXModem and copy to /var/spool/hylafax/etc/ (in my case, ttyIAX0)

Copy iaxmodem to /usr/bin/iaxmodem
mkdir /etc/iaxmodem
create /etc/iaxmodem/ttyIAX0 with content:

device /dev/ttyIAX0
owner uucp:uucp
mode 660
port 4570
refresh 300
server 127.0.0.1
peername 8006
secret fax7012
codec ulaw

Add to iaxmodem and faxgetty to inittab:

echo “IA00:23:respawn:/usr/bin/iaxmodem ttyIAX0” >> /etc/inittab
echo “mo00:23:respawn:/usr/sbin/faxgetty ttyIAX0” >> /etc/inittab

Set up logs:
mkdir /var/log/iaxmodem/
touch /var/log/iaxmodem/ttyIAX0
touch /var/log/iaxmodem/iaxmodem

Restart box to test startup config.

In FreePBX, create an IAX Extension for the fax, using:

secret 12345
notransfer yes
context from-internal
host dynamic
type friend
port 4571
qualify yes
disallow all
allow law
dial IAX/8006
deny 0.0.0.0/0.0.0.0
permit 0.0.0.0/0.0.0.0
requirecalltoken no

or for outgoing only create in extenions_custom.con:

[8006]
type=friend
host=dynamic
auth=md5
secret=12345
context=from-internal
sendani=yes
disallow=all
allow=ulaw
jitterbuffer=no
requirecalltoken=no
trunk=no

Set up /etc/hylafax/etc/FaxDispatch :

SENDTO=FaxMaster; # by default email to FaxMaster
FILETYPE=pdf; # in PDF format
SENDTO=[your e-mail];

Make sure faxgetty is running:

ps aux | grep faxgetty

uucp 5657 0.0 0.0 25616 1532 ? Ss Oct02 0:00 /usr/sbin/faxgetty ttyIAX0

And IAXModem:

ps aux | grep iaxmodem

uucp 3471 0.0 0.0 17716 1092 pts/0 Ss+ Oct01 0:02 /usr/bin/iaxmodem ttyIAX0

Make sure the IAX registred on asterisk on the CLI with show iaxs peers and watch the CLI for activity.

To test use

sendfax -n -d faxnumber file.txt

and monitor using the CLI and

faxstat -s

Reference:
http://www.the-asterisk-book.com/unstable/faxserver-mit-iaxmodem-und-hylafax.html
http://iaxmodem.sourceforge.net/howto.php

While this doesn’t answer your question, you will have much better results using Fax-for-Asterisk, by Digium

Great article fabiolr!
Been looking for FreePBX and iaxmodem guide on the net but not too many, mostly just asterisk. Yours is the best. Running Asterisk 1.6 and FreePBX 2.8 with Optware on a stock Pogoplug and Dockstar (thought I couldn’t do this one but got it at 94Mb). So I tried your setup on a pc first with hylafax and iaxmodem. Only thing I changed was the extension port at 4569 (I’m lazy, so I kept the default) and matched the passwords. Then I installed iaxmodem on the plugs with efax (to conserve memory). Worked like a charm and rock solid after going through a faxing frenzy. Worked on some 10 year old fax machines. Don’t really have options with FFA since need to compile software for the plug, so had to stick with open source.