Asterisk IAX2 Trunk

Hi all,

   I'm new in Asterisk, I need to interconected 2 Asterisk server and my intention is to use IAX2 for that. 

   I made some tests, only once was succesfully but currently when I do a call from Asterisk server A to Asterisk server B I always have  "line congestion".

    I'm sure the issue is  worng configuration from my side. 

    Please, do someone have a working example or link of how to interconect 2 Asterisk ?
   I'm working using LAN to avoid NAT problems in this first steps. 

Thanks,
Manolo Q.

Hi I have more information.

Setting IAX2 debug On I found it is a issue in the authentification but I don’t know why. That’s the trace

– Executing [41000@administrador:1] Dial(“SIP/TelephoneWin7-00000003”, “IAX2/PobrePi/1000”) in new stack
Tx-Frame Retry[000] – OSeqno: 000 ISeqno: 000 Type: IAX Subclass: NEW
Timestamp: 00010ms SCall: 16953 DCall: 00000 [192.168.1.20:4569]
VERSION : 2
– Called IAX2/PobrePi/1000
CALLED NUMBER : 1000
CODEC_PREFS : (alaw|ulaw|gsm)
CALLING NUMBER : TelephoneWin7
CALLING PRESNTN : 0
CALLING TYPEOFN : 0
CALLING TRANSIT : 0
CALLING NAME : Manolo
LANGUAGE : en
FORMAT : 8
FORMAT2 : alaw
CAPABILITY : 14
CAPABILITY2 : Unknown
ADSICPE : 2
DATE TIME : 2013-10-28 23:32:44

Rx-Frame Retry[ No] – OSeqno: 000 ISeqno: 001 Type: IAX Subclass: CTOKEN
Timestamp: 00010ms SCall: 00001 DCall: 16953 [192.168.1.20:4569]
CALLTOKEN : 51 bytes

Tx-Frame Retry[000] – OSeqno: 000 ISeqno: 000 Type: IAX Subclass: NEW
Timestamp: 00012ms SCall: 16953 DCall: 00000 [192.168.1.20:4569]
VERSION : 2
CALLED NUMBER : 1000
CODEC_PREFS : (alaw|ulaw|gsm)
CALLING NUMBER : TelephoneWin7
CALLING PRESNTN : 0
CALLING TYPEOFN : 0
CALLING TRANSIT : 0
CALLING NAME : Manolo
LANGUAGE : en
FORMAT : 8
FORMAT2 : alaw
CAPABILITY : 14
CAPABILITY2 : Unknown
ADSICPE : 2
DATE TIME : 2013-10-28 23:32:44
CALLTOKEN : 51 bytes

Rx-Frame Retry[ No] – OSeqno: 000 ISeqno: 001 Type: IAX Subclass: ACK
Timestamp: 00012ms SCall: 02264 DCall: 16953 [192.168.1.20:4569]
Rx-Frame Retry[ No] – OSeqno: 000 ISeqno: 001 Type: IAX Subclass: AUTHREQ
Timestamp: 00010ms SCall: 02264 DCall: 16953 [192.168.1.20:4569]
AUTHMETHODS : 3
CHALLENGE : \x37\x33\x37\x35\x36\x39\x38\x35\x37
USERNAME : RaspBerry

Tx-Frame Retry[000] – OSeqno: 001 ISeqno: 001 Type: IAX Subclass: AUTHREP
Timestamp: 00016ms SCall: 16953 DCall: 02264 [192.168.1.20:4569]
MD5 RESULT : 8a79d7a32f5ca66abcb962d1790604cf

Rx-Frame Retry[ No] – OSeqno: 001 ISeqno: 002 Type: IAX Subclass: ACK
Timestamp: 00016ms SCall: 02264 DCall: 16953 [192.168.1.20:4569]
Rx-Frame Retry[ No] – OSeqno: 001 ISeqno: 002 Type: IAX Subclass: REJECT
Timestamp: 01012ms SCall: 02264 DCall: 16953 [192.168.1.20:4569]
CAUSE : No authority found
CAUSE CODE : 50

