IAXmodem not Registering

I am attempting to use Hylafax+IAXmodem on a dedicated server to send via an Elastix server on the same LAN, but I cannot seem to get the IAXmodem on the fax box to register with Asterisk on the Elastix box. This is the ttyIAX1 file contents on the fax server:

[root@dmxfax]# cat /etc/iaxmodem/ttyIAX1 device /dev/ttyIAX1 owner uucp:uucp mode 660 port 4570 refresh 300 server 192.168.43.60 peername 9200 secret XXXXXXXXXXXXX (hidden for privacy) cidname XXXXXXXXXXXXX (hidden for privacy) cidnumber XXXXXXXXXXXXX (hidden for privacy) codec slinear

As for the FreePBX end, I simply created an IAX2 extension with a matching password (like I do for extensions used by Hylafax on the same server as Elastix).

This is what happens when I try to manually start the modem:

[root@dmxfax iaxmodem]# /usr/bin/iaxmodem ttyIAX1 [2009-11-23 12:43:54] Modem started [2009-11-23 12:43:54] Setting device = '/dev/ttyIAX1' [2009-11-23 12:43:54] Setting owner = 'uucp:uucp' [2009-11-23 12:43:54] Setting mode = '660' [2009-11-23 12:43:54] Setting port = 4570 [2009-11-23 12:43:54] Setting refresh = 300 [2009-11-23 12:43:54] Setting server = '192.168.43.60' [2009-11-23 12:43:54] Setting peername = '9200' [2009-11-23 12:43:54] Setting secret = 'xxxxxxxxxxx' [2009-11-23 12:43:54] Setting cidname = 'xxxxxxxxxxx' [2009-11-23 12:43:54] Setting cidnumber = 'xxxxxxxxxxx' [2009-11-23 12:43:54] Setting codec = slinear [2009-11-23 12:43:54] Opened pty, slave device: /dev/pts/0 [2009-11-23 12:43:54] Created /dev/ttyIAX1 symbolic link [2009-11-23 12:43:54] Registration failed.

Any help will be greatly appreciated!

Please paste the section 9200 from iax_additional.conf here.
Why are you using codec slinear?

[9200] deny=0.0.0.0/0.0.0.0 secret=xxxxxxxxxxx transfer=no context=from-internal host=dynamic type=friend port=4569 qualify=yes dial=IAX2/9200 accountcode= mailbox=9200@device permit=0.0.0.0/0.0.0.0 callerid=device <9200> setvar=REALCALLERIDNUM=9200

I’m using slinear only because that was in the setup instructions I was following. I’m happy to change it if something else will work better.

Well, the instructions you followed where not quite right.
Try this:

[9200]
secret=xxxxxxxxxxx
context=from-internal
host="ip address of server with iax modem"
type=friend
port=4569
disallow=all
allow=ulaw
qualify=yes
jitterbuffer=no
callerid=device <9200>
setvar=REALCALLERIDNUM=9200

Then for /etc/iaxmodem/ttyIAX1

device          /dev/ttyIAX1
owner           uucp:uucp
mode            660
port            4569
refresh         300
server          192.168.43.60
peername        9200
secret          XXXXXXXXXXXXX (hidden for privacy)
cidname         XXXXXXXXXXXXX (hidden for privacy)
cidnumber       XXXXXXXXXXXXX (hidden for privacy)
codec ulaw

You must use the same port number, you have a mixup of 4569 and 4570. Configuration in Asterisk must match the one in iaxmodem.

There is a long thread over at PBX in a Flash forums http://pbxinaflash.com/forum/showthread.php?t=3645 read that whole thread and you will get more information that you ever need :slight_smile:

Every tutorial I found indicated that each IAXmodem needed to be on its own port. i.e., “not 4569” Is that correct? Ultimately, I need to deploy about 20-40 IAXmodems on the box. (I didn’t see the answer to this in the post string you sent me).

Yes, but the peer port in iax_additional.conf (or iax_custom.conf) must match the port in ttyIAXx.

In you above post your /etc/iaxmodem/ttyIAX1 have port 4570 but you peer setting in iax conf file have port 4569, and that is not a match.

Each ttyIAXx must have it’s corresponding peer in Asterisk config, if you want to have 20 iaxmodems, you will need to have 20 peers defined in iax config with ports ranging from 4570 - 4590.

If your peer is 9220 and your iaxmodem config file is ttyIAX20, both port settings in each must match, for example port=4590 in asterisk config and port 4590 in ttyIAXxx

Ok, here’s what I have in my configs now:

