2

I want to create an example for a multi-level IVR. Let's say a welcome menu, where you are asked to enter your employeeid. Then there is a second menu after that, and you have the option to go back to the previous menu. Any idea how to do that ?

Here's a pseudo-code example that doesn't work, because I don't know yet how to create a multi-level IVR.

[TestMenu]

exten => start,1,Answer()
     same => n,Log(NOTICE, call starts)
     same => n,Background(welcomeintro)  // welcome menu

     same => n,Background(welcomeoption)  // options that your have
     same => n,WaitExten(5)

exten => 0,1,Playback(digits/0) ; if enter 0, play back the welcome menu
 same => n,Goto(TestMenu,start,1)  // ??? is it ok ?  and suppose that I want to skip to Background(welcomeoption) part directly ?

// if 1 is enterred, lets ask for employeeid
exten => 1,1,Playback(digits/1) ; 
 same => n,Playback(askemployeeid)
 same => n,goto ????

exten => i,1,Playback(pbx-invalid)   ; invalid
    same => n,Goto(TestMenu,start,1)

exten => t,1,Playback(byebye) ; timeout
    same => n,Hangup()

[employeeid]
....

Suppose that the employeeid is 1-8 and 9 is for going back to the previous menu. When 1-8 is entered, it will play a audio file and quit.

Community
  • 1
  • 1
Sebastien Dionne
  • 757
  • 2
  • 19
  • 34
  • Is this a programming question? – Gabe Jul 21 '11 at 02:52
  • i don't see a question. if you want to see if this works, then best would be to test it out on a phone line. – Sriram Jul 21 '11 at 06:27
  • Yes it's a question, and no I can't test it, because I have no idea how to create what I asked :) I'm able to create a basic dialplan but only with one level. My Question is how to create a multi-level dialplan ? – Sebastien Dionne Jul 21 '11 at 12:18
  • I have attempted to answer the question. take a look – Sriram Jul 21 '11 at 12:48

1 Answers1

2
[TestMenu]

exten => 0,n,Verbose(1, "Inside test-menu")
exten => 0,n(TestMenu-start),NoOp()

exten => 0,n(welcomeIntro-skip-press5),Background(welcomeintro)   ;If user presses 5, he skips this.

exten => 0,n(welcomeIntro-skipped),NoOp()

exten => 0,n,Background(welcomeoption)
exten => 0,n,Set(USERCHOICE1=0)  ;This is the first choice that the user will enter.
exten => 0,n,Read(USERCHOICE1,,1,,1,10)    ;Read the documentation on Read function to know what this does.

exten => 0,n,Playback(enteredChoice)
exten => 0,n,SayDigits(${USERCHOICE1})
exten => 0,n,ExecIf($[${USERCHOICE1} = 1]?Goto(askEmpID,0,askEmpID-start))

exten => 5,1,Goto(TestMenu,0,welcomeIntro-skipped)
exten => i,1,Playback(pbx-invalid)   ; invalid
exten => t,1,Playback(byebye) ; timeout

[askEmpID]
....

suppose that the employeeid is 1-8
and 9 is for going back to the previous menu.

and when 1-8 is entered, it will play a audio file and quit.

This is just a small sample of what the code might look like. You can work on this and tailor it to suit your requirements. Note that I have not tested it.

HTH.

Sriram
  • 10,298
  • 21
  • 83
  • 136
  • thanks, I'll try that tonight. Just a little question. in [askEmpID], can I do something like this : [askEmpID] exten => 1,1,Playback(byebye) ; // 1 for quit exten => 9,1,Goto(TestMenu,0,welcomeIntro-skipped) // 9 for go back to the menu – Sebastien Dionne Jul 21 '11 at 12:56
  • `//` is not the way to comment in asterisk. `;` is. Apart from that you can do as you say. Also, it seems to me that going through a small tutorial on asterisk is recommended for you. You might want to consider doing that. – Sriram Jul 21 '11 at 13:13
  • I know that // is not comment. I'm a java developer and it's a habit. – Sebastien Dionne Jul 21 '11 at 14:18