Skip to content

Commit

Permalink
Remove bogus auto conversion from SIP uri to TEL uri
Browse files Browse the repository at this point in the history
For ancient reasons, a SIP URI with user=phone was automatically converted to a TEL URI. Such conversion, automatically done, is dangerous - there is nothing in the RFC3261 stating something like this. Even more, the conversion is not complete - besides moving the username parameters to URI parameters, the domain is not stripped and the TEL not added.

(cherry picked from commit 05ece79)
  • Loading branch information
bogdan-iancu committed Jul 3, 2017
1 parent eaafc9b commit 91c14ce
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions parser/parse_uri.c
Expand Up @@ -1205,40 +1205,17 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
goto error_bug;
}
switch(uri->type){
case SIP_URI_T:
if ((uri->user_param_val.len == 5) &&
(strncasecmp(uri->user_param_val.s, "phone", 5) == 0)) {
uri->type = TEL_URI_T;
/* move params from user into uri->params */
p=q_memchr(uri->user.s, ';', uri->user.len);
if (p){
uri->params.s=p+1;
uri->params.len=uri->user.s+uri->user.len-uri->params.s;
uri->user.len=p-uri->user.s;
}
}
break;
case SIPS_URI_T:
if ((uri->user_param_val.len == 5) &&
(strncasecmp(uri->user_param_val.s, "phone", 5) == 0)) {
uri->type = TELS_URI_T;
p=q_memchr(uri->user.s, ';', uri->user.len);
if (p){
uri->params.s=p+1;
uri->params.len=uri->user.s+uri->user.len-uri->params.s;
uri->user.len=p-uri->user.s;
}
}
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 SIP_URI_T:
case SIPS_URI_T:
case URN_SERVICE_URI_T:
/* leave the actual service name in the URI domain part */
/* nothing to do for these URIs */
break;
case ERROR_URI_T:
LM_ERR("unexpected error (BUG?)\n");
Expand Down

0 comments on commit 91c14ce

Please sign in to comment.