[root@dmxfax ~]# cat /etc/iaxmodem/ttyIAX1 device /dev/ttyIAX1 owner uucp:uucp mode 660 port 15201 refresh 300 server 192.168.43.60 peername 15201 secret xxxxxxxxxxx cidname xxxxxxxxxxx cidnumber xxxxxxxxxx codec ulaw

and…

[15201] deny=0.0.0.0/0.0.0.0 disallow=all secret=xxxxxxxxxxx transfer=no context=from-internal host=192.168.43.55 type=friend port=15201 qualify=yes allow=ulaw dial=IAX2/15201 accountcode= mailbox=15201@device permit=0.0.0.0/0.0.0.0 callerid=device <15201> setvar=REALCALLERIDNUM=15201

(This entry was generated by FreePBX)

When I try to run the modem, I still get…

[root@dmxfax ~]# /usr/bin/iaxmodem ttyIAX1 [2009-11-23 21:50:45] Modem started [2009-11-23 21:50:45] Setting device = '/dev/ttyIAX1' [2009-11-23 21:50:45] Setting owner = 'uucp:uucp' [2009-11-23 21:50:45] Setting mode = '660' [2009-11-23 21:50:45] Setting port = 15201 [2009-11-23 21:50:45] Setting refresh = 300 [2009-11-23 21:50:45] Setting server = '192.168.43.60' [2009-11-23 21:50:45] Setting peername = '15201' [2009-11-23 21:50:45] Setting secret = 'xxxxxxxxxxx' [2009-11-23 21:50:45] Setting cidname = 'xxxxxxxxxxx' [2009-11-23 21:50:45] Setting cidnumber = 'xxxxxxxxxx' [2009-11-23 21:50:45] Setting codec = ulaw [2009-11-23 21:50:45] Opened pty, slave device: /dev/pts/1 [2009-11-23 21:50:45] Created /dev/ttyIAX1 symbolic link [2009-11-23 21:50:45] Registration failed.

More ideas?

I got it!

Not sure how, but it shows in “iax2 show peers”!

15201 192.168.43.55 (S) 255.255.255.255 15201 OK (3 ms)

Woohoo!

Hi,

I am using Hylafax/IAXModem and Asterisk as fax solution. Hylafax-6.0.3 and Iaxmodem-1.2.0 both have been installed at same machine. Where Asterisk is at another machine.

File :/etc/iaxmodem/ttyIAX0

device /dev/ttyIAX0
owner uucp:uucp
mode 660
port 4570
refresh 300
server 156.154.191.171
peername IAXModem
secret password
cidname Neustar Fax
cidnumber 5714345400
codec alaw

iax configuration at Asterisk box (156.154.191.171)

[IAXModem]
requirecalltoken=no
type=friend
secret=password
port=4570
host=dynamic
context=fax-out
qualify=yes
disallow=all
allow=alaw
allow=ulaw
allow=slinear

But while running following command error was found:

[root@My ~]# /usr/bin/iaxmodem ttyIAX0 &
[root@impetus-803 ~]# [2009-12-16 13:27:54] Modem started
’2009-12-16 13:27:54] Setting device = '/dev/ttyIAX0
’2009-12-16 13:27:54] Setting owner = 'uucp:uucp
’2009-12-16 13:27:54] Setting mode = '660
[2009-12-16 13:27:54] Setting port = 4570
[2009-12-16 13:27:54] Setting refresh = 300
’2009-12-16 13:27:54] Setting server = '156.154.19.71
’2009-12-16 13:27:54] Setting peername = 'IAXModem
’2009-12-16 13:27:54] Setting secret = 'password
’2009-12-16 13:27:54] Setting cidname = 'SSS Fax
’2009-12-16 13:27:54] Setting cidnumber = '5714345400
group not found in group file, using root instead
), leaving default modes on /dev/ttyIAX0e string (660
[2009-12-16 13:27:54] Opened pty, slave device: /dev/pts/3
[2009-12-16 13:27:54] Removed old /dev/ttyIAX0
symbolic link:27:54] Created /dev/ttyIAX0
[2009-12-16 13:27:54] Error: mode is 0, leaving default permissions

Seems like IAXModem is not being registered successfully.

Seeking for help to solve the problem. Any idea?

It turns out that the cause of my issue was that the upgrade from Elastix 1.5 to Elastix 1.6 includes some security enhancements that Digium has built into IAX2. Apparently, there is an issue with DoS attacks on Asterisk servers using IAX2, so Digium introduced the requirement for Call Token Validation by default.

