--- reqresp_parser.c 2014/01/12 14:03:54 1.1 +++ reqresp_parser.c 2014/02/26 22:01:31 @@ -25,7 +25,7 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.2 $") #include "include/sip.h" #include "include/sip_utils.h" @@ -45,6 +45,7 @@ char *endparams = NULL; char *c = NULL; int error = 0; + int teluri_scheme = 0; /* * Initialize requested strings - some functions don't care if parse_uri fails @@ -79,6 +80,7 @@ for (; !ast_strlen_zero(cur); cur = strsep(&scheme2, ",")) { l = strlen(cur); if (!strncasecmp(uri, cur, l)) { + teluri_scheme = !strncasecmp(uri, "tel:", 4); uri += l; break; } @@ -100,6 +102,15 @@ dom = c; userinfo = uri; uri = c; /* userinfo can contain ? and ; chars so step forward before looking for params and headers */ + } else if ( teluri_scheme && (c = strstr(uri, ";phone-context=")) ) { /* TEL URI INVITE RFC3966 patch */ + *c = '\0'; + dom = c + 15; + userinfo = uri; + uri = dom; + } else if ( teluri_scheme && ('+' == uri[0]) ) { /* TEL URI INVITE RFC3966 patch */ + userinfo = uri; /* Global number without context or domain */ + c = strchr(uri, ';'); /* Any further parameters? */ + if ( c ) { *c++ = '\0'; uri = c; } else { uri = ""; } } else { /* domain-only URI, according to the SIP RFC. */ dom = uri;