Connecting Two Asterisk PBX's

Hello,

We are trying to connect to PBX’s to allow extension to extension dialing accross them.
We have PBX1 and PBX2.
PBX1 IP: 192.168.1.1
PBX2 IP: 192.168.2.1

If the same extension number exists on PBX1 and PBX2, the call will not complete.
Looking at SIP logs we receive:

[code]From: “NAME OF USER” sip:520@192.168.1.1;tag=as1b9782f2
To: sip:348@192.168.2.1
Contact: sip:520@192.168.1.1
Call-ID: 49e3d65b4bc53b985d66d2a24f26f27b@192.168.1.1
CSeq: 102 INVITE
User-Agent: FPBX-2.10.0rc1(1.6.2.20)
Date: Tue, 15 Jul 2014 21:23:49 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 286

v=0
o=root 1354395771 1354395771 IN IP4 192.168.1.1
s=Asterisk PBX 1.6.2.20
c=IN IP4 192.168.1.1
t=0 0
m=audio 12996 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
<------------->
[2014-07-15 17:23:49] VERBOSE[404] chan_sip.c: — (14 headers 13 lines) —
[2014-07-15 17:23:49] VERBOSE[404] chan_sip.c: Sending to 192.168.1.1:5060 (NAT)
[2014-07-15 17:23:49] VERBOSE[404] chan_sip.c: Using INVITE request as basis request - 49e3d65b4bc53b985d66d2a24f26f27b@192.168.1.1
[2014-07-15 17:23:49] VERBOSE[404] chan_sip.c: Found peer ‘520’ for ‘520’ from 192.168.1.1:5060
[2014-07-15 17:23:49] VERBOSE[404] chan_sip.c:
<— Reliably Transmitting (no NAT) to 192.168.1.1:5060 —>
SIP/2.0 401
Unauthorized
Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK3d2d1971;received=192.168.1.1;rport=5060
From: “NAME OF USER” sip:520@192.168.1.1;tag=as1b9782f2
To: sip:348@192.168.2.1;tag=as45284950
Call-ID: 49e3d65b4bc53b985d66d2a24f26f27b@192.168.1.1
CSeq: 102 INVITE
Server: Asterisk (1.8.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="500ba736"
Content-Length: 0[/code]

[code]
SIP trunk settings pbx1:

type=peer
context=from-pbx1
canreinvite=no
host=192.168.2.1
disallow=all
allow=ulaw
insecure=invite,port
qualify=yes
permit=192.168.2.0/24[/code]

SIP trunk settings on pbx2: type=peer context=from-pbx1 canreinvite=no host=192.168.1.1 disallow=all allow=ulaw insecure=invite,port qualify=yes permit=192.168.1.0/24

We originally had type=friend but changed it to peer after reviewing some of the documentation but this still prevents the call from completing. I can see Asterisk thinks the user needs to be authenticated as it already exists as a peer in the PBX. Any ideas?

Thanks

It’s the phones that need to be type=peer. You are geting type=user matches against the local phone.

Also, it is bad security practice to make the device name the same as the extension number. It should be large and unpredictable.