The issue I had with being able to receive faxes, but not send them was directly caused by this new security. I was able to receive faxes because Asterisk initiated the contact to the IAXmodems on the Hylafax server on the same LAN, yet when the IAXmodems attempted to initiate a call “to” the Asterisk server to send a fax, it was denied. This did not show up in the Asterisk CLI, even when verbosity and debugging were both set to 255. I suppose the good news is that this new measure seems quite capable of protecting an Asterisk server’s IAX2 ports.

To solve my problem, it turns out that there are two choices. The preferred one is simply to add a provision to each extension’s configuration:

requirecalltoken=no

The challenge is that there is not easy way to accomplish this when using Elastix/FreePBX without creating a custom extension. I did attempt to make use of iax_custom_post.conf to “add” a directive–but this feature appears not to be functional yet.

The solution which I opted for was to disable the new IAX2 security measures as a [general] directive for IAX2 on my server. I accomplished this the “easy way” by going to the “Asterisk IAX Settings” module in FreePBX (can be added from extended repository) and going down to the “Other IAX Settings” section.

calltokenoptional = 0.0.0.0/0.0.0.0
maxcallnumbers = 16382

I added these two entries and submitted/applied changes and voila! it worked. These directives serve to return IAX2 to functioning exactly as they did before the Digium security enhancements.

Obviously, it is never an ideal thing to reduce security measures in a world where most of us have seen an extension hijacker or two compromise a system–but in this case, it seems safe enough since I only allow access to IAX2 from inside our firewall.

I hope this explanation is helpful.

The problem has been solved.

It was the silly mistake I made. I just created a file /etc/iaxmodem/ttyIAX0 in windows environment and uploaded into unix environment. While registering modem; it seems like file was not being read properly because of wrong format (may be not a proper unix file format). Result was coming like

[root@impetus-803 ~]# [2009-12-16 13:27:54] Modem started
’2009-12-16 13:27:54] Setting device = '/dev/ttyIAX0
’2009-12-16 13:27:54] Setting owner = 'uucp:uucp
’2009-12-16 13:27:54] Setting mode = '660
[2009-12-16 13:27:54] Setting port = 4570
.
.
.

Just observed single inverted commas. Then I Used below command to make unix compatible file

dos2unix /etc/iaxmodem/ttyIAX0 /etc/iaxmodem/ttyIAX0

And again tried to register modem:

[root@My ~]# /usr/bin/iaxmodem ttyIAX0
[2009-12-17 11:42:56] Modem started
[2009-12-17 11:42:56] Setting device = ‘/dev/ttyIAX0’
[2009-12-17 11:42:56] Setting owner = ‘uucp:uucp’
[2009-12-17 11:42:56] Setting mode = ‘660’
[2009-12-17 11:42:56] Setting port = 4570
[2009-12-17 11:42:56] Setting refresh = 300
[2009-12-17 11:42:56] Setting server = ‘156.154.19.71’
[2009-12-17 11:42:56] Setting peername = ‘IAXModem1’
[2009-12-17 11:42:56] Setting secret = ‘password’
[2009-12-17 11:42:56] Setting cidname = ‘Neustar Fax’
[2009-12-17 11:42:56] Setting codec = alaw
[2009-12-17 11:42:56] Setting cidnumber = ‘5714345400’
[2009-12-17 11:42:57] Opened pty, slave device: /dev/pts/3
[2009-12-17 11:42:57] Created /dev/ttyIAX0 symbolic link
WARNING: peercallno does not match callno, peercallno => 3109, callno => 12437, dcallno => 24820Ignoring unknown information element ‘Unknown IE’ (54) of length 0
[2009-12-17 11:42:57] Registration completed successfully.

Now things working fine and able to send fax successfully.
This may help someone. Good luck.

I am curious to know some questions about hylafax solution.

My setup environment is only for sending fax:

Hylfax Client --> Hylfax Server --> IAXModem --> Asterisk Server – FaxMachine

Q1. Is there any way to get notification mail from hylfax server once fax delivered successfully to fax machine?

Q2. How many maximum number of messages can be stored in sendQ of hylafax?

Q3. How much load can be acceptable using only single modem ? What would be the performance hit in this case?

Q4. Can multiple fax send queues be created and managed at hylafax? If yes, how? If no, why?

Q5. In case of Hylfax delivered message successfully but IAXModem or Asterisk further would fail to send fax to fax machine, how this failure would be notified? Who would be responsible one to notify whether Asterisk or Hylafax?

Replies are most welcome.

Hi,
My setup environment is as below:

Hylfax Client --> Hylfax Server --> IAXModem --> Asterisk Server – FaxMachine

I am using below send API to send faxes:

