asterisk - flow control

 

 

Asterisk Expressions

$[expr1 operator expr2]

variables:

${ ... }

Logical operators:

expr1 | expr2
expr1 & expr2
!expr

expr1 = expr2
expr1 != expr2
expr1 < expr2
expr1 > expr2
expr1 <= expr2
expr1 >= expr2

Regular expressions

; an implicit '^'
expr1 : regexp

expr1 =~ expr2

 


Goto

    Goto(context,extension,priority)
    Goto(extension,priority)
    Goto(priority)
    Goto(context,extension,label)
    Goto(extension,label)
    Goto(label)

i.e.

exten => _X.,1,Goto(monkeys)
   same => n,NoOp(We skip this)
   same => n(monkeys),Playback(tt-monkeys)
   same => n,Hangup()

GotoIf

GotoIf(condition?[label1]:label2)

GotoIf(condition?context,label1])

* Either label1 or label2 may be omitted (in that case, we just don't take the particular branch), but not both.

i.e.

; set test to 5

test=5

exten => 123,1,GotoIf($[ ${test} = 5 ]?ok:no)
exten => 123,10(ok),Playback(tt-monkeys)
exten => 123,20(no),Playback(tt-weasels)

 

 

 

Creative Commons license icon Creative Commons license icon