我有一个dialplan
我想要的是,如果用户按任意键然后再次播放文件但我无法理解如何在拨号方案中获取dtmf值。
这是我的拨号方案:
[callme]
exten => s,1,Answer
exten => s,n,Playback(demo/${FILENAME1})
首先如何获取DTMF值,如果用户按任意键,则应执行2次播放。但我想使用dialplan
管理所有这些内容。
答案 0 :(得分:2)
您可以使用WaitExten [1]:
来完成[callme]
exten => s,1,Answer
exten => s,n,Playback(demo/${FILENAME1})
exten => s,n,WaitExten(3)
exten => s,n,Goto(s,1)
exten => 1,1,Noop(user pressed 1)
exten => 1,n,Goto(however-shall-go-to-when-pressed-1)
exten => 2,1,Noop(user pressed 2)
exten => 2,n,Goto(however-shall-go-to-when-pressed-2)
使用扩展模式[2]:
[callme]
exten => s,1,Answer
exten => s,n,Playback(demo/${FILENAME1})
exten => s,n,WaitExten(3)
exten => s,n,Goto(s,1)
exten => X,1,Noop(user pressed ${EXTEN})
exten => X,n,Goto(however-shall-go-to-when-pressed-${EXTEN})
这正是您所要求的:
[callme]
exten => s,1,Answer
exten => s,n,Playback(demo/${FILENAME1})
exten => s,n,WaitExten(3)
exten => s,n,NoOp(going on - no dtmf detectd)
exten => X,1,Noop(user pressed ${EXTEN})
exten => X,n,Goto(s,1)
还要看一下背景星号应用程序[3]。
参考文献:
[1] http://www.voip-info.org/wiki/view/Asterisk+cmd+WaitExten
[2] http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Patterns
[3] http://www.voip-info.org/wiki/view/Asterisk+cmd+BackGround
答案 1 :(得分:1)
您也可以使用应用程序阅读。它确实要求更多一次,结果更复杂的拨号方案
[test]
;Read(variable[,filename[&filename2[&...]][,maxdigits[,options[,attempts[,timeout]]]]])
exten => s,1,Read(response,file_to_play,3,,4,10)
;will read into response variable,upto 3 digits and ask upto 4 times, timeout 10 sec
exten => s,2,GotoIf($[ "${response}" == "123"]?pin_ok,s,1)
答案 2 :(得分:1)
感谢您回复我的解决方案,但我得到了这个解决方案,它对我有用......
[callme]
exten => s,1,Answer
exten => s,n,DumpChan()
exten => s,n,Playback(sclbrd/welcome)
exten => s,n,Wait(2)
exten => s,n,Set(i=1)
exten => s,n,While($[${i} != 3])
exten => s,n,Playback(sclbrd/${FILENAME1})
exten => s,n,Read(digit|sclbrd/press|1)
exten => s,n,Wait(1)
exten => s,n,GotoIf($["${digit}x" = "x"]?done:again)
exten => s,n(again),Wait(1)
exten => s,n,Set(i=$[${i} + 1])
exten => s,n,EndWhile()
exten => h,n(done),Wait(1)
答案 3 :(得分:0)
这是读取DTMF值的简单示例上下文
[readDTMF]
exten => 113,1,Answer()
same => n,Read(NUMBER,vm-toenternumber)
same => n,Verbose(${NUMBER})
same => n,SayNumber(${NUMBER})
same => n,Hangup()
读取(存储到存储读取编号的变量,[读取前要播放的文件名] [,其他选项])