[root@impetus-803 Hylafax_Client]# java gnu.hylafax.util.SendFax -h 192.168.164.111 -u root -v -d 15714345349 -m -f [email protected] -D -R ./Test.ps

My fax delivered successfully to fax machine but I observed that I didn’t receive any notification from hylafax on this email id "[email protected]" as it was configured with -f command option while sending fax.

Am I missing any configuration? What more I need to do to get email notification back?

Please suggest.

Thanks
Narendra

But I am having some issues trying to get this to work (day number 5)
I am running iaxmodem and hylafax on one server and asterisk now 1.5 on another.

OK. here is my /etc/iaxmodem/ttyIAX0:

device /dev/ttyIAX0
owner uucp:uucp
mode 660
port 4570
refresh 300
server ip_of_hylafax_server
peername 200
secret *******
cidname IAXmodem
cidnumber *********
codec ulaw

here is what I have put into IAX trunk:
Outgoing Settings

Trunk Name: 200-peer
PEER Details:


disallow=all
allow=ulaw
authuser=200
canreinvite=no
context=from-trunk
dtmf=auto
dtmfmode=inband
fromdomain=ip_of_hylafax_server
fromuser=200
host=dynamic
insecure=very
secret=******
type=peer
Username=200
jitterbuffer=no
callerid=device <200>
setvar=REALCALLERIDNUM=200
requirecalltoken=no
calltokenoptional=0.0.0.0/0.0.0.0
maxcallnumbers=16382

Incoming Settings

USER Context: 200-user
USER Details:


disallow=all
allow=ulaw
authuser=200
canreinvite=no
context=from-trunk
dtmf=auto
dtmfmode=inband
fromdomain=ip_of_hylafax_server
fromuser=200
host=dynamic
insecure=very
secret=*******
type=user
Username=200
jitterbuffer=no
callerid=device <200>
setvar=REALCALLERIDNUM=200
requirecalltoken=no
calltokenoptional=0.0.0.0/0.0.0.0
maxcallnumbers=16382

Registration

Register String:

200:*******@ip_of_hylafax_server:4570

ok on asterisk box :
CLI> iax2 set debug on
Tx-Frame Retry[-01] – OSeqno: 001 ISeqno: 001 Type: IAX Subclass: ACK
Timestamp: 00007ms SCall: 05826 DCall: 07578 [...:4570]
Rx-Frame Retry[ No] – OSeqno: 026 ISeqno: 033 Type: IAX Subclass: PING
Timestamp: 325013ms SCall: 07570 DCall: 04784 [...:4570]
Tx-Frame Retry[000] – OSeqno: 033 ISeqno: 027 Type: IAX Subclass: PONG
Timestamp: 325013ms SCall: 04784 DCall: 07570 [...:4570]
RR_JITTER : 0
RR_LOSS : 0
RR_PKTS : 1
RR_DELAY : 40
RR_DROPPED : 0
RR_OUTOFORDER : 0

Rx-Frame Retry[ No] – OSeqno: 027 ISeqno: 034 Type: IAX Subclass: ACK
Timestamp: 325013ms SCall: 07570 DCall: 04784 [...:4570]
Tx-Frame Retry[000] – OSeqno: 034 ISeqno: 027 Type: IAX Subclass: REGREQ
Timestamp: 350015ms SCall: 04784 DCall: 07570 [...:4570]
USERNAME : 200
REFRESH : 60

Rx-Frame Retry[ No] – OSeqno: 027 ISeqno: 035 Type: IAX Subclass: ACK
Timestamp: 350015ms SCall: 07570 DCall: 04784 [...:4570]
Rx-Frame Retry[ No] – OSeqno: 027 ISeqno: 035 Type: IAX Subclass: PING
Timestamp: 350018ms SCall: 07570 DCall: 04784 [...:4570]
Tx-Frame Retry[000] – OSeqno: 035 ISeqno: 028 Type: IAX Subclass: PONG
Timestamp: 350018ms SCall: 04784 DCall: 07570 [...:4570]
RR_JITTER : 0
RR_LOSS : 0
RR_PKTS : 1
RR_DELAY : 40
RR_DROPPED : 0
RR_OUTOFORDER : 0

Rx-Frame Retry[ No] – OSeqno: 028 ISeqno: 036 Type: IAX Subclass: ACK
Timestamp: 350018ms SCall: 07570 DCall: 04784 [...:4570]
Rx-Frame Retry[ No] – OSeqno: 028 ISeqno: 036 Type: IAX Subclass: PING
Timestamp: 350595ms SCall: 07570 DCall: 04784 [...:4570]
Tx-Frame Retry[000] – OSeqno: 036 ISeqno: 029 Type: IAX Subclass: PONG
Timestamp: 350595ms SCall: 04784 DCall: 07570 [...:4570]
RR_JITTER : 0
RR_LOSS : 0
RR_PKTS : 1
RR_DELAY : 40
RR_DROPPED : 0
RR_OUTOFORDER : 0

