Problem with 3 Asterisk trunked by IAX

hi everybody

here is my situation:
3 asterisk all are fresh install 2.4.2
T1=AFR1 XXX.XXX.XXX.140
T2=AMD1 XXX.XXX.XXX.66
T3=ADZ3 XXX.XXX.XXX.236

extension 2100 on T1 call extension 2200 T2 ok
extension 2100 on T1 call extension 2300 T3 ok
context for extensions is from-internal

but what i want to do is calling extension 2300 on T3 from 1316 on T2 thrue T1 and it doesn’t work

here is my conf
AFR1 (T1)

[TR-AFR1-ADZ3]
accountcode=CODE
disallow=all
allow=gsm
allow=g729
context=from-trunk
host=XXX.XXX.XXX.236
qualify=yes
type=peer

[TR-AFR1-AMD1]
disallow=all
accountcode=odc
allow=gsm
allow=g729
context=from-trunk
host=XXX.XXX.XXX.66
qualify=yes
type=peer

[TR2-AFR1-ADZ3]
disallow=all
allow=gsm
allow=g729
context=from-trunk
host=XXX.XXX.XXX.236
type=user

[TR2-AFR1-AMD1]
disallow=all
allow=gsm
allow=g729
context=from-trunk
host=XXX.XXX.XXX.66
type=user

AMD1 (T2)
[TR-AMD1-AFR1]
type=peer
qualify=yes
host=XXX.XXX.XXX.140
disallow=all
context=from-trunk
allow=gsm
allow=g729
accountcode=odc

[TR2-AMD1-AFR1]
type=user
host=XXX.XXX.XXX.140
disallow=all
context=from-trunk
allow=gsm
allow=g729

ALL DIAL PLAN ARE just
21XX
22XX
23XX

HERE IS the log of AFR1 when i call from AMD1 an extention of ADZ3

– Accepting UNAUTHENTICATED call from XXX.XXX.XXX.66:

requested format = g729,
requested prefs = (alaw|gsm|g729),
actual format = alaw,
host prefs = (alaw|gsm|g729),
priority = mine
– Executing [2300@from-trunk:1] NoOp(“IAX2/TR-AFR1-AMD1-5”, “Catch-All DID Match - Found 2300 - You probably want a DID for this.”) in new stack
– Executing [2300@from-trunk:2] Goto(“IAX2/TR-AFR1-AMD1-5”, “ext-did|s|1”) in new stack
– Goto (ext-did,s,1)
– Executing [s@ext-did:1] Set(“IAX2/TR-AFR1-AMD1-5”, “__FROM_DID=s”) in new stack
– Executing [s@ext-did:2] GotoIf(“IAX2/TR-AFR1-AMD1-5”, “1 ?cidok”) in new stack
– Goto (ext-did,s,4)
– Executing [s@ext-did:4] NoOp(“IAX2/TR-AFR1-AMD1-5”, “CallerID is “pascal AMD1” <1316>”) in new stack
– Executing [s@ext-did:5] Goto(“IAX2/TR-AFR1-AMD1-5”, “”) in new stack
== Spawn extension (ext-did, s, 5) exited non-zero on ‘IAX2/TR-AFR1-AMD1-5’
– Hungup ‘IAX2/TR-AFR1-AMD1-5’

AND THE LOG OF AMD1

