- tels uri support and sip/sips user=phone support patch from Juha Heinanen,
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Mon, 28 Feb 2005 15:28:24 +0000 (15:28 +0000)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Mon, 28 Feb 2005 15:28:24 +0000 (15:28 +0000)
 sligthly modified

parser/msg_parser.h
parser/parse_uri.c

index 2bb4376..d96f18d 100644 (file)
@@ -122,7 +122,7 @@ struct sip_uri {
 };
 #endif
 
-enum _uri_type{ERROR_URI_T=0, SIP_URI_T, SIPS_URI_T, TEL_URI_T};
+enum _uri_type{ERROR_URI_T=0, SIP_URI_T, SIPS_URI_T, TEL_URI_T, TELS_URI_T};
 typedef enum _uri_type uri_type;
 
 struct sip_uri {
index c8a5cd5..9dfffbf 100644 (file)
@@ -951,11 +951,28 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
                default:
                        goto error_bug;
        }
-       if (uri->type==TEL_URI_T){
-               /* fix tel uris, move the number in uri and empty the host */
-               uri->user=uri->host;
-               uri->host.s="";
-               uri->host.len=0;
+       switch(uri->type){
+               case SIP_URI_T:
+                       if ((uri->user_param_val.len == 5) &&
+                               (strncmp(uri->user_param_val.s, "phone", 5) == 0)) {
+                               uri->type = TEL_URI_T;
+                       }
+                       break;
+               case SIPS_URI_T:
+                       if ((uri->user_param_val.len == 5) &&
+                               (strncmp(uri->user_param_val.s, "phone", 5) == 0)) {
+                               uri->type = TELS_URI_T;
+                       }
+                       break;
+               case TEL_URI_T:
+               case TELS_URI_T:
+                       /* fix tel uris, move the number in uri and empty the host */
+                       uri->user=uri->host;
+                       uri->host.s="";
+                       uri->host.len=0;
+                       break;
+               case ERROR_URI_T:
+                       break; /* do nothing, avoids a compilation warning */
        }
 #ifdef EXTRA_DEBUG
        /* do stuff */