@ -22,8 +22,8 @@ will be passed down to the Background command, in this example.
Also, characters special to variable substitution, expression evaluation, etc
(see below), can be quoted. For example, to literally use a \$ on the
string "\$ 1231", quote it with a preceding \ \ . Special characters that must
be quoted to be used, are [ ] \$ " \ \. (to write \\ itself, use \\ ).
string "\$ 1231", quote it with a preceding \ textbackslash . Special characters that must
be quoted to be used, are [ ] \$ " \ textbackslash. (to write \textbackslash itself, use \textbackslash ).
These Double quotes and escapes are evaluated at the level of the
asterisk config file parser.
@ -274,7 +274,7 @@ Parentheses are used for grouping in the usual manner.
Operator precedence is applied as one would expect in any of the C
or C derived languages.
subsection{ Floating Point Numbers}
\ subsection{ Floating Point Numbers}
In 1.6 and above, we shifted the \$ \[ ... \] expressions to be calculated
via floating point numbers instead of integers. We use 'long double' numbers
@ -290,13 +290,13 @@ on integer behavior. If you were counting on 1/4 evaluating to 0, you need to no
TRUNC(1/4). For a list of all the truncation/rounding capabilities, see the next section.
subsection{ Functions}
\ subsection{ Functions}
In 1.6 and above, we upgraded the $ [ ] expressions to handle floating point numbers.
In 1.6 and above, we upgraded the \$ [] expressions to handle floating point numbers.
Because of this, folks counting on integer behavior would be disrupted. To make
the same results possible, some rounding and integer truncation functions have been
added to the core of the Expr2 parser. Indeed, dialplan functions can be called from
$ [ .. ] expressions without the $ { ... } operators. The only trouble might be in the fact that
\$ [..] expressions without the \$ \{ ...\ } operators. The only trouble might be in the fact that
the arguments to these functions must be specified with a comma. If you try to call
the MATH function, for example, and try to say 3 + MATH(7*8), the expression parser will
evaluate 7*8 for you into 56, and the MATH function will most likely complain that its
@ -312,7 +312,7 @@ are available by simply calling them (read-only). In other words, you don't need
surround function calls in \$ \[ ... \] expressions with \$ \{ ...\} . Don't jump to conclusions,
though! -- you still need to wrap variable names in curly braces!
\begin { E numerate}
\begin { e numerate}
\item COS(x) x is in radians. Results vary from -1 to 1.
\item SIN(x) x is in radians. Results vary from -1 to 1.
\item TAN(x) x is in radians.
@ -334,9 +334,9 @@ If this quotient is 1/2, it is rounded to the nearest even number.
\item LOG(x) returns the natural logarithm of x.
\item LOG2(x) returns the base 2 log of x.
\item LOG10(x) returns the base 10 log of x.
\end { E numerate}
\end { e numerate}
subsection{ Examples}
\ subsection{ Examples}
\begin { verbatim}
"One Thousand Five Hundred" =~ "(T[^ ]+)"
@ -421,7 +421,7 @@ TRUNC(3.5)
TRUNC(-3.5)
returns -3.
\ b egi n{ verbatim}
\ end { verbatim}
Of course, all of the above examples use constants, but would work the
same if any of the numeric or string constants were replaced with a
@ -441,7 +441,7 @@ case.
There is one conditional application - the conditional goto :
\begin { verbatim}
exten => 1,2,gotoi f(condition?label1:label2)
exten => 1,2,GotoI f(condition?label1:label2)
\end { verbatim}
If condition is true go to label1, else go to label2. Labels are interpreted
@ -453,7 +453,7 @@ This is designed to be used together with the expression syntax described
above, eg :
\begin { verbatim}
exten => 1,2,gotoi f($ [ $ { CALLERID} = 123456]?2|1:3|1)
exten => 1,2,GotoI f($ [ $ { CALLERID} = 123456]?2|1:3|1)
\end { verbatim}
Example of use :
@ -574,7 +574,7 @@ of possible concern with "legacy" extension.conf files:
quotes, it was no reason for concern. It is now!
\item LE, GE, NE operators removed. The code supported these operators,
but they were not documented. The symbolic operators, <=, >=, and !=
but they were not documented. The symbolic operators, $ <$ =, $ >$ =, and !=
should be used instead.
\item Added the unary '-' operator. So you can 3+ -4 and get -1.
@ -670,22 +670,24 @@ only read in the dialplan. Writes to such variables are silently
ignored.
\begin { verbatim}
$ { ACCOUNTCODE} * Account code ( if specified ) ( Deprecated; use $ { CDR(accountcode)} )
$ { CDR( accountcode ) } * Account code ( if specified )
$ { BLINDTRANSFER } The name of the channel on the other side of a blind transfer
$ { BRIDGEPEER } Bridged peer
$ { CALLERANI } * Caller ANI ( PRI channels ) ( Deprecated; use $ { CALLERID(ani)} )
$ { CALLERID } * Caller ID ( Deprecated; use $ { CALLERID(all)} )
$ { CALLERIDNAME } * Caller ID Name only ( Deprecated; use $ { CALLERID(name)} )
$ { CALLERIDNUM } * Caller ID Number only ( Deprecated; use $ { CALLERID(num)} )
$ { CALLERID ( ani ) } * Caller ANI ( PRI channels )
$ { CALLERID ( all ) } * Caller ID
$ { CALLERID ( dnid ) } * Dialed Number Identifier
$ { CALLERID ( name ) } * Caller ID Name only
$ { CALLERID ( num ) } * Caller ID Number only
$ { CALLERID ( rdnis ) } * Redirected Dial Number ID Service
$ { CALLINGANI 2 } * Caller ANI 2 ( PRI channels )
$ { CALLINGPRES } * Caller ID presentation for incoming calls ( PRI channels )
$ { CALLINGTNS } * Transit Network Selector ( PRI channels )
$ { CALLINGTON } * Caller Type of Number ( PRI channels )
$ { CHANNEL } * Current channel name
$ { CONTEXT } * Current context
$ { DATETIME } * Current date time in the format: DDMMYYYY - HH:MM:SS ( Deprecated; use $ { STRFTIME($ { EPOCH } ,, % d % m % Y - % H: % M: % S ) } )
$ { DATETIME } * Current date time in the format: DDMMYYYY - HH:MM:SS
(Deprecated; use $ { STRFTIME ( $ { EPOCH} ,,% d% m% Y-% H:% M:% S)} )
$ { DB _ RESULT } Result value of DB _ EXISTS ( ) dial plan function
$ { DNID } * Dialed Number Identifier ( Deprecated; use $ { CALLERID(dnid)} )
$ { EPOCH } * Current unix style epoch
$ { EXTEN } * Current extension
$ { ENV ( VAR ) } Environmental variable VAR
@ -701,8 +703,8 @@ ${LANGUAGE} * Current language (Deprecated; use ${LANGUAGE()})
$ { LEN ( VAR ) } * String length of VAR ( integer )
$ { PRIORITY } * Current priority in the dialplan
$ { PRIREDIRECTREASON } Reason for redirect on PRI, if a call was directed
$ { RDNIS} * Redirected Dial Number ID Service ( Deprecated; use $ { CALLERID(rdnis)} )
$ { TIMESTAMP } * Current date time in the format: YYYYMMDD - HHMMSS ( Deprecated; use $ { STRFTIME($ { EPOCH } ,, % Y % m % d - % H % M % S ) } )
$ { TIMESTAMP} * Current date time in the format: YYYYMMDD - HHMMSS
(Deprecated; use $ { STRFTIME ( $ { EPOCH} ,,% Y% m% d-% H% M% S)} )
$ { TRANSFER _ CONTEXT } Context for transferred calls
$ { FORWARD _ CONTEXT } Context for forwarded calls
$ { UNIQUEID } * Current call unique identifier