[asterisk-dev] [Code Review] SIP uri parsing cleanup

Olle E. Johansson oej at edvina.net
Thu Aug 27 06:07:48 CDT 2009


27 aug 2009 kl. 12.07 skrev Nick Lewis:

> David
>
> Rather than having parse_uri_helper why not keep parse_uri basically
> as-is but simply remove the *scheme. Then have something like
>
> -	if (scheme) {
> -		int l = strlen(scheme);
> -		if (!strncasecmp(uri, scheme, l))
> -			uri += l;
> +		if (!strncasecmp(uri, "sips:", 5)
> +			uri += 5;
> +		else if(!strncasecmp(uri, "sip:", 4)
> +			uri += 4;
> 		else {
> -			ast_debug(1, "Missing scheme '%s' in '%s'\n",
> scheme, uri);
> +			ast_debug(1, "Missing sip/sips scheme in
> '%s'\n", uri);
> 			error = -1;
> 		}
> 	}
>
> It may look a bit odd hardcoding it down here but *scheme never
> contained anything else and is never likely to. After all this is
> chan_*sip*

SIP in fact is open to *any* URI scheme. There are platforms using  
tel: today, and I've been working with solutions using XMPP:

Locking URI's to sip or sips might become a poor solution, mostly  
because of the tel: uri.

/O



More information about the asterisk-dev mailing list