[Asterisk-Users] txfax application problem

Philip Edelbrock phil at netroedge.com
Wed Jan 25 17:31:37 MST 2006



Jeff Herring wrote:
> would you care to share with the list your installation procedure
> and configuration files associated with your iaxmodem and hylafax
> installation alongside asterisk?

Sure!  Some things, I'm sure, could use improvement, but this is working 
for me:

Get iaxmodem: https://sourceforge.net/projects/iaxmodem

You need libiax2 and spandsp-0.0.3 (yes, the devel one not the other 
installed.  Both are included in iaxmodem (in the lib directory), 
however I grabbed a slightly newer spandsp-0.0.3 from the spandsp site.

Make sure spandsp and libiax2 are found by your system (usually by doing 
a 'ldconfig').

Build and install iaxmodem.

iaxmodem wants a config file at /etc/iaxmode-cfg.something.  Mine looks 
something like:

# cat /etc/iaxmodem-cfg.ttyIAX

device          /dev/ttyIAX
port            4569
refresh         60
server          YOUR.SERVER.IP.HERE
peername        iaxmodem
secret          YOUR_SECRET_HERE
cidname         John Doe
cidnumber       8005551212
codec           slinear
swapbytes       true

Now, create an entry for the iax channel in your Asterisk config.  Mine 
looks something like this (in iax.conf):

[iaxmodem]
type=friend
username=iaxmodem
secret=YOUR_SECRET_HERE
context=faxout
host=dynamic
auth=md5,plaintext,rsa

Notice that the context is 'faxout' in my extensions.conf.  Here's what 
the relevent contexts are in my extensions.conf:

[fax]
exten => s,1,Dial(IAX2/iaxmodem)

[faxout]
exten => _.,1,Dial(Zap/g2/${EXTEN})

Notice I also have 'fax' which is incoming.  That's a context for my zap 
channel (a dedicated fax line).  From zapata.conf:

group = 2
faxdetect=both
faxdetect=incoming
faxdetect=outgoing
faxdetect=yes
rxgain=0.0
txgain=0.0
context=fax
channel => 4

OK, what this all does thus far: It sets up a serial port, /dev/ttyIAX 
in this case, which looks like a fax-modem that is connected to the 
provided iax channel.  You can point minicom at it and play with it if 
you want.  Calls coming into Zap-4 will automaticly go to iaxmodem and 
'ring' on the /dev/ttyIAX serial device.  Faxes going out on iaxmodem 
automatically go our on the same Zap channel (although doesn't have to).

Now, run iaxmodem (e.g. "iaxmodem ttyIAX"), after you've already got 
asterisk going, to get it registered.  Make sure it registers and things 
look OK (iax2 show peers).  You could even try to call it or dial out w/ 
  minicom (using /dev/ttyIAX as the modem device).

Now, you can set up hylafax.  I installed from RPM, which was pretty 
easy following the directions.  Run through its set up and get the email 
addresses and those relevent things set.  Instead of setting up a new 
modem config, however, I edited and then copied the supplied one out of 
the iaxmodex distro (config.ttyIAX).

Get hylafax going (/etc/rc.d/init.d/hylafax start).

Now, here's the only stumbling block that I had: In order for things to 
work, faxgetty needs to be running!  The hylafax service doesn't do this 
for you, you need to set it up yourself.  The easiest way is to add it 
to your /etc/inittab. I added it to mine like this (the new line is the 
last here, the rest were already there and included for context):

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
7:2345:respawn:/usr/sbin/faxgetty ttyIAX

You may need to restart or 'telinit q' or something to get the changes 
noticed by init.

Now you can try sending and receiving faxes.  For fun, I created a new 
account on the Asterisk server and put a .procmailrc file there which 
passes emails to that account to hylafax:

SUBJECT=`formail -xSubject:`

:0 c
* ^Subject: [a-zA-Z0-9]+@[0-9]+
|/usr/bin/faxmail -d $SUBJECT


How it works: send a mail to the account and in the subject line put 
"Joe at 5551234", and it will fax the email to 555-1234 with 'attn Joe' on 
the cover page.  Slick... although it seems to take more work to convert 
non-text (e.g. images), which I haven't attempted yet.

OK, so there's the crash course.  I hope it helps.


Phil



More information about the asterisk-users mailing list