Inter-company sip trunk problem same extensions

I have two Asterisk servers that have been working with an IAX trunk for several years. I recently upgraded one of the Asterisk servers and changed the trunk to SIP.

The problem I an now having is with conflicting extension numbers on two Asterisk servers. This has not been an issue for several years as each server has a dial prefix to route calls to the other server. For instance Ext 7001 local would dial 7001 but 857001 for the other Asterisk server/office.

Most calls are working between the offices except where there is a matching extension/user on the other end.

When calling a number that has a matching extension/user on the far ens Asterisk finds a match and is attempting to authenticate which fails. Here is a short snip of the sip debug:

Using INVITE request as basis request - 12926e1f5c318ee61ce60aa779237e5b@192.168.118.238
Found peer ‘7804’ for ‘7804’ from 192.168.118.238:5060

<— Reliably Transmitting (NAT) to 192.168.118.238:5060 —>
SIP/2.0 403 Forbidden

For calls that do not have a matching extension/user on the far end it is using the trunk name, no match is found and no authentication is attempted.

Using INVITE request as basis request - 22b87e741214040e57785d1a61d21a95@192.168.118.238
Found peer ‘Bytes-Montreux’ for ‘7894’ from 192.168.118.238:5060

I need some direction on how this should be working in this case. Is there a way to force it to not match the end to end peers?

The trunk config is simple and the same on both ends. I have originally had the context as from-internal

[Bytes-Montreux]
type=friend
context=from-trunk
host=192.168.118.238
disallow=all
allow=ulaw
nat=no
qualify=yes
directmedia=no

The authentication happens because asterisk matches the user (while logging a message about a peer, yeah, wtf ?).
Simply do not define your “extensions” as a friend (friend=user+peer), use peer.
You also should lower the registration interval, the default - 3600secs is hardly suitable for office use. I think asterisk makes some provisions for restoring the registration state upon restart/crash, but it is simply safer to force the phones to reregister every minute or so.

You also might want to read viewtopic.php?t=79338

Thanks for the info Thor. Unfortunately I am still getting the same error. I have changed both ends of the trunk to peer.

The information on type=friend was very useful however.

If I change my extension to one in the same range but not conflicting with one on the other end, I do not get the SIP/2.0 401 Unauthorized or the Found peer.

Does anyone else have thoughts?

Ahhhhh! I got it working. It was the extensions set as friend not the trunk. Probably an original default on this old server.

Did you read the message:

:wink: Amazing how many things fall through the cracks when people get too excited :mrgreen: :mrgreen: :mrgreen: