[Home]

Summary:ASTERISK-15523: [patch] Introduce function for parsing ABNF name-andor-addr = name-addr / addr-spec
Reporter:nick_lewis (nick_lewis)Labels:
Date Opened:2010-01-26 10:35:24.000-0600Date Closed:2010-04-09 11:04:19
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) reqresp_parser.c-nameandoraddr.patch
( 1) reqresp_parser.h-nameandoraddr.patch
( 2) sip.h-nameandoraddr.patch
Description:Many sip headers in many sip methods contain the ABNF structure
name-andor-addr = name-addr / addr-spec
Examples include the to-header, from-header, contact-header, replyto-header

At the moment chan_sip.c makes various different attempts to parse this name-andor-addr structure for each header type and for each sip method with sometimes limited degrees of success.

I recommend that this name-andor-addr structure be parsed by a dedicated function and that it be used irrespective of the specific method or header that contains the name-andor-addr structure
Comments:By: Leif Madsen (lmadsen) 2010-01-28 14:25:15.000-0600

This is considered a feature request, although we'd absolutely love to see a patch for this functionality.

By: nick_lewis (nick_lewis) 2010-01-29 04:04:49.000-0600

I think that the function check_user_full gets the closest to doing a half decent attempt at parsing the name-andor-addr abnf structure so as a first step I will lift the relevant bits from this and drop them into a new function parse_name_andor_addr using it only for check_user_full. I will then try to enhance the new function to do a more accurate job of parsing and ensure that it would be suitable for use in other places where parsing of the name-andor-addr abnf structure is needed. Finally the use of the function can be rolled out across chan_sip.c. I will try to get the first step uploaded here soon but I understand if you need to close the ticket

By: Leif Madsen (lmadsen) 2010-02-01 12:39:58.000-0600

I will certainly leave this issue open for now until you're able to move this forward.

Thanks!

By: nick_lewis (nick_lewis) 2010-03-08 04:35:55.000-0600

This patch provides the name-andor-addr abnf parsing but it does not modify the rest of the code to make use of it. The functionality has been tested in isolation with the included unit tests.

The usage of the function is appropriate wherever the sip standards dictate the presence of the relevant abnf. Examples include the to-header, from-header, contact-header, replyto-header, referto-header, referredby-header, and passertedid-header.

It is also appropriate wherever the sip standards dictate the presence of the name-addr abnf structure (i.e without the addr-spec option). Examples include the recordroute-header, route-header, remotepartyid-header and diversion-header.

By: Leif Madsen (lmadsen) 2010-03-08 11:58:51.000-0600

Thanks for the submission! I'll poke this for review by a developer as time and resources permit. Thanks!

By: nick_lewis (nick_lewis) 2010-03-09 03:08:17.000-0600

I have a number of other patches under construction that depend on this one so I would be delighted if dvossel could find some time to give it the eye. I have not used the review board before but would this patch be suitable there?

By: Leif Madsen (lmadsen) 2010-03-10 10:50:04.000-0600

Absolutely. Any non-trivial change should go through reviewboard actually.

By: Digium Subversion (svnbot) 2010-04-09 11:04:18

Repository: asterisk
Revision: 256530

U   trunk/channels/sip/include/reqresp_parser.h
U   trunk/channels/sip/include/sip.h
U   trunk/channels/sip/reqresp_parser.c

------------------------------------------------------------------------
r256530 | mmichelson | 2010-04-09 11:04:17 -0500 (Fri, 09 Apr 2010) | 21 lines

Add routines for parsing SIP URIs consistently.

From the original issue report opened by Nick Lewis:
Many sip headers in many sip methods contain the ABNF structure
name-andor-addr = name-addr / addr-spec
Examples include the to-header, from-header, contact-header, replyto-header

At the moment chan_sip.c makes various different attempts to parse this name-andor-addr structure for each header type and for each sip method with sometimes limited degrees of success.

I recommend that this name-andor-addr structure be parsed by a dedicated function and that it be used irrespective of the specific method or header that contains the name-andor-addr structure

Nick has also included unit tests for verifying these routines as well, so...heck yeah.

(closes issue ASTERISK-15523)
Reported by: Nick_Lewis
Patches:
     reqresp_parser-nameandoraddr2.patch uploaded by Nick Lewis (license 657

Review: https://reviewboard.asterisk.org/r/549


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=256530