[asterisk-dev] Variable Inheritance, Setting Channel Variables outside of current context

Evan Borgström evan.borgstrom at ca.mci.com
Wed May 17 14:50:11 MST 2006


	This is off-topic of this discussion but since I was dealing with this
earlier today I thought I'd bring it up here.

> 
>>   Once a Global variable is set, how do you "unset" that Global
>> variable, in order to avoid overwriting and variable messyness?
> 
> Setting it to an empty string effectively resets the value.
> 

	Is this true for all variables? Here's the situation that I posted to
the users list. A call is to be terminated via SIP and we have two
possible routes to terminate the call and the first requires a static
value in the P-Asserted-Identity header and the second requires a
variable value in the same header. We do all of our setup and then call
SIPAddHeader to add our P-Asserted-Identity with the static value and
call Dial(). An error occurs so we wish to fall back to the second
provider, more setup work is done and SIPAddHeader is called to add the
new value the second provider wants but when Dial is called this time
instead of only the new value being sent both values are sent and the
request contains two P-Asserted-Identity headers which causes problems
with the second provider.

	For my first try at this I was looping through all of the
SIPADDHEADER0[1-9] variables and if I came across one that was the same
header name as the new variable to set I would call "SET VARIABLE
SIPADDHEADER01 " from an AGI script but that didn't do anything. The
solution that I'm using right now is just to loop through all of those
variables and if I find duplicates set them all to the same value which
results in only 1 header being applied.

	Any thoughts?

-Evan




More information about the asterisk-dev mailing list