[asterisk-dev] Global channel variables

Atis Lezdins atis at iq-labs.net
Sat Nov 24 05:44:15 CST 2007


On 11/23/07, Tilghman Lesher <tilghman at mail.jeffandtilghman.com> wrote:
> On Friday 23 November 2007 08:37:17 Atis Lezdins wrote:
> > Current implementation is some mixture of "mathematical variables" as
> > in xslt, where you can't change variable after it's set, and
> > "programming variables" where you can change them if you have access
> > to them. As dialplan isn't as flexible as xslt, i really miss is
> > ability to set variables of parent channel. This can be done with
> > internal db, but it's quite an overhead for dialplan to do that, and
> > remember to update them all the time.
> >
> > What i propose - to create concept of "global channel variables" that
> > would be held in top-channel, and automatically updated from all child
> > channels (when changes are made). They could have prefix of three
> > underscores, or if those changes won't affect performance in
> > noticeable way - they could simply replace two-underscore variables.
>
> The problem with this is the old "pull the rug out from underneath ourselves"
> issue.  If you allow setting variables from another, you run the risk of
> changing the value in the middle of logic, quite possibly changing the
> results of some calculation in some unforeseen way (for example logic which
> explicitly checks if a value is not zero to avoid a division by zero error,
> then divides could find that it still gets a division-by-zero error, because
> the value was changed in the middle.)
>
> So the obvious fix for this is to segregate those variables into a separate
> space, where both channels can be aware that those values are shared and
> could be changed at any time.  And that is the solution in your first
> paragraph (astdb or another database), which you seem to be opposed to.  We
> like that solution better, because it avoids obvious race conditions.

Is there a possibility where channel and it's child channel are
executing simultenously? Child channel is created only inside some
application - Dial, Queue, etc. So, whenever that application exits,
child channel is either destroyed or masquaraded. I don't see any
situation where child channel is executing in parralel with parent
channel.

Regards,
Atis

-- 
Atis Lezdins
VoIP Developer,
IQ Labs Inc.
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Work phone: +1 800 7502835



More information about the asterisk-dev mailing list