[asterisk-dev] Global channel variables

Atis Lezdins atis at iq-labs.net
Fri Nov 23 08:37:17 CST 2007


Hi,

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.

As i know - currently variables are copied to child channels, when
child channel is created. So, this won't be as simple as setting just
variable of parent channel. I see two options here:

1) Global variables would be read up from parent channel, first
checking local variables. This would go more with terms of functional
programming, and would probably allow "context variables", and so on.
However, that would require introduction of scope modifiers - if you
got
two variables with the same name, one is local, another global.

2) Instead of copying inherited variables, reference them to parent
channel. Changes of ast_var_t is unavoidable then, but existing
language structure wouldn't change. So - setting
two-underscore-variable would mean that it's always set and read from
parent channel - even when Set(variable=1) issued later. After a
thought, probably not very clear implementation.

Any suggestions, comments?

Regards,
Atis

P.S. - something bad is going with list, already 11th time posting -
no bounces, nothing.

-- 
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