2011-07-21 45 views
2

我想創建一個多級IVR的示例。假設有一個歡迎菜單,您需要輸入您的employeeid。接下來還有第二個菜單,您可以選擇返回到上一個菜單。任何想法如何做到這一點?星號:創建一個多級IVR示例

下面是一個不起作用的僞代碼示例,因爲我還不知道如何創建多級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] 
.... 

假設employeeid是1-8,9是回到上一個菜單。當輸入1-8時,它將播放一個音頻文件並退出。

+0

這是一個編程問題? – Gabe

+0

我看不到問題。如果你想看看它是否有效,那麼最好的辦法是在電話線上進行測試。 – Sriram

+0

是的,這是一個問題,不,我不能測試它,因爲我不知道如何創建我問的:)我能夠創建一個基本的撥號方案,但只能用一個級別。我的問題是如何創建一個多層次的撥號方案? –

回答

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. 

這只是代碼的一個小例子。您可以對此進行調整並根據您的要求進行調整。請注意,我沒有測試過它。

HTH。

+0

謝謝,我今晚會嘗試。只是一個小問題。在[askEmpID]中,我可以這樣做:[askEmpID] exten => 1,1,Playback(byebye); // 1退出 exten => 9,1,Goto(TestMenu,0,welcomeIntro-skipped)// 9返回菜單 –

+0

'// //不是用星號評論的方式。 ';'是。除此之外,你可以像你說的那樣做。另外,在我看來,建議您通過一個星號小教程。你可能想考慮這樣做。 – Sriram

+0

我知道//不是評論。我是一名Java開發人員,這是一種習慣。 –