Tx-Frame Retry[-01] – OSeqno: 002 ISeqno: 002 Type: IAX Subclass: ACK
Timestamp: 01012ms SCall: 16953 DCall: 02264 [192.168.1.20:4569]
– Hungup ‘IAX2/PobrePi-16953’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [41000@administrador:2] Hangup(“SIP/TelephoneWin7-00000003”, “”) in new stack
== Spawn extension (administrador, 41000, 2) exited non-zero on ‘SIP/TelephoneWin7-00000003’

But using ‘iax2 show register’ in both servers all is OK

Host dnsmgr Username Perceived Refresh State
192.168.1.20:4569 N PBXManolo 192.168.1.69:4569 60 Registered
1 IAX2 registrations.

Host dnsmgr Username Perceived Refresh State
192.168.1.69:4569 N PobrePi 192.168.1.20:4569 60 Registered
1 IAX2 registrations.

And the peers are OK too

PobrePi/PobrePi 192.168.1.20 (D) 255.255.255.255 4569 (T) (E) OK (1 ms)
TelephoneWin7/TelephoneWi 192.168.1.2 D a 5060 OK (5 ms)

Name/Username Host Mask Port Status Description
RaspBerry 192.168.1.129 (D) 255.255.255.255 4569 OK (202 ms)
PBXManolo/PBXMa 192.168.1.69 (D) 255.255.255.255 4569 (T) (E) OK (1 ms)

I don’t understand why the authority is rejected.

That’s the configuration of the trunks

register => PobrePi:123456@192.168.1.69

;Trunk
[PBXManolo]
username=PBXManolo
type=friend
host=dynamic
trunk=true
secret=123456
context=casa
qualify=yes
encryption=aes128
auth=md5
requirecalltoken=no

The other server

register => PBXManolo:123456@192.168.1.20

[PobrePi]
username=PobrePi
type=friend
host=dynamic
trunk=yes
secret=123456
context=casa
qualify=yes
encryption=aes128
auth=md5
requirecalltoken=no

And the dialplans

;Trunk
exten => _4XXXX,1,Dial(IAX2/PobrePi/${EXTEN:1})
exten => _4XXXX,n,HangUp()

;***
exten => _4XXXX,1,NoOp()
exten => _4XXXX,n,Dial(IAX2/PBXManolo/${EXTEN:1})
exten => _4XXXX,n,HangUp()

Any ideas?

Best Regards,
Manolo

[code];Trunk
exten => _4XXXX,1,Dial(IAX2/PobrePi/${EXTEN:1})
exten => _4XXXX,n,HangUp()

;***
exten => _4XXXX,1,NoOp()
exten => _4XXXX,n,Dial(IAX2/PBXManolo/${EXTEN:1})
exten => _4XXXX,n,HangUp()
[/code]

Supposing IAX2 trunks are OK. You must add context “casa” in both dialplans. For example:

[casa] exten => _XXXX,1,Dial(SIP/${EXTEN})
It means, every call received from IAX trunk with format XXXX will dial a “SIP/XXXX”

Hi shadowrun

The dial plan was right, the problem was in the trunk side.

I found the issue.
During the authentication, the user indicated in register sentences in the iax.conf file
register => PobrePi:123456@192.168.1.69 (for example) must to be declared in the server as a user type, in other way the authentication fail.

[PobrePi]
username=PobrePi
type=user
host=dynamic
trunk=yes
secret=123456
context=casa
disallow=all
allow=alaw

requirecalltoken=no
transfer=no
canreinvite=no

After that, and indicated transfer=no all work OK

Thanks,
Manolo Q.

Ah, ok. So you already had context “casa” :stuck_out_tongue: :stuck_out_tongue: