4

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

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

首先如何获取 DTMF 值,如果用户按下任何键,则播放应该执行 2 次。但我想使用dialplan.

4

4 回答 4

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

于 2012-09-08T13:40:09.487 回答
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)

有关在 voip-info.org 上阅读的完整信息

于 2012-09-08T20:37:26.887 回答
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)
于 2012-09-10T06:00:27.657 回答
0

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

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

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

于 2018-12-14T09:00:34.583 回答