寻求有关 Asterisk 中 IVR 菜单的帮助

发布于 2024-07-21 07:32:23 字数 271 浏览 17 评论 0原文

我正在编写一个 IVR 菜单,我需要允许我的用户在通信过程中随时按 0 退出。 以下是我的做法:

exten => 0,1,Playback(good-bye)
exten => 0,2,Playback(beep)
exten => 0,3,Hangup

但是,通过这样做,当用户在播放某些文件或正在进行其他操作时按零时,他/她无法退出,就像他/她没有退出一样按零。 我希望我说得足够清楚,并且您可以帮助我解决这个问题。 干杯

I am writing an IVR menu and I need to allow my users to press 0 anytime during the communication to exit. The following is how I do it:

exten => 0,1,Playback(good-bye)
exten => 0,2,Playback(beep)
exten => 0,3,Hangup

However, by doing so, when the user presses zero while some file is being played back or some other operation is taking place, he/she cannot exit, it is like if he/she didn't press zero. I hope I am clear enough and that you can help me out with this.
cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白龙吟 2024-07-28 07:32:23

对于 IVR,您需要使用 Background() 和/或 WaitExten() 而不是 Playback()。 以下是 IVR 拨号方案示例:

[ivr_main]
; answer and play announcement
exten => s,1,Set(TIMEOUT(response)=2)
exten => s,2,Set(TIMEOUT(digit)=2)
exten => s,3,BackGround(/your/audio/file/announcement)
exten => s,4,WaitExten(2)
exten => s,5,GoTo(s|3) ; careful of this loop here! should GoTo() somewhere else!
; handle key presses
exten => 0,1,Playback(good-bye)
exten => 0,2,Playback(beep)
exten => 0,3,Hangup()
exten => 1,1,NoOp(do this if user presses 1)
exten => 2,1,NoOp(do this if user presses 2)
exten => 3,1,NoOp(do this if user presses 3)
exten => 4,1,NoOp(do this if user presses 4)
exten => 5,1,NoOp(do this if user presses 5)
; handle invalid key presses
exten => i,1,Playback(pbx-invalid)
exten => i,2,GoTo(s|3)
; handle time out (user did not make a selection)
exten => t,1,GoTo(0|1)   ; go to Hangup :-)

希望对您有所帮助。

在 Asterisk CLI 中,执行“显示应用程序背景”和“显示应用程序 WaitExten”以获取这些应用程序的手册。

For an IVR, you want to use Background() and/or WaitExten() instead of Playback(). Here's a sample IVR dialplan:

[ivr_main]
; answer and play announcement
exten => s,1,Set(TIMEOUT(response)=2)
exten => s,2,Set(TIMEOUT(digit)=2)
exten => s,3,BackGround(/your/audio/file/announcement)
exten => s,4,WaitExten(2)
exten => s,5,GoTo(s|3) ; careful of this loop here! should GoTo() somewhere else!
; handle key presses
exten => 0,1,Playback(good-bye)
exten => 0,2,Playback(beep)
exten => 0,3,Hangup()
exten => 1,1,NoOp(do this if user presses 1)
exten => 2,1,NoOp(do this if user presses 2)
exten => 3,1,NoOp(do this if user presses 3)
exten => 4,1,NoOp(do this if user presses 4)
exten => 5,1,NoOp(do this if user presses 5)
; handle invalid key presses
exten => i,1,Playback(pbx-invalid)
exten => i,2,GoTo(s|3)
; handle time out (user did not make a selection)
exten => t,1,GoTo(0|1)   ; go to Hangup :-)

Hope this helps.

In the Asterisk CLI, do 'show application Background' and 'show application WaitExten' for the manual of these applications.

乖乖哒 2024-07-28 07:32:23

AFAIK,Asterisk 只能在您调用“Background”或“WaitExten”时才能接收按键。 因此,如果您正在运行某些 AGI,它必须调用这两个命令之一。

AFAIK, Asterisk would only be able to pick up on the key press when you've called Background, or WaitExten. So if you're running some AGI, it will have to have invoked one of those two commands.

寂寞清仓 2024-07-28 07:32:23

Asterisk 并不总是等待用户输入。 仅在后台、WaitExten、Read 命令期间。 如果您使用 Playback(),Asterisk 在播放音频文件时会忽略任何 DTMF。

您可以用 Read() 替换 Playback,但必须将读取超时设置为非常低的值,否则在使用 Read() 播放每个音频文件后将会出现静音。 如果您使用 Read() 那么您必须检查用户输入的值以检查退出,类似这样......

而不是

exten => x,n,Playback(yourfile)
exten => x,n,somethingelse...

您需要

exten => x,n,Read(Exit,yourfile,1)
exten => x,n,GotoIf($["${Exit}" = "0"]?0,1)
exten => x,n,somethingelse...

Asterisk is not always waiting for user input. Only during the Background, WaitExten, Read commands. If you're using Playback(), Asterisk ignores any DTMF while it's playing the audio file.

You can replace Playback with Read() but you have to set the read timeout to a very low value or there will be a silence after every audio file you play with Read(). If you use Read() then you have to check the value input by the user to check for exit, something like this...

Instead of

exten => x,n,Playback(yourfile)
exten => x,n,somethingelse...

you need

exten => x,n,Read(Exit,yourfile,1)
exten => x,n,GotoIf($["${Exit}" = "0"]?0,1)
exten => x,n,somethingelse...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文