Trunk IAX2 does not work (not found)

Hello,

I am trying to configure an IAX trunk between 2 asterisk serveur (on virtuals machines).
I am able to call SIP phone inside my servers but I am not able to call through the trunk.
I got a “not found error” in Zoiper.

Here is my configuration:
For asterisk A (192.168.0.20)
sip.conf

[general]
context=default

[phone1]
type=friend
context=asterisk
host=dynamic
secret=123456
disallow=all
allow=ulaw

[phone2]
type=friend
context=asterisk
host=dynamic
secret=123456
disallow=all
allow=ulaw

extensions.conf

[asterisk]
exten => 101,1,Wait(1)
exten => 101,2,Dial(SIP/phone1,30)
exten => 101,3,Hangup()

exten => 102,1,Wait(1)
exten => 102,2,Dial(SIP/phone2,30)
exten => 102,3,Hangup()

exten => _0XXX,1,Wait(1)
exten => _0XXX,2,Dial(IAX2/trunk_asterisk/$[EXTEN:1],30)
exten => _0XXX,3,Hangup()

iax.conf

[trunk_asterisk]
type=friend
host=192.160.0.21
username=trunk_asteriskB
context=asteriskB
permit=192.160.0.21/255.255.255.0
secret=123456
trunk=yes
language=fr
qualify=yes
timezone=Europe/Brussels

For asterisk B (192.168.0.21)
sip.conf

[general]
context=default

[phone3]
type=friend
context=asteriskB
host=dynamic
secret=123456
disallow=all
allow=ulaw

extensions.conf

[asteriskB]
exten => 201,1,Wait(1)
exten => 201,2,Dial(SIP/phone3,30)
exten => 201,3,Hangup()

exten => _0XXX,1,Wait(1)
exten => _0XXX,2,Dial(IAX2/trunk_asteriskB/$[EXTEN:1],30)
exten => _0XXX,3,Hangup()

iax.conf

[trunk_asteriskB]
type=friend
host=192.160.0.20
username=trunk_asterisk
context=asterisk
permit=192.160.0.20/255.255.255.0
secret=123456
trunk=yes
language=fr
qualify=yes
timezone=Europe/Brussels

Servers can ping each others… And I also tried to write this in the iax.conf but it does not work…

permit=192.168.0.0/255.255.255.0

Thanks for your help !

You’re going to need to show the actual console output on both sides for a call attempt so it can be narrowed down.

Thanks for help.
here is the asterisk A CLI, when I call from A to B (I do not have anything on the other side)


It’s strange that there is my public address behind the red (I’m in bridge mode). Should I set it up on private network ?

I have exactly the same error in a private network.

Neither of those traces is at a sufficiently high logging level to identify the causes and whether they are the same. They only support a generic unavailable status, not necessarily “not found”.

I guess, but how can I identify precisely the cause of the problem ?
sip show peers
and iax2 show peers
both tell me it’s “online”

You haven’t shown the remote side, where you are dialling.

Nothing happened on this side

Do “iax2 set debug on” and then perform a call. What is output?

