Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block

exten => s,5,BackGround,blablamy-custom-sound

The parameter (blabla) can be quoted with double quotes ("blabla"). In this case, a comma does not terminate the field. However, the double quotes 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 escaped to be used literally, are "[", "] $ ", "\" (backslash) and " (double quote).
Dollar sign "$" does not require escaping, as long as it doesn't trigger variable expansion or expression evaluation (to write \itself, use a backslash. ). These i.e. "$[" or "${"), - in that case you'd have to either surround it with double quotes or escape the next character with a backslash (See example code below).

Double quotes and escapes are evaluated at the level of the asterisk config file parser.

Double quotes can also be used inside expressions, as discussed below.later.

Code Block
titleUseful Examples
; Comma truncation
exten => s,1,Verbose(Hi, James!)   ; <- , James!
exten => s,2,Verbose("Hi, James!") ; <- "Hi, James!"

; Variable expansion
exten => s,1,Verbose(${EXTEN} is a standard variable)   ; <- s is a standard variable
exten => s,2,Verbose($\{EXTEN} is a standard variable)  ; <- ${EXTEN} is a standard variable
exten => s,3,Verbose("$"{EXTEN} is a standard variable) ; <- ${EXTEN} is a standard variable

; Expression expansion
exten => s,1,Verbose(:-] smile!)  ; <- (Syntax error)
exten => s,2,Verbose(:-\] smile!) ; <- :-] smile!

; Quote stripping
exten => s,1,Verbose("haxxor1337" is calling)   ; <- haxxor1337 is calling
exten => s,2,Verbose(\"haxxor1337\" is calling) ; <- "haxxor1337" is calling