How do I link two asterisk servers?

I have two asterisk boxes and I want to be able to call an extension from one PBX to the other.

Let’s say PBX#1 has extensions 1001-1999 and PBX#2 has the same.
I want PBX#1 to dial 102XXXX to dial PBX#2 extensions.
I want PBX#2 to dial 101XXXX to dial PBX#1 extensions.

How do I set that up? I don’t want to create thousands of inbound rules, that’s not practical.

I tried putting ‘context=from-internal’ in the trunk details from each other PBX but that doesn’t work.
On PBX#1 I would use outbound rule ‘102|XXXX’ and route to PBX#2.
and vise versa on PBX#2.

When ever I try to route a call the other PBX wants a password (error 407).

Any help?

Thanks.

I got it working.

IAX peering is the key. I tried using “type=friend” but that didn’t work. peer/user was the best approach. And IAX uses less bandwidth.

http://www.freepbx.org/forum/freepbx/users/how-to-setup-a-sip-trunk-between-2-local-asterisk-servers-same-lan-no-nat-no-fir

This post has some good examples and info.

TTYL