[asterisk-dev] Variable Inheritance,
Setting Channel Variables outside of current context
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Thu May 18 08:12:00 MST 2006
On Thursday 18 May 2006 09:41, Peter Beckman wrote:
> On Wed, 17 May 2006, Tilghman Lesher wrote:
> > Variables which you set in Macro (other than the special ARG
> > variables used for passing parameters) will still be set when Macro
> > returns.
>
> IFF the macro is called within the same channel. If the macro is
> called as part of Dial() using the M(x) option, variables set in the
> Macro will NOT be available to the channel that called the Dial();
> correct?
Correct, since Macro is called for the destination channel, not the
source channel.
> >> 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.
>
> Excellent! I'll document that. Does that "destroy" the variable
> within asterisk? IE if I do an AGI GET VARIABLE VARNAME after
> setting it to "" does the AGI return that the variable is unset or
> does it return that the variable is "" (an empty string)?
It does destroy the variable, but it creates a new one in its place with
an empty value. Technically, AGI can see the difference between a
variable that was never set and a variable that is set to the empty
string, though I'm not sure why, since the action taken is usually the
same.
As a result of this thread, I am now subscribed to the -doc list, so
please redirect all future questions regarding documentation there.
--
Tilghman
More information about the asterisk-dev
mailing list