When I call from A to B… (192.168.0.20 to 192.168.0.21)

  == Using SIP RTP CoS mark 5
       > 0x7f1eac005680 -- Strict RTP learning after remote address set to: XX.XXX.XX.XX:8000
    -- Executing [0201@asterisk:1] Wait("SIP/phone1-00000007", "1") in new stack
    -- Executing [0201@asterisk:2] Dial("SIP/phone1-00000007", "IAX2/trunk_asterisk/201,30") in new stack
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW
   Timestamp: 00013ms  SCall: 20901  DCall: 00000 192.168.0.21:4569
   VERSION         : 2
   CALLED NUMBER   : 201
   CODEC_PREFS     : (ulaw|alaw|siren14|siren7|g722|slin16|slin|g726|g726aal2|adpcm|gsm|ilbc|speex|lpc10|g7                                                                                            29|g723)
   CALLING NUMBER  : phone1
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    :
   LANGUAGE        : en
   USERNAME        : trunk_asteriskB
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 65535
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2020-01-04  21:06:42

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN
   Timestamp: 00013ms  SCall: 00001  DCall: 20901 192.168.0.21:4569
   CALLTOKEN       : 51 bytes

Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW
   Timestamp: 00014ms  SCall: 20901  DCall: 00000 192.168.0.21:4569
   VERSION         : 2
   CALLED NUMBER   : 201
   CODEC_PREFS     : (ulaw|alaw|siren14|siren7|g722|slin16|slin|g726|g726aal2|adpcm|gsm|ilbc|speex|lpc10|g7                                                                                            29|g723)
   CALLING NUMBER  : phone1
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    :
   LANGUAGE        : en
   USERNAME        : trunk_asteriskB
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 65535
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2020-01-04  21:06:42
   CALLTOKEN       : 51 bytes

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00009ms  SCall: 01997  DCall: 20901 192.168.0.21:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x31\x31\x38\x37\x33\x39\x38\x39\x38
   USERNAME        : trunk_asteriskB

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00015ms  SCall: 20901  DCall: 01997 192.168.0.21:4569
   MD5 RESULT      : 8e9c870954e50cc31445bc12dc2bfbbc

Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: REJECT
   Timestamp: 00010ms  SCall: 01997  DCall: 20901 192.168.0.21:4569
   CAUSE           : No such context/extension
   CAUSE CODE      : 3

Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK
   Timestamp: 00010ms  SCall: 20901  DCall: 01997 192.168.0.21:4569
    -- Called IAX2/trunk_asterisk/201
    -- Hungup 'IAX2/trunk_asterisk-20901'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [0201@asterisk:3] Hangup("SIP/phone1-00000007", "") in new stack
  == Spawn extension (asterisk, 0201, 3) exited non-zero on 'SIP/phone1-00000007'
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE
   Timestamp: 00002ms  SCall: 10611  DCall: 00000 192.168.0.21:4569

Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG
   Timestamp: 00002ms  SCall: 00001  DCall: 10611 192.168.0.21:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK
   Timestamp: 00002ms  SCall: 10611  DCall: 00001 192.168.0.21:4569

I guess “No such context/extension” is the problem ?!

Yes, the problem is on 192.168.0.21

Ok thanks, I will check but I do not know what could be wrong.
I already checked username and context in iax.conf and extensions.conf.
Or maybe I misunderstood the syntax ?

Well I can say that based on the configuration the “trunk_asteriskB” account is using context “asterisk” and your showed dialplan is using context “asteriskB”.

1 Like

Oh ok I thought the context in the trunk configuration is the remote context

you must create a profile on your server 1 on which server 2 can connect.
so in iax.conf create the profile:

[ESMT]
type = friend
host = dynamic
trunk = yes
context = abonnes_esmt

at the level of [general], put the line:
register => server_profile2:password_server2@ ip_address_server2.

Repeat the same procedure on server 2 but taking another profile

I’ll organize this for you.

At server level 1, put in iax.conf:

[general]
language = fr
qualify = yes

register => ESMT@ip_address_server2

; ------ PROFILE FOR REGISTRATION ---------

[CPC]
type = friend
host = dynamic
trunk = yes
context = training

in extensions.conf:

[training]
; Local subscribers
exten => _955 [8-9] XXX, 1, DIAL (IAX2 / $ {EXTEN}, 60, tr)
exten => _955 [8-9] XXX, 2, Hangup ()

; External subscribers
exten => _4955 [5-7] XXX, 1, DIAL (IAX2 / CPC / $ {EXTEN: 1}, 60, tr)
exten => _4955 [5-7] XXX, 2, Hangup ()

At server level 2, in iax.conf put:
[general]
language = en
qualify = yes

register => CPC@ip_address_server1

; ------ PROFILE FOR REGISTRATION ---------

[ESMT]
type = friend
host = dynamic
trunk = yes
context = training

in extensions.conf:

[training]
;local subscribers
exten => _955 [5-7] XXX, 1, DIAL (IAX2 / $ {EXTEN}, 60, tTr)
exten => _955 [5-7] XXX, 2, Hangup ()

; External subscribers
exten => _4955 [8-9] XXX, 1, DIAL (IAX2 / ESMT / $ {EXTEN: 1}, 60, tTr)
exten => _4955 [8-9] XXX, 2, Hangup ()

After making these configurations, go to Asterisk CLI mode and do iax2 show registry. You should get messages like capturing on both servers.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.