Parameter strings can include variables. Variable names are arbitrary strings. They are stored in the respective channel structure.
To set a variable to a particular value, do:
Code Block |
---|
exten => 1,2,Set(varname=value)
|
You can substitute the value of a variable everywhere using ${variablename}. For example, to stringwise append $lala $varname2 to $blabla $varname3 and store result in $koko$varname1, do:
Code Block |
---|
exten => 1,2,Set(kokovarname1=${blablavarname2}${lalavarname3}) |
There are two reference modes - reference by value and reference by name. To refer to a variable with its name (as an argument to a function that requires a variable), just write the name. To refer to the variable's value, enclose it inside ${}. For example, Set takes as the first argument (before the =) a variable name, so:
Code Block |
---|
exten => 1,2,Set(kokovarname1=lalavarname2) exten => 1,3,Set(${kokovarname1}=blablavalue) |
The above dialplan stores to the variable "kokovarname1" the value "lalavarname2" and to variable "lalavarname2" the value "blablavalue".
In fact, everything contained ${here} is just replaced with the value of the variable "here".