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 #16708)
Reported by: Nick_Lewis
Patches:
      reqresp_parser-nameandoraddr2.patch uploaded by Nick Lewis (license 657

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256530 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2010-04-09 16:04:16 +00:00
parent ae7b76a1b9
commit 4b8f1c8cac
3 changed files with 990 additions and 64 deletions

View File

@@ -1647,4 +1647,34 @@ struct sip_monitor_instance {
struct sip_epa_entry *suspension_entry;
};
/*!
* \brief uri parameters
*
*/
struct uriparams {
char *transport;
char *user;
char *method;
char *ttl;
char *maddr;
int lr;
};
struct contact {
AST_LIST_ENTRY(contact) list;
char *name;
char *user;
char *pass;
char *host;
char *port;
struct uriparams params;
char *headers;
char *expires;
char *q;
};
AST_LIST_HEAD_NOLOCK(contactliststruct, contact);
#endif