Hylafax/IAXmodem relay

Hi All,

I am trying to do something novel (I think?) with FreePBX. I run an ITSP in the Virgin Islands and our Internet links are (ahem) somewhat lacking in stability. Although with low rate codecs voice is operating ok, running U-Law for faxes is pretty much impossible.

So we are now considering distributing Atom based boxes to our business customers that will run asterisk, FreePBX (of course), Hylafax, and IAXModem. I have one of these running in my lab now, and the idea is that a fax machine connected to a Linksys PAP2T will call out to this Atom box, “send” the fax to IAXModem, which will save as a tif and Hylafax will then send the tif to our main Hylafax server, which will then send the fax out one of our T1’s with IAXModem again.

I actually have all of this working already with a single instance of IAXModem (extension 10001) on the atom box. It basically consists of:

A context in extensions_custom.conf:

exten => _X.,1,Answer
exten => _X.,n,Verbose(1, Attempted fax to ${EXTEN})
exten => _X.,n,Dial(IAX2/10001/${EXTEN})
exten => _X.,n,Hangup

A “FaxRelay” custom trunk that has “LOCAL/[email protected]” as its Custom Dial String.

An outbound route “FaxRelay” that uses a dialpattern of “X.” and sends to the custom trunk above.

A “Custom Context” that only has access to the “FaxRelay” outbound route, and of course the SIP peer “FaxMachine” is a member of this context.

So whatever the fax machine dials ends up talking to IAXModem, and the custom extension context passes the dialed number as you can see, such that Hylafax’s FaxDispatch script gets the dialed number as $CALLID4, and can do as it pleases with the delivery (in my case calling sendfax with the remote Hylafax as the receiver, and more magic happens up there to send it on its way).

All of this is just fine. And finally we get to my question.

I want more than one instance of IAXModem, in the case where more than one fax machine exists at a client’s site (many!), and there is a possibility of more than one instance being needed at a time. I suppose I could do some dialplan stuff directly in extensions_custom.conf, but the “clean” way to me was to create a ringgroup with a policy of “firstnotonphone” (ring group number 10000) that consists of the four IAXModem peers (10001 - 10004), and call that ringgroup from the extensions_custom.conf like this:

exten => _X.,1,Answer
exten => _X.,n,Verbose(1, Attempted fax to ${EXTEN})
exten => _X.,n,Dial(LOCAL/10000/${EXTEN})
exten => _X.,n,Hangup

This does actually work and the fax gets received, BUT in the FaxDispatch script I do NOT get the dialed number in $CALLID4.
I thought this might be because the channel variables for ${CALLERID(rdnis)} and ${CALLERID(dnid)} were not set, but setting them in the dialplan before the Dial seems to have no effect. I also tried to prepend the variables with “__” with no effect.

So what am I missing here? How can I dial the ring group and have the dialed number be passed to IAXModem?

Thanks for any insight.


Jeff LaCoursiere
St Thomas, USVI