Asterisk ExecIf

Home » Dialplan Basics » Asterisk ExecIf
Dialplan Basics No Comments

Execif Executes a dialplan application if some condition is met. e.g.

If expr is true, execute and return the result of appiftrue(args).

If expr is true, but appiftrue is not found, then the application will return a non-zero value.

Syntax

ExecIf(expression?appiftrue[:...][:appiffalse[:...]])

Arguments

  • expression
  • execapp
    • appiftrue
    • appiffalse

 

User provided example:

;;; DTMF Testing software to test IVR system
;;;
exten => 1234,1,Answer()
same => n,Read(value,pleasePress1forSupportPress2forHelp,1,,10)
same => n,NoOp(${value})
same => n,ExecIf($[${value}=1]?Goto(suppot,1))
same => n,ExecIf($[${value}=2]?Goto(help,1))
same => n,Hangup()

exten=> support,1,Answer()
same => n,NoOp(you are at support section)
same => n,Hangup()

exten=> help,1,Answer()
same => n,NoOp(you are at help section)
same => n,Hangup()