Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Asterisk Dialplan variables are divided into three groups:
Global variables are reachable in all channels, all of the time. Channel variables are only reachable within the channel.
For more information on the predefined variables, see Globally predefined channel variables
Global and Channel variables:
Global variables are defined and reached with the GLOBAL() dialplan function and the set application, like
exten => 1234,1,set(GLOBAL(myvariable)=tomteluva)
Channel variables are defined with the set() dialplan application
exten => 1234,1,set(xmasattribute=tomtegröt)
Global variables can also be set in the [globals] section of extensions.conf. The setting clearglobalvars in extensions.conf [general] section affects whether or not the global variables defined in globals are reset at dialplan reload.
There are CLI commands to change and read global variables. This can be handy to reset counters at midnight from an external script.
Variable handling is managed within pbx.c You need to include pbx.h to reach these functions.
The variables is a linked list stored in the channel data structure with the list starting at varshead in struct ast_channel