CLI> iax2 show peers
1 iax2 peers [1 online, 0 offline, 0 unmonitored]

CLI> iax2 show registry
ip_of_hylafax_server:4570 N 200 60 Request Sent
1 IAX2 registrations.


here is my log from hylafax trying to send:
Jan 12 10:57:49.40: [ 3404]: SESSION BEGIN 000000063 1*********
Jan 12 10:57:49.40: [ 3404]: HylaFAX ™ Version 6.0.4
Jan 12 10:57:49.40: [ 3404]: SEND FAX: JOB 17 DEST ********* COMMID 000000063 DEVICE ‘/dev/ttyIAX0’ FROM ‘jmituzas [email protected]’ USER root
Jan 12 10:57:49.40: [ 3404]: STATE CHANGE: RUNNING -> SENDING
Jan 12 10:57:49.40: [ 3404]: <-- [12:AT+FCLASS=1\r]
Jan 12 10:57:49.40: [ 3404]: --> [2:OK]
Jan 12 10:57:49.40: [ 3404]: MODEM set XON/XOFF/FLUSH: input ignored, output disabled
Jan 12 10:57:49.41: [ 3404]: DIAL *********
Jan 12 10:57:49.41: [ 3404]: <-- [15:ATDT*********\r]
Jan 12 10:57:49.41: [ 3404]: --> [11:NO DIALTONE]
Jan 12 10:57:49.41: [ 3404]: SEND FAILED: JOB 17 DEST ********** ERR [4] No local dialtone
Jan 12 10:57:50.41: [ 3404]: <-- [5:ATH0\r]
Jan 12 10:57:50.41: [ 3404]: --> [2:OK]
Jan 12 10:57:50.41: [ 3404]: MODEM set DTR OFF
Jan 12 10:57:50.41: [ 3404]: MODEM set baud rate: 0 baud (flow control unchanged)
Jan 12 10:57:50.41: [ 3404]: STATE CHANGE: SENDING -> MODEMWAIT (timeout 5)
Jan 12 10:57:50.41: [ 3404]: SESSION END


I have set this up the same way as a SIP Trunk (and that worked)

I guess the problem is how to we get a dial tone and number (from Dahdi lines) to the IAX modem? Or simply how do we register this iaxmodem?

Any help would be greatly appreciated.
Thanks in advance,
Joe

I had the same problem and I did what you said. But now I have a new problem for sending fax. I received this error “ERR [4] No local dialtone” when called the sendfax command.

Please guide me.
Thanks

Great Explanation Eriks

Works just fine for me, I took the easy way as you described, I wonder if some how this changes will open a security issue or something like that on my IAX server?

Anyway, so far, I could register, thanks again

Regards

Please help me:
I tried to modify configuration settings in order to make work also for sending faxes but now (I uninstalled and reinstalled iaxmodem and hylafax deleting configurations), if I call fax extension, it doesn’t answer:
root@raspbx:/etc/asterisk# iaxmodem ttyI11
[2014-01-01 19:04:45] Modem started
[2014-01-01 19:04:45] Setting device = ‘/dev/ttyI11’
[2014-01-01 19:04:45] Setting owner = ‘uucp:uucp’
[2014-01-01 19:04:45] Setting mode = ‘660’
[2014-01-01 19:04:45] Setting port = 4570
[2014-01-01 19:04:45] Setting refresh = 1800
[2014-01-01 19:04:45] Setting server = ‘localhost’
[2014-01-01 19:04:45] Setting peername = ‘11’
[2014-01-01 19:04:45] Setting secret = ‘▒▒e▒▒0▒▒▒▒3q▒▒R▒▒l▒a▒▒V▒V▒▒▒▒n6▒’
[2014-01-01 19:04:45] Setting cidname = ‘xxxx’
[2014-01-01 19:04:45] Setting cidnumber = ‘+39.xxxx’
[2014-01-01 19:04:45] Setting codec = ulaw
[2014-01-01 19:04:45] Opened pty, slave device: /dev/pts/4
[2014-01-01 19:04:45] Created /dev/ttyI11 symbolic link
[2014-01-01 19:04:45] Registration failed.

I checked but the port is for all conf file 4570.
Where I have to check?
which log?
thanks