– Executing [2300@from-internal:1] Macro(“SIP/1316-b7be4a60”, “dialout-trunk|6|2300||”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/1316-b7be4a60”, “DIAL_TRUNK=6”) in new stack
– Executing [s@macro-dialout-trunk:2] Set(“SIP/1316-b7be4a60”, “DIAL_NUMBER=2300”) in new stack
– Executing [s@macro-dialout-trunk:3] Set(“SIP/1316-b7be4a60”, “ROUTE_PASSWD=”) in new stack
– Executing [s@macro-dialout-trunk:4] GotoIf(“SIP/1316-b7be4a60”, “1?noauth”) in new stack
– Goto (macro-dialout-trunk,s,6)
– Executing [s@macro-dialout-trunk:6] GotoIf(“SIP/1316-b7be4a60”, “0?disabletrunk|1”) in new stack
– Executing [s@macro-dialout-trunk:7] Set(“SIP/1316-b7be4a60”, “_NODEST=”) in new stack
– Executing [s@macro-dialout-trunk:8] Set(“SIP/1316-b7be4a60”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:9] Set(“SIP/1316-b7be4a60”, “GROUP()=OUT_6”) in new stack
– Executing [s@macro-dialout-trunk:10] Macro(“SIP/1316-b7be4a60”, “user-callerid|SKIPTTL”) in new stack
– Executing [s@macro-user-callerid:1] NoOp(“SIP/1316-b7be4a60”, “user-callerid: device 1316”) in new stack
– Executing [s@macro-user-callerid:2] Set(“SIP/1316-b7be4a60”, “AMPUSER=1316”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“SIP/1316-b7be4a60”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] GotoIf(“SIP/1316-b7be4a60”, “0?start”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/1316-b7be4a60”, “REALCALLERIDNUM=1316”) in new stack
– Executing [s@macro-user-callerid:6] NoOp(“SIP/1316-b7be4a60”, “REALCALLERIDNUM is 1316”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/1316-b7be4a60”, “AMPUSER=1316”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/1316-b7be4a60”, “AMPUSERCIDNAME=pascal AMD1”) in new stack
– Executing [s@macro-user-callerid:9] GotoIf(“SIP/1316-b7be4a60”, “0?report”) in new stack
– Executing [s@macro-user-callerid:10] Set(“SIP/1316-b7be4a60”, “AMPUSERCID=1316”) in new stack
– Executing [s@macro-user-callerid:11] Set(“SIP/1316-b7be4a60”, “CALLERID(all)=“pascal AMD1” <1316>”) in new stack
– Executing [s@macro-user-callerid:12] Set(“SIP/1316-b7be4a60”, “REALCALLERIDNUM=1316”) in new stack
– Executing [s@macro-user-callerid:13] NoOp(“SIP/1316-b7be4a60”, “TTL: ARG1: SKIPTTL”) in new stack
– Executing [s@macro-user-callerid:14] GotoIf(“SIP/1316-b7be4a60”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing [s@macro-user-callerid:23] NoOp(“SIP/1316-b7be4a60”, “Using CallerID “pascal AMD1” <1316>”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/1316-b7be4a60”, “record-enable|1316|OUT”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/1316-b7be4a60”, “0?2:4”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] AGI(“SIP/1316-b7be4a60”, “recordingcheck|20080305-174107|1204731667.54645”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
recordingcheck|20080305-174107|1204731667.54645: Outbound recording not enabled
– AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:5] NoOp(“SIP/1316-b7be4a60”, “No recording needed”) in new stack
– Executing [s@macro-dialout-trunk:12] GotoIf(“SIP/1316-b7be4a60”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/1316-b7be4a60”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:14] Macro(“SIP/1316-b7be4a60”, “outbound-callerid|6”) in new stack
– Executing [s@macro-outbound-callerid:1] GotoIf(“SIP/1316-b7be4a60”, “1?start”) in new stack
– Goto (macro-outbound-callerid,s,3)
– Executing [s@macro-outbound-callerid:3] NoOp(“SIP/1316-b7be4a60”, “REALCALLERIDNUM is 1316”) in new stack
– Executing [s@macro-outbound-callerid:4] GotoIf(“SIP/1316-b7be4a60”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,9)
– Executing [s@macro-outbound-callerid:9] Set(“SIP/1316-b7be4a60”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:10] Set(“SIP/1316-b7be4a60”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:11] Set(“SIP/1316-b7be4a60”, “TRUNKOUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:12] GotoIf(“SIP/1316-b7be4a60”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,16)
– Executing [s@macro-outbound-callerid:16] GotoIf(“SIP/1316-b7be4a60”, “1?usercid”) in new stack
– Goto (macro-outbound-callerid,s,18)
– Executing [s@macro-outbound-callerid:18] GotoIf(“SIP/1316-b7be4a60”, “1?report”) in new stack
– Goto (macro-outbound-callerid,s,22)
– Executing [s@macro-outbound-callerid:22] NoOp(“SIP/1316-b7be4a60”, “CallerID set to “pascal AMD1” <1316>”) in new stack
– Executing [s@macro-dialout-trunk:15] GotoIf(“SIP/1316-b7be4a60”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,17)
– Executing [s@macro-dialout-trunk:17] AGI(“SIP/1316-b7be4a60”, “fixlocalprefix”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix

fixlocalprefix: Using pattern 21XX
fixlocalprefix: Using pattern 22XX
fixlocalprefix: Using pattern 23XX
== fixlocalprefix: Dialpattern 23XX matched. 2300 → 2300
– AGI Script fixlocalprefix completed, returning 0
– Executing [s@macro-dialout-trunk:18] Set(“SIP/1316-b7be4a60”, “OUTNUM=2300”) in new stack
– Executing [s@macro-dialout-trunk:19] Set(“SIP/1316-b7be4a60”, “custom=IAX2/TR-AMD1-AFR1”) in new stack
– Executing [s@macro-dialout-trunk:20] GotoIf(“SIP/1316-b7be4a60”, “1?gocall”) in new stack
– Goto (macro-dialout-trunk,s,22)
– Executing [s@macro-dialout-trunk:22] Macro(“SIP/1316-b7be4a60”, “dialout-trunk-predial-hook”) in new stack
– Executing [s@macro-dialout-trunk:23] GotoIf(“SIP/1316-b7be4a60”, “0?bypass|1”) in new stack
– Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/1316-b7be4a60”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:25] Dial(“SIP/1316-b7be4a60”, “IAX2/TR-AMD1-AFR1/2300|300|”) in new stack
– Called TR-AMD1-AFR1/2300
Tx-Frame Retry[000] – OSeqno: 000 ISeqno: 000 Type: IAX Subclass: NEW
Timestamp: 00006ms SCall: 00005 DCall: 00000 [XXX.XXX.XXX.140:4569]
VERSION : 2
CALLED NUMBER : 2300
CODEC_PREFS : (alaw|gsm|g729)
CALLING NUMBER : 1316
CALLING PRESNTN : 0
CALLING TYPEOFN : 0
CALLING TRANSIT : 0
CALLING NAME : pascal AMD1
LANGUAGE : fr
FORMAT : 256
CAPABILITY : 57610
ADSICPE : 2
DATE TIME : 2008-03-05 17:41:08

Rx-Frame Retry[ No] – OSeqno: 000 ISeqno: 001 Type: IAX Subclass: ACCEPT
Timestamp: 00008ms SCall: 00005 DCall: 00005 [XXX.XXX.XXX.140:4569]
FORMAT : 8

– Call accepted by XXX.XXX.XXX.140 (format alaw)
– Format for call is alaw
Tx-Frame Retry[-01] – OSeqno: 001 ISeqno: 001 Type: IAX Subclass: ACK
Timestamp: 00008ms SCall: 00005 DCall: 00005 [XXX.XXX.XXX.140:4569]
Rx-Frame Retry[ No] – OSeqno: 001 ISeqno: 001 Type: IAX Subclass: HANGUP
Timestamp: 00105ms SCall: 00005 DCall: 00005 [XXX.XXX.XXX.140:4569]
CAUSE CODE : 0

Tx-Frame Retry[-01] – OSeqno: 001 ISeqno: 002 Type: IAX Subclass: ACK
Timestamp: 00105ms SCall: 00005 DCall: 00005 [XXX.XXX.XXX.140:4569]
– Hungup ‘IAX2/TR-AMD1-AFR1-5’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:26] Goto(“SIP/1316-b7be4a60”, “s-CHANUNAVAIL|1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] GotoIf(“SIP/1316-b7be4a60”, “1?noreport”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,3)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:3] NoOp(“SIP/1316-b7be4a60”, “TRUNK Dial failed due to CHANUNAVAIL - failing through to other trunks”) in new stack
– Executing [2300@from-internal:2] Macro(“SIP/1316-b7be4a60”, “outisbusy|”) in new stack
– Executing [s@macro-outisbusy:1] Playback(“SIP/1316-b7be4a60”, “all-circuits-busy-now|noanswer”) in new stack
– Playing ‘all-circuits-busy-now’ (language ‘fr’)

i try a lot of different context and i have always the same error code …
if someone have an idea please give it to me
thanks in advance
pascal

  1. Use either Peer and User or Friend (Friend is Peer & User). If you use Friend then you enter both the inbound and outbound settings in the Peer box and nothing in the user.

  2. If your servers are on different subnets but you do not traverse NAT going between the servers you need to setup the local subnets in the conf files - this is covered elewhere so I won’t repeat it here and then remove the qualify settings

  3. If communications traverse NAT between the servers you need to configure appropriately - again this is covered in detail elsewhere.

  4. There is something wrong with how you have the codecs setup :-

requested format = g729,
requested prefs = (alaw|gsm|g729),
actual format = alaw,
host prefs = (alaw|gsm|g729),

  1. context from-trunk is the correct context

  2. Make sure that you have created the inbound route on all servers

DUNDi. If you do, post your questions in a new DUNDi thread and I’ll try and help.

is there a reason you want to force calls to go T3 - T1 - T2 instead of going direct T3 - T2? Going the extra step adds latency, load on T1, takes up bandwidth and creates a point of failure that will cut off communications. You can simply create a trunk between all three, or create a single DUNDi trunk and given you have only 3 systems, peer each to the other two - then all your calls will flow direct and your configuration will actually be simpler.