Connecting 2 * servers via iax2


#1

I cannot seem to be able to connect my two Asterisk servers and place a call between them!
In the iax.conf files of each I have the following:

[code]
[boxb-peer]
username=boxA-user
type=peer
secret=password
host=172.16.0.234
disallow=all
allow=gsm
allow=ulaw
allow=alaw

[boxB-user]
type=user
secret=password
host=172.16.0.234
disallow=all
allow=gsm
allow=ulaw
allow=alaw
context=from-internal [/code]
where, of course, switch boxB for boxA as appropriate.
In the extensions.conf file, I have the following line in the [from-internal] context (the context for calls that originate on local extensions)

exten => _7XXX,1,Dial(stdexten, IAX2/boxA-user:password@172.16.0.234/${EXTEN})

When I place a call, I know the system enters this application but the call always fails. The softphone says:

“Call failed: 403 forbidden”

I don’t think the call ever makes it to the other PBX.

If someone could please help me I would gretly appreciate it!
Thanks,
Lilli


#2

Have you tried putting a Register => statement in iax.conf?


#3

GREAT!
I added the registration code and seem to have gotten a bit farther. Both boxes tried to register with the other. Here are the events produced:

Event: Registry Privilege: system,all Channel: IAX2 Username: PBX2 Status: Rejected Cause: Registration Refused

Event: Registry Channel: IAX2 Username: PBX1 Status: Rejected Cause: Registration Refused

Why is the registry being refused? Any suggestions?


#4

Well, the extracts from your iax.conf files posted above have got me confused - maybe they’re confusing you too!

[quote]In the iax.conf files of each I have the following:

[code]
[boxb-peer]
username=boxA-user
type=peer
secret=password
host=172.16.0.234
disallow=all
allow=gsm
allow=ulaw
allow=alaw

[boxB-user]
type=user
secret=password
host=172.16.0.234
disallow=all
allow=gsm
allow=ulaw
allow=alaw
context=from-internal [/code]
where, of course, switch boxB for boxA as appropriate.
[/quote]
If you use different names, it might be clearer what’s going on. For example:

On box A:

[code]
[Bout]
type=peer
username=BtoA
secret=password
host=
disallow=all
allow=gsm
allow=ulaw
allow=alaw
context=fromB

[Bin]
type=user
username=AtoB
secret=password
host=
disallow=all
allow=gsm
allow=ulaw
allow=alaw
context=toB [/code]
On box B:

[code]
[Aout]
type=peer
username=AtoB
secret=password
host=
disallow=all
allow=gsm
allow=ulaw
allow=alaw
context=fromA

[Ain]
type=user
username=BtoA
secret=password
host=
disallow=all
allow=gsm
allow=ulaw
allow=alaw
context=toA [/code]
Then, on box A:

and, on B:

I think i’ve got all this right! It’s made my head spin a bit! :wink:

By the way, i can’t see any point allowing gsm, ulaw and alaw between the two hosts - pick one and only use that. If you’ve got the same preference order on each one, they’ll always use the first one anyway!


#5

But a simpler and less confusing way to do it is to just have one single friend account, rather than two peer/user accounts - after all, you only really need one connection between the two boxes.

On box A:

[boxB] 
type=friend 
username=AtoB 
secret=password 
host=<host B IP address> 
disallow=all 
allow=gsm 
allow=ulaw 
allow=alaw 
context=fromB 

On box B:

[boxA] 
type=friend 
username=AtoB 
secret=password 
host=<host A IP address> 
disallow=all 
allow=gsm 
allow=ulaw 
allow=alaw 
context=fromA 

Then, on box A:

register => AtoB:password@boxB

(Although you probably don’t need to register.)

And that’s it!

It’s not symmetrical like the other method, but it’s easier to debug.


#6

I added the registry commands and this is what the PBXs are doing:

Event: Registry Channel: IAX2 Username: PBX1 Status: Rejected Cause: Registration Refused

Why is the registration refused!?

Thanks for all your help!


#7

What registry commands did you add?


#8

I have:

on Box1
and

on Box2

Thanks!