B.50. GotoIf()

Jumps to a specified priority, extension and context if a condition is satisfied.
GotoIf(condition?labeliftrue:labeliffalse)
Hands the currently active channel to the priority specified by labeliftrue if the condition is true, or to the priority specified in labeliffalse if the condition is false. Either labeliftrue or labeliffalse may be omitted (in which case execution continues with the next priority) but not both! You must include the colon delimiter (:).
In this case, a priority can be:
  • a single priority, e.g. 10
  • an extension and a priority, e.g. 123,10
  • a context, extension and priority, e.g. incoming,123,10
  • a named priority in the same extension, e.g. ok
exten => 123,1,GotoIf($[ ${test} = 5 ]?ok:no)
exten => 123,10(ok),Playback(tt-monkeys)
exten => 123,20(no),Playback(tt-weasels)

Note

Internal help for this application in Asterisk 1.4:
  -= Info about application 'GotoIf' =- 

[Synopsis]
Conditional goto

[Description]
  GotoIf(condition?[labeliftrue]:[labeliffalse]): This application will cause
the calling channel to jump to the specified location in the dialplan based on
the evaluation of the given condition. The channel will continue at
'labeliftrue' if the condition is true, or 'labeliffalse' if the condition is
false. The labels are specified with the same syntax as used within the Goto
application.  If the label chosen by the condition is omitted, no jump is
performed, but execution continues with the next priority in the dialplan.
diff output to internal help in Asterisk 1.2:
- none -