IAX2 Trunk between servers call route questions

Hello,

I have been reviewing people posts about trunking between servers and can not seem to find anything that applies to my issue.

I have two servers one in CALGARY and one in VANCOUVER. The servers talk just fine when I dial by extensions. However it is a lack of understanding of call flow over IAX that I think is my issue, I am sure i have a syntax issue. The way I want it to work is if I dial any number beginning with 9403 the call will route via the calgary server and same for Vancouver. IE:
IF 9403XXXXXXX Then pass call to -> CALGARY for outward local dialing.
IF 9604XXXXXXX Then pass call to -> VANCOUVER for outward local dial.

Right now I have the following config:

VANCOUVER########################
–IAX.CONF–
[size=75][CALGARY]
Type = friend
user = ######
secret = #######
host = ###.###.###.###
[/size]

–EXTENSIONS.CONF–
[size=75][numberplan-custom-1]
exten = _9403XXXXXXX.,1,Dial(IAX2/CALGARY/${EXTEN:1})
[/size]

CALGARY#########################
–IAX.CONF–
[size=75][KAMLOOPS]
Type = friend
User = ######
Secret = #######
Host = ###.###.###.###[/size]

–EXTENSIONS.CONF–
[size=75][numberplan-custom-1]
exten = _9604XXXXXXX.,1,Dial(IAX2/VANCOUVER/${EXTEN:1})
[/size]

According to the calgary server the call does not get that far when initiated from Vancouver

