Connect two Asterisk BOXes

I have sucefully setup two asterisk BOXes, I call them SERVER A and SERVER B. Now I want to connect them, so that the users from either server can call each other.

user from SERVER A named : home1(SIP telphone No is 401)
user from SERVER B named: server1(SIP telphone No is 501)

extensions of SERVER A
exten=> _7XXX,1,Dial(IAX2/serverB/${EXTEN:1},30,r)

extensions of SERVER B
exten=> _8XXX,1,Dial(IAX2/serverA/${EXTEN:1},30,r)

when I connect server A as ‘home1’, I want to call ‘server1’ in server B, I use the No. 7501.
And the asterisk server B console tells that:

Jun 30 18:14:20 NOTICE[31132]: chan_iax2.c:6812 socket_read: Rejected connect attempt from 1xx.xx.xxx.XX, request ‘501@incoming’ does not exist

where 1xx.xx.xxx.XX is the IP address of Server A.

Can someone tell me what is wrong?

As I though SERVER B receive the request but don’t know how to handle it.

P.S all the user extensions diretries are in one block in extensions.conf file, which name [internal].

I don’t know what is the meaning of ‘501@incoming’ in console

501 is the extension, and incoming is the context.

so, you’d need something like this on server B

[code]
[incoming]

exten => 501,1,Playback(tt-weasels)[/code]

try that, you should hear something if your IAX connection is working.

Hi, thanks your answer. But I have done extact what you told me to do. Here it is

[code][internal]
exten => 100,1,Dial(SIP/john)
exten => 100,2,Busy
exten => 611,1,Echo()

exten => 101,1,Dial(IAX2/john)
exten => 101,2,Busy

exten=> 501,1,Dial(SIP/server1)
exten=> 501,2,Busy

exten=> 502,1,Dial(IAX2/server1)
exten=> 502,2,Busy

[/code]

I though the [incoming] is not the forced to use, I just use the [internal] instead.

said it in more details in SERVER A I have done following
iax.conf

register =>john:welcome@IP of SERVER B

[john]
type=friend
user=john
secret=welcom
host=IP of SERVER B

extension.conf

[internal]
exten => _7XXX,1,Dial(IAX2/john/${EXTEN:1},30,r)
exten => _7XXX,2,Busy

exten => 401,1,Dial(SIP/home1)
exten => 401,2,Busy

In the SERVER B I also done the same.

INCOMING not INTERNAL

check your context…you have the context set as internal, not incoming.

in iax.conf, you can define the context you want to use…so under your [john] context in iax.conf, add context=internal

or just add an incoming context, either way should work.

Thank whoiswese.

I don’t know why since I change everything in incoming everything is all right. In fact before I jave done

[server1]
host = dynamic
type = friend
;auth = md5
secret = welcome
context = internal

But it doesn’t work when i use the internal. But anyway it is just the name, I use the iincoming instead of the internal

Now I have the new problem

since I connect the two BOXes, now home1 can call server 1 using the No. 7501. But when server1 pick up the phone. home1 can’t hear server1, but server1 can hear home1

home1-----speak to-------->server1 works

server1-----speark to------>home1 no sound and no logs from asterisk

I don’t know why. I am sure both OS sound system work well. (speaker and microphone)

++++++++++++++++++++++++++++=
Another question is that home1 can call server1, but server1 can’t call home1

the asterisk giving the hits: unable to create channel of type IAX2 (case 3- No route to destination)

As I understand it means that SERVER A registry in SERVER B doesn’t work.
my network is : SERVERA using VPN to connect the network, so it has only [color=red]dynamic IP.[/color]
SERVER B has [color=red]static IP[/color]

configuration file in SERVER B
iax.conf

[yan]
type=friend
user=yan
secret=welcome
host=dynamic

extensions.conf

exten => _8XXX,1,Dial(IAX2/yan/${EXTEN:1},30,r)
exten => _8XXX,2,Busy

I check the information in voip-info.org http://www.voip-info.org/wiki-Asterisk±+dual+servers
all my config was based on this website information, I using the example 2 as a draft.

I am not so sure whether it supported the NAT, when two servers connect. As I using IAX2, it should be no problem.

how is your network configured, it sounds like you have a NAT somewhere in there…

I don’t know exactly the network. I am doing this test in my lab.

But I also try to use the Static IP-----Both sides. it doesn’t work.

Just one SERVER need to have the register => xxxxx in the iax.conf,right?

well, if you can’t tell me if there is a NAT inbetween your two servers, there isn’t much i can do.

what are the IP addresses of each server?
if you can, set them up like 10.100.1.1 and 10.100.1.2.

here is an excerpt from our iax.conf on the server with IP 10.100.6.60, which we’ll call serverA.

[code]general]
bindport=4569
bindaddr=0.0.0.0
disallow=all
allow=ulaw
allow=gsm
context=from-inside

[serverB]
type=friend
host=10.100.1.59
secret=1234
context=from-inside
disallow=all
allow=ulaw
allow=alaw
allow=gsm[/code]

in extensions.conf on serverB, we have the following to route calls to serverA:

exten => 101,1,Set(CALLERID(name)=serverB)
exten => 101,2,Dial(IAX2/serverB:1234@10.100.1.60/101)
exten => 101,3,Hangup

the dial command tells the system to dial using IAX, with username serverB and password 1234, connecting to server 10.100.1.60, and dialing extension 101.

your setup looks like it should work, but i’d guess from the error that you have a NAT in the way. you can get by that using IAX, but if you can put these two servers on the same subnet for testing, it makes life much easier.

in the SERVER A

[serverB] type=friend host=10.100.1.59

10.100.1.59 is the IP address of SERVER B, right?

in SERVER B extensions.conf

[code]

exten => 101,1,Set(CALLERID(name)=serverB)
exten => 101,2,Dial(IAX2/serverB:1234@10.100.1.60/101) [/code]

is it necessary to declare to SERVER B that to route SEVER A(10.100.1.60) using

as i think once you regist in SEVER A using the iax2.conf you don’t need to use validate the password and server IP again in the SERVER B.

The problem for me is that SERVER A didn’t has static IP.

But I will try more, Thanks

SERVER B has the IP 132.230.AAA.AAA
SERVER A has IP 10.xx.xx.xx according the vpn, but the vpn server(IP 132.230.XX.XX) is in the same subnet with SERVER A.

When I use the iax2 show registry in the SERVER A, it will show up the SERVER B has succefully registed with the IP. 132.230.xx.xx, which is the ip of the vpn server

the network like follow:
SERVER A-----VPN server(static IP)------internet-----SERVER B(static IP)