Asterisk Readme.variables
VARIABLESParameter strings can include variables Variable names are arbitrary strings.. For example, to stringwise append $lala to $blabla and store result in $koko, do:exten => 1,2,SetVar(koko=${blabla}${lala})There are also the following special variables:${CALLERID} Caller ID${CALLERIDNAME} Caller ID Name only${CALLERIDNUM} Caller ID Number only${EXTEN} Current extension${CONTEXT} Current context${PRIORITY} Current priority${CHANNEL} Current channel name${ENV(VAR)} Environmental variable VAR${EPOCH} Current unix style epoch${DATETIME} Current date time in the format: YYYY-MM-DD_HH:MM:SS${UNIQUEID} Current call unique identifier${SIPDOMAIN} Domain Name for current incomming SIP called, intended for host based routingThere are two reference modes - reference by value and reference by name.. They are stored in the respective channel structure To set a variable to a particular value, do :exten => 1,2,SetVar(varname=value)You can substitute the value of a variable everywhere using ${variablename}. 1
expr1 & expr2Return the evaluation of expr1 if neither expression evaluates toan empty string or zero; otherwise, returns zero.. For example, after the sequence:exten => 1,1,SetVar,"lala=$[1 2]";exten => 1,2,SetVar,"koko=$[2 * ${lala}]";the value of variable koko is "6".. In fact, everything contained ${here} is just replaced with the value of the variable "here".. fromhttp://www voip-info org/wiki/view/Asterisk readme variables 2
To refer to a variable with its name (as an argument to a function that requires a variable), just write the name.. Operators are listed below in order of increasing precedence Operatorswith equal precedence are grouped within { } symbols.. Note: This command has been replaced by Asterisk ExpressionsGENERAL ENHANCEMENTS TO EXTENSION LOGICQUOTINGexten => s,5,BackGround,blablaThe parameter (blabla) can be quoted ("blabla"). HERE
For example, to literally use a $ on the string "$1231", quote it with a preceeding .. expr1 {=, >, >=, <, <=, !=} expr2Return the results of integer comparison if both arguments areintegers; otherwise, returns the results of string comparisonusing the locale-specific collation sequence. cea114251b 4
The arguments and operands of the expression MUST BE separated with spaces (take care NOT to leave ANY spaces between opening and closing square brackets and the first and last arguments).. EXPRESSIONSEverything contained inside a bracket pair prefixed by a $ (like $[this]) is considered as an expression and it is evaluated. HERE