我有一个拨号方案,其中我想要的是,如果用户按任意键然后再次播放文件但我无法理解如何在拨号方案中获得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+Dialplan+Patterns
[3] http://www.voip-info.org/wiki/view/Asterisk+cmd+BackGround