[asterisk-dev] [svn-commits] mmichelson: branch 1.4 r89090 - /branches/1.4/channels/chan_sip.c

Johansson Olle E oej at edvina.net
Thu Nov 8 11:26:08 CST 2007


Matt just lost 10 points of karma by adding a function to chan_sip  
without any documentation.
Doesn't it give you a hint that all other functions in this channel  
has documentation?

File, remove this mans muffin-ranson tomorrow. No friday muffins... :-)

Also, Matt, I think this should be fixed in the URL/URN/URI encoding/ 
decoding functions, not like this
because you might end up with dual encoding which is BAD.

/O

7 nov 2007 kl. 23.40 skrev SVN commits to the Digium repositories:

> Author: mmichelson
> Date: Wed Nov  7 16:40:35 2007
> New Revision: 89090
>
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=89090
> Log:
> This patch makes it possible for SIP phones to dial extensions  
> defined with '#' characters
> in extensions.conf AND maintain their escaped characters when  
> forming URI's
>
> (closes issue #10681, reported by cahen, patched by me, code review  
> by file)
>
>
> Modified:
>    branches/1.4/channels/chan_sip.c
>
> Modified: branches/1.4/channels/chan_sip.c
> URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=89090&r1=89089&r2=89090
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- branches/1.4/channels/chan_sip.c (original)
> +++ branches/1.4/channels/chan_sip.c Wed Nov  7 16:40:35 2007
> @@ -3888,6 +3888,16 @@
> 	return res;
> }
>
> +static char *translate_escaped_pound(char *exten)
> +{
> +	char *rest, *marker;
> +	while((marker = strstr(exten, "%23"))) {
> +		rest = marker + 3;
> +		*marker++ = '#';
> +		memmove(marker, rest, strlen(rest) + 1);
> +	}
> +	return exten;
> +}
>
>
> /*! \brief Initiate a call in the SIP channel
> @@ -4014,8 +4024,7 @@
> 	i->owner = tmp;
> 	ast_module_ref(ast_module_info->self);
> 	ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
> -	ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
> -
> +	ast_copy_string(tmp->exten, translate_escaped_pound(ast_strdupa(i- 
> >exten)), sizeof(tmp->exten));
>
> 	/* Don't use ast_set_callerid() here because it will
> 	 * generate an unnecessary NewCallerID event  */
> @@ -8714,6 +8723,19 @@
> 			if (!oreq)
> 				ast_string_field_set(p, exten, uri);
> 			return 0;
> +		} else { /*Could be trying to match a literal '#'. Try replacing  
> and see if that works.*/
> +			char *tmpuri = ast_strdupa(uri);
> +			char *rest, *marker;
> +			while((marker = strstr(tmpuri, "%23"))) {
> +				rest = marker + 3;
> +				*marker++ = '#';
> +				memmove(marker, rest, strlen(rest) + 1);
> +			}
> +			if(ast_exists_extension(NULL, p->context, tmpuri, 1, from) || ! 
> strcmp(uri, ast_pickup_ext())) {
> +				if(!oreq)
> +					ast_string_field_set(p, exten, uri);
> +				return 0;
> +			}
> 		}
> 	}
>
>
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> svn-commits mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/svn-commits

---
* Olle E Johansson - oej at edvina.net
* Cell phone +46 70 593 68 51, Office +46 8 96 40 20, Sweden






More information about the asterisk-dev mailing list