No calls between two Asterisk via IAX2

Dear all,
I would appreciate any advise on the problem I have stumbled across. I have connected two Asterisk system with IAX protocol. iax2 show peers does not contain any errors indications:
Asterisk A:

raspbx*CLI> iax2 show peers
Name/Username    Host                                           Mask                                      Port           Status      Description                     
MSC_IAX/ua       46.46.46.204                             (S)  255.255.255.255                           4569  (T)      OK (87 ms)                                  
1 iax2 peers [1 online, 0 offline, 0 unmonitored]

Asterisk B:

raspbx*CLI> iax2 show peers
Name/Username    Host                                           Mask                                      Port           Status      Description                     
UA_IAX/msc       159.159.64.216                           (S)  255.255.255.255                           4569  (T)      OK (87 ms)                                  
1 iax2 peers [1 online, 0 offline, 0 unmonitored]

However, when I am trying to place a call that has a route from Asterisk A to Asterisk B I get the following

-- Executing [tdial@ext-trunk:10] Dial("Motif/+12562293899-ad26", "IAX2/MSC_IAX/2562036698,300,Tr") in new stack
-- Called IAX2/MSC_IAX/2562036698
-- Hungup 'IAX2/MSC_IAX-26746
-- Everyone is busy/congested at this time (1:0/0/1)

Needless to say, that at the time when a call is being placed - for example, Asterisk A calls out Asterisk B - nothing happens at Asterisk B side, its CLI is simply silent. That makes me to believe that the call can’t reach Asterisk B.

Here is typical IAX Trunk configuration:

username=XX
secret=YYY
host=xx.xx.xx.xxx
type=friend
context=from-internal
qualify=yes
qualifyfreqok=25000
transfer=no
trunk=yes
auth=md5

All other setting are provided by GUI.

I cannot figure out why…

Thank you on advance.

Have you disabled the Linux firewall?

Hi, david551,
I don’t think that anything of below may have any impact on IAX calls:

root@raspbx:~# iptables -vL -t filter

