[asterisk-bugs] [Asterisk 0017700]: [patch] When matching peers check invite from domain against domain list
Asterisk Bug Tracker
noreply at bugs.digium.com
Tue Jul 27 15:34:05 CDT 2010
A NOTE has been added to this issue.
======================================================================
https://issues.asterisk.org/view.php?id=17700
======================================================================
Reported By: rsw686
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 17700
Category: Channels/chan_sip/Interoperability
Reproducibility: N/A
Severity: minor
Priority: normal
Status: acknowledged
Asterisk Version: 1.6.2.11-rc1
JIRA: SWP-1943
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2010-07-24 21:29 CDT
Last Modified: 2010-07-27 15:34 CDT
======================================================================
Summary: [patch] When matching peers check invite from domain
against domain list
Description:
In trying to get the Exchange UM play on phone feature to work I developed
this patch. Exchange UM is sending the below SIP invite. Asterisk ignores
the domain when finding a matching SIP peer based on username. Since the
invite from field matches a device in sip.conf with a secret Asterisk is
responding with unauthorized. What I needed was for Asterisk to IP match my
sip peer with insecure=port,invite.
INVITE sip:2001 at voip.mydomain.net;user=phone SIP/2.0
FROM:
""<sip:2001 at exch.testdev.local;user=phone>;epid=079E8F8013;tag=849256682
TO: <sip:2001 at voip.mydomain.net;user=phone>
The debug output looks like
Using INVITE request as basis request -
5c97e0f0-5456-4b82-a7f4-e7f2adeba338
Found peer '2001' for '2001' from 10.10.1.31:19219
The patch address the issue by checking the from domain when domain
support is enabled. In my configuration I just needed to enable
autodomain=yes in sip.conf.
Now the debug output looks like
Using INVITE request as basis request -
54d10d2e-01d1-451e-b21a-ef4bba987a0f
Unknown peer from domain exch.testdev.local
Found peer 'exchange-vm' for '2001' from 10.10.1.31:37810
For those not utilizing domain support this will have no effect. In my
testing with Polycom and Linksys phones all setup the invite with From:
userid at registrationserver.
======================================================================
----------------------------------------------------------------------
(0125145) rsw686 (reporter) - 2010-07-27 15:34
https://issues.asterisk.org/view.php?id=17700#c125145
----------------------------------------------------------------------
I am using FreePBX in device and user mode. I have devices that match user
extensions like 2001, 2002, 2003, 2004. These end up in sip.conf as
[2001]
type=friend
secret=xxxxxx
....
[2002]
type=friend
secret=xxxxxx
....
I have also a trunk to Exchange UM which looks like the below.
[exchange-vm]
type=peer
host=exch.testdev.local
transport=tcp
insecure=port,invite
context=from-internal
Exchange UM works with insecure TCP SIP. Sending calls to Exchange UM
voicemail works great with Dial SIP/exchange-vm. When using the Exchange UM
play on phone feature it creates an invite to asterisk.
INVITE sip:2001 at voip.mydomain.net;user=phone SIP/2.0
FROM:
""<sip:2001 at exch.testdev.local;user=phone>;epid=079E8F8013;tag=849256682
TO: <sip:2001 at voip.mydomain.net;user=phone>
This is where the issue happens. Asterisk has the following code in
check_auth_result
/* First find devices based on username (avoid all
type=peer's) */
peer = find_peer(of, NULL, TRUE, FINDUSERS, FALSE, 0);
/* Then find devices based on IP */
if (!peer) {
peer = find_peer(NULL, &p->recv, TRUE, FINDPEERS,
FALSE, p->socket.type);
}
It you watch the debug output it looks like
Using INVITE request as basis request -
5c97e0f0-5456-4b82-a7f4-e7f2adeba338
Found peer '2001' for '2001' from 10.10.1.31:19219
Asterisk is matching peer 2001 in sip.conf to the INVITE and then proceeds
to send 401 Unauthorized to Exchange UM. If I remove the 2001 device from
sip.conf Asterisk doesn't match the peer, but matches the exchange-vm
trunk.
Using INVITE request as basis request -
413feda8-186c-4fe1-a82d-eb074be527e1
Found peer 'exchange-vm' for '2001' from 10.10.1.31:63436
So with the Asterisk code the way it is I would have to change all my
softphone users to something like 12001, 12002, etc. This is confusing for
them as X-Lite shows on the phone 12002 and they think that is their
extension.
Otherwise I need the check_auth_result code to only match the peer based
on the URI domain. Since the Exchange UM domain (exch.testdev.local) and
Asterisk domain (voip.mydomain.net) are different the 2001 peer would not
be matched and play on phone would work.
Issue History
Date Modified Username Field Change
======================================================================
2010-07-27 15:34 rsw686 Note Added: 0125145
======================================================================
More information about the asterisk-bugs
mailing list