如何在拨号计划中获取dtmf值



我有一个dialplan,我想要的是,如果用户按下任何键,然后再次播放文件,但我不知道如何在拨号计划中获得dtmf值。这是我的拨号计划:

[callme]  
exten => s,1,Answer 
exten => s,n,Playback(demo/${FILENAME1})

首先是如何获得DTMF值,如果用户按下任何键,那么播放应该执行2次。但我想使用dialplan来管理所有这些。

您可以使用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+拨号计划+模式

[3]http://www.voip-info.org/wiki/view/Asterisk+cmd+BackGround

您还可以使用应用程序Read。它确实要求不止一次,结果拨号计划不那么复杂

[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)

阅读voip-info.org 的完整信息

感谢回复我的解决方案,但我得到了这个解决方案,它对我有效…

[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)

以下是读取DTMF值的简单示例上下文

[readDTMF]
exten => 113,1,Answer()
same  => n,Read(NUMBER,vm-toenternumber)
same  => n,Verbose(${NUMBER})
same  => n,SayNumber(${NUMBER})
same  => n,Hangup()

读取(存储读取编号的变量,[读取前播放的文件名][,其他选项])

  • 参考文献1:https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+应用程序_阅读
  • 参考文献2:http://www.voip-info.org/wiki/view/Asterisk+cmd+读取

相关内容

  • 没有找到相关文章

最新更新