Chain INPUT (policy ACCEPT 39965 packets, 8417K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 fail2ban-asterisk  tcp  --  any    any     anywhere             anywhere             tcp dpt:sip
  342  201K fail2ban-asterisk  udp  --  any    any     anywhere             anywhere             udp dpt:sip
    0     0 fail2ban-asterisk  tcp  --  any    any     anywhere             anywhere             tcp dpt:sip-tls
 2361  488K fail2ban-ssh  tcp  --  any    any     anywhere             anywhere             multiport dports ssh
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 37031 packets, 7169K bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain fail2ban-asterisk (3 references)
 pkts bytes target     prot opt in     out     source               destination
  342  201K RETURN     all  --  any    any     anywhere             anywhere
Chain fail2ban-ssh (1 references)
 pkts bytes target     prot opt in     out     source               destination
 2336  487K RETURN     all  --  any    any     anywhere             anywhere

iptables -vL -t nat

Chain PREROUTING (policy ACCEPT 23 packets, 3626 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain INPUT (policy ACCEPT 23 packets, 3626 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 63 packets, 5676 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain POSTROUTING (policy ACCEPT 63 packets, 5676 bytes)
 pkts bytes target     prot opt in     out     source               destination

root@raspbx:~# iptables -vL -t mangle

Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

root@raspbx:~# iptables -vL -t raw

Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

root@raspbx:~# iptables -vL -t security

iptables v1.4.21: can't initialize iptables table `security': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

I double-checked, there is no currently blocked Ips with fail2ban:

root@raspbx:~# fail2ban-client status | grep “Jail list:” | sed “s/ //g” | awk ‘{split($2,a,“,”);for(i in a) system("fail2ban-client status " a[i])}’ | grep “Status|IP list”

Status for the jail: asterisk
   |  `- IP list:
Status for the jail: ssh
   |  `- IP list:
root@raspbx:~#

Have you turned on IAX2 debug to confirm where traffic is going and that it is indeed not being received on the remote side? The CLI command is “iax2 set debug on”

Hi Jcolp,
here is what I see on the remote side:

Connected to Asterisk 13.15.0 currently running on raspbx (pid = 1081)
raspbx*CLI> iax2 set debug on
IAX2 Debugging Enabled
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE
   Timestamp: 00007ms  SCall: 01919  DCall: 00000 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG
   Timestamp: 00007ms  SCall: 00001  DCall: 01919 159.224.64.216:4569
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00007ms  SCall: 01919  DCall: 00001 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE
   Timestamp: 00004ms  SCall: 10174  DCall: 00000 159.224.64.216:4569
Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG
   Timestamp: 00004ms  SCall: 00001  DCall: 10174 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00004ms  SCall: 10174  DCall: 00001 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW
   Timestamp: 00012ms  SCall: 20759  DCall: 00000 159.224.64.216:4569
   VERSION         : 2
   CALLED NUMBER   : 2562036698
   CODEC_PREFS     : (ulaw)
   CALLING NUMBER  : 2567301855
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : 2567301855
   LANGUAGE        : en
   USERNAME        : ua
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 4
   CAPABILITY2     : ulaw
   ADSICPE         : 2
   DATE TIME       : 2017-05-11  07:45:50
Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN
   Timestamp: 00012ms  SCall: 00001  DCall: 20759 159.224.64.216:4569
   CALLTOKEN       : 51 bytes
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW
   Timestamp: 00113ms  SCall: 20759  DCall: 00000 159.224.64.216:4569
   VERSION         : 2
   CALLED NUMBER   : 2562036698
   CODEC_PREFS     : (ulaw)
   CALLING NUMBER  : 2567301855
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : 2567301855
   LANGUAGE        : en
   USERNAME        : ua
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 4
   CAPABILITY2     : ulaw
   ADSICPE         : 2
   DATE TIME       : 2017-05-11  07:45:50
   CALLTOKEN       : 51 bytes
Tx-Frame Retry[-01] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00113ms  SCall: 06362  DCall: 20759 159.224.64.216:4569
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00012ms  SCall: 06362  DCall: 20759 159.224.64.216:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x37\x30\x38\x39\x32\x32\x33\x38\x31
   USERNAME        : ua
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00233ms  SCall: 20759  DCall: 06362 159.224.64.216:4569
   MD5 RESULT      : 4896784e69cbb32b2faac9e7273118d5
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACK
   Timestamp: 00233ms  SCall: 06362  DCall: 20759 159.224.64.216:4569
Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: REJECT
   Timestamp: 01122ms  SCall: 06362  DCall: 20759 159.224.64.216:4569
   CAUSE           : No authority found
   CAUSE CODE      : 50
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK
   Timestamp: 01122ms  SCall: 20759  DCall: 06362 159.224.64.216:4569
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE
   Timestamp: 00016ms  SCall: 15557  DCall: 00000 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG
   Timestamp: 00016ms  SCall: 00001  DCall: 15557 159.224.64.216:4569
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00016ms  SCall: 15557  DCall: 00001 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE
   Timestamp: 00012ms  SCall: 00181  DCall: 00000 159.224.64.216:4569
Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG
   Timestamp: 00012ms  SCall: 00001  DCall: 00181 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00012ms  SCall: 00181  DCall: 00001 159.224.64.216:4569
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE
   Timestamp: 00004ms  SCall: 07243  DCall: 00000 159.224.64.216:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG
   Timestamp: 00004ms  SCall: 00001  DCall: 07243 159.224.64.216:4569
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00004ms  SCall: 07243  DCall: 00001 159.224.64.216:4569

It looks like there is a communications between two Asterisk boxes, however I can’t figure out what blocks the call.

With regards, Evgenii.

It attempted to authenticate as “ua” and failed.

Jcolp, thanks - you were right. I misspelled my password on one of the boxes. With your tip a moved on. But stuck on a different issue. I hope you may have a good prompt as well. Here is my debug output on the remote side:

Tx-Frame Retry[-01] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00109ms  SCall: 09463  DCall: 23843 159.224.64.216:4569
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00119ms  SCall: 09463  DCall: 23843 159.224.64.216:4569
   AUTHMETHODS     : 2
   CHALLENGE       : \x34\x37\x31\x38\x39\x37\x36\x37\x32
   USERNAME        : UA_IAX
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00352ms  SCall: 23843  DCall: 09463 159.224.64.216:4569
   MD5 RESULT      : 2139c60669d2309f03737b6f0902ab43
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACK
   Timestamp: 00352ms  SCall: 09463  DCall: 23843 159.224.64.216:4569
Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: REJECT
   Timestamp: 00254ms  SCall: 09463  DCall: 23843 159.224.64.216:4569

> CAUSE : No such context/extension

   CAUSE CODE      : 3

Both IAX trunks use context=from-internal directive. I checked and confirm that from-internal is existing context in my FreePBX installation:

;*******************************************************************************
; INTERNAL DIALPLAN, NOT OPEN TO THE PUBLIC WORLD                              *
;*******************************************************************************
;
;-------------------------------------------------------------------------------
; from-internal:
;
; Internal dialplan that most internal phones have access to
;
[from-internal]
include => from-internal-noxfer
include => from-internal-xfer
include => bad-number ; auto-generated
exten => h,1,Macro(hangupcall)
;-------------------------------------------------------------------------------

Why system can’t find really existing context?

Thank you in advance.

The message is for both context and extension. Your dialed number (it was “2562036698” in what you provided) may not be valid in that context.

I found missing exten. It was not in my custom dialplan. True.
Appreciate your help!!! Thank you, Jcolp.

Asterisk is amazing system. I wish it could be, let me say, a bit more specific in cases like mine. A couple extra words in a debug message could save days or weeks poking around :slight_smile:

The chan_iax2 module is an old module, newer ones (such as PJSIP) provide more information depending on the situation.