拨号计划执行顺序
我的星号拨号计划中有以下上下文。
[start-call]
exten => _X.,1,AGI(agi://localhost:4000)
exten => _X.,n,GotoIf($["${AGISTATUS}" = "FAILURE"]?redirect)
exten => _X.,1000(redirect),Hangup(31)
exten => 900,n,Goto(start-call,${EXTEN},1)
exten => h,n,Hangup
我有一个 AGI 应用程序,它连接呼叫并收集 DTMF 输入,并使用 SET EXTENSION agi 命令(第 1 行)将该号码设置为分机号。仅当没有 DTMF 输入时,我才将 AGISTATUS 设置为 FAILURE。如果没有输入,我就会超时并挂断(第 3 行)。但是,如果输入 900,我将返回到启动调用上下文,并在 AGI 应用程序中执行一些操作(第 4 行)。
问题是,现在即使我输入 900,电话也会挂断。不是从第 3 行开始,而是从最后一行开始。所以它以某种方式跳过了第 4 行。如果我将 900 分机(第 4 行)移到标记为 redirect 的分机(第 3 行)之前,它就会起作用。
我认为 asterisk 自动增加 'n' 优先级,并希望它按照上面列出的顺序工作。我这里错了吗?
I have the following context in my asterisk dialplan.
[start-call]
exten => _X.,1,AGI(agi://localhost:4000)
exten => _X.,n,GotoIf($["${AGISTATUS}" = "FAILURE"]?redirect)
exten => _X.,1000(redirect),Hangup(31)
exten => 900,n,Goto(start-call,${EXTEN},1)
exten => h,n,Hangup
I have an AGI app which connects the call and collects DTMF inputs, and set that number as the extension using the SET EXTENSION agi command (line 1). I set the AGISTATUS to FAILURE only when there is no DTMF input. If there is no input, I timeout, and hangup (line 3). But if 900 is entered I go back to start-call context and do some magic in the AGI application (line 4).
The problem is that, right now even if I enter 900 the call just gets hung up. And not from line 3 but the last line. So its skipping line 4 somehow. If I move the 900 extension (line 4) before the one labelled redirect (line 3), it works.
I thought asterisk increments the 'n' priority automatically, and would expect this to work in the order listed above. Am I wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
n
自动迭代 - 它将 1 添加到前一个优先级。这也是为什么你必须在第一行初始化优先级为 1 的增量器。当您将优先级 1000 放在中间的某个位置(这是完全有效的)时,下一行带有
n
的值将加 1,从而得到优先级 1001 - 正如其他人已经解释的那样,它永远不会被命中。您的拨号方案可以如下所示:
要解决此问题,您必须按照其他人的说明重新排序您的分机,或者使用
+
运算符确定优先级:顺便说一下,您还可以使用文本标签作为分机,这将使您的拨号计划更具可读性:
n
iterates automatically - it adds 1 to the previous priority. This is also why you have to initialize the incrementor with priority 1 in the first line.When you put priority 1000 somewhere in the middle (which is totally valid) the next line with
n
will add 1 to this, resulting in priority 1001 - which is never hit as already explained by others.Your dialplan can be read like below:
To fix this you must either reorder your extensions as explained by others or use the
+
operator for priorities:By the way, you can also use text labels as extensions, which will make your dialplans more readable:
拨号方案必须是连续的。 Ext 1000 永远不会被命中 - 因此星号会延伸到 h 扩展。
Dialplan must be consecutive. Ext 1000 is never hit - hence asterisk falls through to the h exten.
是的,拨号方案必须是连续的,一旦开始“n”系列,您就需要坚持下去。我假设分机 900 是 DTMF 输入的一个示例 - 这个新分机必须始终以优先级 1 开头。“h”分机也必须以优先级 1 开头
Yes the dialplan must be consecutive, and once you start the "n" series you need to stick with it. I am assuming extension 900 is an example of the DTMF input -- this new extension must always start with a priority of 1. The "h" extension must also start with a priority of 1