ASTERISK DATA FOUND ON VANCOUVER SERVER:
[size=75][b] – Executing [94037######@numberplan-custom-1:1] Macro(“SIP/3000-08214ba8”, “trunkdial|/4037######”) in new stack
– Executing [s@macro-trunkdial:1] Dial(“SIP/3000-08214ba8”, “/4037######”) in new stack
[Jan 3 17:58:08] WARNING[3866]: channel.c:3188 ast_request: No channel type registered for ‘’
[Jan 3 17:58:08] WARNING[3866]: app_dial.c:1106 dial_exec_full: Unable to create channel of type ‘’ (cause 66 - Channel not implemented)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-trunkdial:2] Goto(“SIP/3000-08214ba8”, “s-CHANUNAVAIL|1”) in new stack
– Goto (macro-trunkdial,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-trunkdial:1] NoOp(“SIP/3000-08214ba8”, “”) in new stack
== Auto fallthrough, channel ‘SIP/3000-08214ba8’ status is ‘CHANUNAVAIL’

<— Transmitting (NAT) to 192.168.3.102:5060 —>
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 192.168.3.102:5060;branch=z9hG4bK2827395313036815394;received=192.168.3.102;rport=5060
From: 3000 sip:3000@192.168.3.203;tag=2461524258
To: “94037######” sip:94037######@192.168.3.203;tag=as3677af43
Call-ID: 280191617-58193121781@192.168.3.102
CSeq: 2 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: sip:94037######@192.168.3.203
Content-Length: 0
X-Asterisk-HangupCause: Channel not implemented
X-Asterisk-HangupCauseCode: 66[/b][/size]

IF I am mistaken about another post on this topic you have my appologies, I just cant seem to find anything…

Thank you
-Jim Akeson

Jim,
Is the IAX module loaded ?

My dial string for asterisk is a bit different:
exten => _X.,1,Dial(IAX2/user_name@carrier/${EXTEN})

Hello, it must be loaded, I can dial by extension across cities, its only when I want to route outbound calls to a different asterisk server.

@carrier is how I deal with outbound calls leaving the server locally, what I need to do is transfer it to one of the cities then transfer it out from the server to the carrier.

-Jim

I just edited my post above. Please have a look at it. Also who is your carrier ? They may have the info on their site.

Carrier is ACANAC, but it seems we might be going the wrong direction, I am not trying to direct the call to the carrier, I am trying to pass the call to another asterisk server, then pass the call to the provider.

All functions of the asterisk server are working 100%, I can dial out long distance and I can dial any local/remote extensions, I am just trying to figure out how to pass the call over the IAX link between servers then out to the provider.

Right now I can not even get the call to the other asterisk server.

sorry if you already understand all this, just want to ensure we are on the same page.

Just a little more detail.

I never did IAX trunking and I am too tired to think much now. You may want to also look at your firewall, NAT and or port forwarding. Google is your friend.

voip-info.org/wiki-IAX

P.S. Kudo’s on the image that you created. It was done real nicely.

Hey,

Thanks for the help, the speed is also appreciated.

As the IAX trunk works 100% that rules out firewall or network issues, so the only issue I need to figure out is how to transfer external phone calls dialed in Vancouver through another server located in Calgary to the provider (acanac).

Thanks again.

-Jim

this looks similar to a setup i did in a lab, i had 3 asterisk machines, 2 behind nat and i was using the one out in the open (no nat) to route the calls back and forth. i fought with this thing for a while and one of the things that you haven’t posted is the context in which you are dropping your call over the trunk. that was one if the issues that i experienced even though it was only in a lab. i’ll do some digging for my conf files and if i can find them i’ll post them.

hope that helps

Hey, I would love to get the configs. Thank you. In the mean time, here is all of the relevent info from my configs:

-EXTENSIONS.CONF-
[numberplan-custom-1]
plancomment = DialPlan1
include = default
exten => _NXXXXXX,1,Macro(dialacanac,403${EXTEN})
exten => _NXXXXXX,n,Hangup
exten => _1NXXXXXXXXX,1,Macro(dialacanac,${EXTEN})
exten => _1NXXXXXXXXX,n,Hangup
exten => _NXXXXXXXXX,n,Macro(dialacanac,${EXTEN})
exten => _3XXX,1,Dial(IAX2/VANCOUVER/${EXTEN},30,r)
exten => _3XXX,2,Congestion

[macro-dialacanac]
exten => s,1,Set(CALLERID(num)=14037######)
exten => s,2,Dial(SIP/${ARG1}@acanac-out,60)
exten => s,3,Goto(s-${DIALSTATUS},1)
exten => s-ANSWER,1,Hangup
exten => s-CONGESTION,1,Congestion(30)
exten => s-CANCEL,1,Hangup
exten => s-BUSY,1,Busy(30)
exten => s-CHANUNAVAIL,1,Congestion(30)

-SIP.CONF-
[acanac-out]
type = peer
dtmfmode = RFC2833
host = voip4.acanac.com
fromuser = ###########
username = USERNAME
secret = SECRET
canreinvite = no
insecure = port,invite
qualify = yes
disallow = all
allow = ulaw

-IAX.CONF-
[VANCOUVER]
Type = friend
User = USERNAME
Secret = SECRET
Host = 2##.#.##.##

Am I missing anything (I am still learning terminology, so bear with me).

Thanks again!!!

-Jim

Ignore this I dont know how it posted 3 times…

Ignore this, dont know how it posted 3 times…

ok, when i did this setup i did it from scratch, no asterisknow/trixbox/freepbx, so my stuff may look a little different.

i’m noticing in the configs that you posted that you are not placing the iax calls into a context when you dial

exten = _9403XXXXXXX.,1,Dial(IAX2/CALGARY/${EXTEN:1}) <-- your line

exten=>_20xx,1,Dial(IAX2/192.168.0.111/${EXTEN}@default) <-- my line

the @default at the end tells asterisk what context to drop this call to. your problem may be similar. if your contexts and includes are right then you may not even need that, but my experience made me put it there, i believe i was getting a similar error in my cli like you posted

i also noticed that your iax.conf does not have “trunk=yes” and specifies no context as to where the call is supposed to go “context=”

also in your sip.conf file the acanac-out section has canreinvite = no which may be another problem as the call you are trying to make is originating from another system on another channel type (iax to sip), of course i am assuming that your clients are sip from the look of things and i also believe that canreinvite=yes is a default if not specified, i could be wrong, but its worth looking at.

voip-info.org/wiki-Asterisk+sip+canreinvite

Can you have a read bellow and tell me if this looks right to you then?

-EXTENSIONS.CONF-
[numberplan-custom-1]
plancomment = DialPlan1
include = default
exten => _NXXXXXX,1,Macro(dialacanac,403${EXTEN})
exten => _NXXXXXX,n,Hangup
exten => _1NXXXXXXXXX,1,Macro(dialacanac,${EXTEN})
exten => _1NXXXXXXXXX,n,Hangup
exten => _NXXXXXXXXX,n,Macro(dialacanac,${EXTEN})
;exten => _3XXX,1,Dial(IAX2/VANCOUVER/${EXTEN},30,r)
exten => _3XXX,1,Dial(IAX2/VANCOUVER/${EXTEN}@VANCOUVER)
exten => _3XXX,2,Congestion

[macro-dialacanac]
exten => s,1,Set(CALLERID(num)=14037######)
exten => s,2,Dial(SIP/${ARG1}@acanac-out,60)
exten => s,3,Goto(s-${DIALSTATUS},1)
exten => s-ANSWER,1,Hangup
exten => s-CONGESTION,1,Congestion(30)
exten => s-CANCEL,1,Hangup
exten => s-BUSY,1,Busy(30)
exten => s-CHANUNAVAIL,1,Congestion(30)

-SIP.CONF-
[acanac-out]
type = peer
dtmfmode = RFC2833
host = voip4.acanac.com
fromuser = ###########
username = USERNAME
secret = SECRET
canreinvite = yes
insecure = port,invite
qualify = yes
disallow = all
allow = ulaw

-IAX.CONF-
[VANCOUVER]
Type = friend
User = USERNAME
Secret = SECRET
Host = 2##.#.##.##
Trunk=yes
context=VANCOUVER

If so, I will begin the research to better understand these options, this is great help. I am trying to learn all of these options, but the refference material I have found so far does not explain the individual options here.

it looks like its right assuming you have a VANCOUVER context on the server you’re calling. in your extensions.conf file, do you have a context for VANCOUVER? you probably want to drop them in the default context as you are issuing an include = default in your [numberplan-custom-1] context

remember that unless you specify that 2 context can talk to each other, they won’t. this is for security purposes. i highly recommend the book “Asterisk, the future of telephony” its an o’reilly book and its helped me to figure out and have a better understanding of asterisk as a whole

citsolutions.biz/asterisk.zip

these are some documents that helped me figure out iax trunking, between the book and these documents and , hopefully, any insight i have given, you should be able to figure it out. i would have put the book in the zip file, but that would be illegal :wink:

This is great! Well, I have a context on Calgary server called [VANCOUVER] and on on Vancouver server called [CALGARY], so if that is the case, calling from Vancouver to Calgary I would do this:
exten => _3XXX,1,Dial(IAX2/CALGARY/${EXTEN}@CALGARY)

Correct?

As for the book, it is now free: downloads.oreilly.com/books/9780596510480.pdf I just had been focusing on a bunch of other books, but if that is your suggestion, I will change what I am reading (it’s really boring anyhow :confused: )

Thanks

-Jim

you could do that, but again i would drop those calls into the same context that your internal users are using since they can already dial out it would be easier, unless you have some need to track stuff for billing and what not (which i have no idea how to do). as for reading this stuff, i work for at&t on t1’s t3’s and so on, and let me tell you, telco can be boring :stuck_out_tongue:

  1. There is no macro-trunkdial in the bits of the dialplan that you posted.

Executing [s@macro-trunkdial:1] Dial(“SIP/3000-08214ba8”, “/4037######”) in new stack

Executing [s@macro-trunkdial:2] Goto(“SIP/3000-08214ba8”, “s-CHANUNAVAIL|1”) in new stack

Executing [s-CHANUNAVAIL@macro-trunkdial:1] NoOp(“SIP/3000-08214ba8”, “”) in new stack

  1. The dialstring ("/4037######") that this macro is passing on to the dial command is incomplete and you are getting a channel creation error. It should be “IAX2/CALGARY/4037######”.

Jan 3 17:58:08] WARNING[3866]: app_dial.c:1106 dial_exec_full: Unable to create channel of type ‘’ (cause 66 - Channel not implemented)

Kind of hard to help you debug when information is missing. Either fix the macro or figure out why your call is hitting this macro instead of where you want/need it to go and you will solve your problem.

That said, the number you dial (4037…) needs to exist in your incoming context at the other end or the call will be rejected most likely with a “No Authority Found” message.

Hey, ok, more information: This is the error I am getting on both servers. I have modified my config a bit:

ERROR ON SERVER 1:
– Executing [100@numberplan-custom-1:1] Dial(“SIP/3002-b58034c8”, “IAX2/CALGARY/100|30|r”) in new stack
– Called CALGARY/100
– Call accepted by [color=red]SERVER2 IP[/color] (format gsm)
– Format for call is gsm
– IAX2/CALGARY-16385 is making progress passing it to SIP/3002-b58034c8
– Hungup ‘IAX2/CALGARY-16385’
== Spawn extension (numberplan-custom-1, 100, 1) exited non-zero on ‘SIP/3002-b58034c8’
– Executing [12505551111@numberplan-custom-1:1] Macro(“SIP/3002-b58034c8”, “viacalgary|12505551111”) in new stack
– Executing [s@macro-viacalgary:1] Set(“SIP/3002-b58034c8”, “CALLERID(num)=12505551111”) in new stack
– Executing [s@macro-viacalgary:2] Dial(“SIP/3002-b58034c8”, “IAX2/12505551111@CALGARY|60”) in new stack
– Called 12505551111@CALGARY
[May 20 20:42:59] WARNING[2949]: chan_iax2.c:7542 socket_process: Call rejected by [color=red]SERVER2 IP[/color]: No authority found
– Hungup ‘IAX2/CALGARY-16386’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-viacalgary:3] Goto(“SIP/3002-b58034c8”, “s-CHANUNAVAIL|1”) in new stack
– Goto (macro-viacalgary,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-viacalgary:1] Congestion(“SIP/3002-b58034c8”, “30”) in new stack
== Spawn extension (macro-viacalgary, s-CHANUNAVAIL, 1) exited non-zero on ‘SIP/3002-b58034c8’ in macro ‘viacalgary’
== Spawn extension (macro-viacalgary, s-CHANUNAVAIL, 1) exited non-zero on ‘SIP/3002-b58034c8’

ERROR ON SERVER2:
[May 20 21:41:42] NOTICE[2944]: chan_iax2.c:7332 socket_process: Rejected connect attempt from [color=red]SERVER1 IP[/color], who was trying to reach ‘s@’

–CONFIGURATION–

SERVER 1 EXTENSIONS.CONF:
[custom-numberplan-1]
exten => _1250XXXXXXX,1,Macro(viacalgary,${EXTEN})

[macro-viacalgary]
exten => s,1,Set(CALLERID(num)=12505552222)
exten => s,2,Dial(IAX2/{ARG1}@CALGARY,60) exten => s,3,Goto(s-{DIALSTATUS},1)
exten => s-ANSWER,1,Hangup
exten => s-CONGESTION,1,Congestion(30)
exten => s-CANCEL,1,Hangup
exten => s-BUSY,1,Busy(30)
exten => s-CHANUNAVAIL,1,Congestion(30)

SERVER 1 IAX.CONF:
[CALGARY]
Type = friend
User = USERNAME
Secret = PASSWORD
Host = [SERVER2 IP]
Trunk = yes
context = CALGARY
allow = ulaw

SERVER 2 IAX.CONF:
[KAMLOOPS]
Type = friend
User = USERNAME
Secret = PASSWORD
Host = [SERVER1 IP]
Trunk = yes
context = KAMLOOPS
allow = ulaw

SERVER 2 IAX.CONF:
[default]
exten => _1NXXXXXXXXX,1,Macro(dialacanac,${EXTEN})

(Dialacanac is the usuall macro I use to dial out with server 2)

I have been fighting with this for a while, i would REALLY love some help. I your above advice but for some reason I can not find my notes from it. I would appreciate being able to start from this point to continue to resolve this issue.

just out of curiosity, the usernames and passwords for the iax accounts on your systems, are they the same? or are they different? if they are start off by making them the same, its easier. that should take care of the authority problem, the other thing that may be happening is

Rejected connect attempt from SERVER1 IP, who was trying to reach ‘s@’

looks like it doesn’t know where to send the call, like an extension is not being passed. that could be due to the authority problem though.

also something that may work for you is the switch=> statement
have to say though, i never tried using it though