Menu Example

From KlavoWiki
Jump to navigationJump to search

Below is an example of a menu system.

[menu]
exten => s,1,Answer()
exten => s,n,Set(TRY=0)                            ; set paramater TRY = 0
exten => s,n(start),Set(TRY=$[${TRY} + 1])         ; set paramater TRY = TRY + 1 
exten => s,n,GoToIf($[${TRY} > 5]?t,1)             ; If TRY greater than 5 goto context t,1
exten => s,n,BackGround(ivr/callback/lk-callback)  ; Play menu system.  Press 1 for xx, 2 for xx etc...
exten => s,n,Playback(beep)
exten => s,n,WaitExten(5)                          ; Wait 5 seconds for key press
exten => s,n,BackGround(au/vm-sorry)               ; Invalid Selection
exten => s,n,Goto(start)

;Option 0
exten => 0,1,do somehting....
.
.
exten => 0,n,HangUp

;Option 1
exten => 1,1,do somehting....
.
.
exten => 1,n,HangUp


;Option 9
exten => 9,1,do somehting....
.
.
exten => 9,n,HangUp

;Invalid Selection
exten => i,1,Playback(au/please-try-again)
exten => i,n(start),Set(TRY=$[${TRY} - 1])
exten => i,n,Goto(s,start)

;TimeOut
exten => t,1,Playback(au/goodbye)
exten => t,n,HangUp