[asterisk-dev] [Code Review] SIP Interop - Add an option to truncate user field at '; 's for the purpose of finding an extension.
David Vossel
reviewboard at asterisk.org
Fri May 13 11:17:03 CDT 2011
> On 2011-05-13 10:12:38, David Vossel wrote:
> > This fixes the instance where we are matching the extension in get_destination, but what about every other place sip URI's are parsed. For instance, isn't this a problem when matching peer names as well?
>
> jrose wrote:
> I imagine it very easily could, but the only scenario the bug reporter mentioned was the case where he was trying to make a call and couldn't connect to the extension. So really, I don't know much about how it matches peer names at the moment. I also don't know if there is any need to fix it up to match peer names. I don't think the reporter or any of the responders mentioned anything about problems relating to them, and for all I know at the moment, the device in question might not be throwing in all these user parameters for things like REGISTER, SUBSCRIBE, or whatever else uses a peer name.
>
> So yeah... hard to say if it's a problem or not.
The peer is matched on the receive address in the issue linked to this review. That's why it does not cause an issue for them. For Users connecting to Asterisk we attempt to authenticate using the userfield portion of the From header, which could be jacked up just like the request URI. At least it appears this is possible based on the From header I observed in the issue.
From: "KANOBE LLC " <sip:2069106501;phone-context=+1 at 76.191.73.19:5060;user=phone>;tag=9b85b6358c7c201476787c3241c38f29
If you are interested as to exactly where peer/user's are matched, take a look at the check_peer_ok() function in chan_sip.
The most consistent way to solve this issue is to have every URI's userfield stripped when this option is enabled.
- David
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1216/#review3543
-----------------------------------------------------------
On 2011-05-13 10:05:32, jrose wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1216/
> -----------------------------------------------------------
>
> (Updated 2011-05-13 10:05:32)
>
>
> Review request for Asterisk Developers, Russell Bryant, David Vossel, and Leif Madsen.
>
>
> Summary
> -------
>
> This is the latest in a long series of attempts to address an interoperability concern mentioned in the bug. SIP URIs are including semicolon delimited user parameters and trying to get rid of them without something overkill like eating strings starting at semicolons is tough. This option is primarily for people who are having this particular problem and aren't wise to the cool stuff you can do with pattern matching and dialplan functions and control statements. That way when they pop up in chat saying their extension wasn't found when it was RIGHT THERE, we can quickly tell them "Yeah, you can enable this option right here. Or well, you could go read this book *plug book link here* and learn to do it the awesome way." And nine times out of ten they'll probably be satisfied with this easier method since putting semicolons into extensions requires some level of voodoo involving setting dialplan in DB or at the very least, using an escape character (and using backslash in front of the semicolon also includes the backslash in the extension for some reason, which is weird. Without backslash, it just comments out the rest and no extension is made. This might be a bug.).
>
> So anyway, here's an option to strip everything after a semicolon for extension matching. It's basically the same as the very first patch I made for this, but it seems like that's what is wanted at the moment.
>
>
> This addresses bug 18344.
> https://issues.asterisk.org/view.php?id=18344
>
>
> Diffs
> -----
>
> /branches/1.8/channels/chan_sip.c 318634
> /branches/1.8/channels/sip/include/sip.h 318634
> /branches/1.8/configs/sip.conf.sample 318634
>
> Diff: https://reviewboard.asterisk.org/r/1216/diff
>
>
> Testing
> -------
>
> sipp to send a request for the extension with and without the option enabled.
>
> actual user field:
> 2005;phone-context=+1;npdi=yes
>
> matches extension without option:
> 2005;phone-context=+1;npdi=yes
>
> matches extension with option:
> 2005
>
>
> Thanks,
>
> jrose
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110513/a2907d3f/attachment.htm>
More information about the asterisk-dev
mailing list