Asterisk Goto如果没有真正去

问题描述 投票:3回答:2

如果SIP标头中有转移号码,我正在尝试将拨号方案配置为GoTo不同的上下文。

这不起作用,因为它无声地失败。这是我的extensions.conf文件。

[from-external]
exten =>        _+<phone_number>,1,Noop(incoming call)
same =>         n,Answer()
same =>         n,Set(diversion=${SHELL(node ${scripts}/parsePhoneNumber.js ${SIP_HEADER(diversion)})})
same =>         n,GotoIf($["${diversion}" = ""]?1004,1:have_diversion])
same =>         n(have_diversion),Noop(in existing diversion)

[MissingDiversion]
exten =>            1004,1,Noop(in missing diversion)
same =>             n(missing_diversion_label),Noop(in missing diversion)

日志是:

== Using SIP RTP CoS mark 5
    -- Executing [+16167270007@from-external:1] NoOp("SIP/incoming-trunk2-00000021", "incoming call") in new stack
    -- Executing [+16167270007@from-external:2] Answer("SIP/incoming-trunk2-00000021", "") in new stack
    -- Executing [+16167270007@from-external:3] Set("SIP/incoming-trunk2-00000021", "diversion=") in new stack
    -- Executing [+16167270007@from-external:4] GotoIf("SIP/incoming-trunk2-00000021", "1?1004,1:have_diversion]") in new stack
    -- Goto (from-external,1004,1)

所以,看起来GOTO正在发挥作用,但它没有达到我希望它达到的目的。我没有看到in missing diversion的日志。

我尝试过GotoIf系列的变种,但也不起作用:

same =>         n,GotoIf($["${diversion}" = ""]?
same =>         n,GotoIf($["${diversion}" = ""]?[MissingDiversion,1004]:have_diversion])
same =>         n,GotoIf($["${diversion}" = ""]?[MissingDiversion,1]:have_diversion])
same =>         n,GotoIf($["${diversion}" = ""]?[MissingDiversion,1004,1]:have_diversion])

另外,我只是使用带有原始背景[from-external]的标签 - GotoIf实际上有效。跳到一个失败的新环境。

我正在运行Asterisk 11.6

asterisk pbx
2个回答
2
投票

发现问题,在GotoIf语句的末尾是一个多余的额外']'。

应该:

same =>         n,GotoIf($["${diversion}" = ""]?1004,1:have_diversion)

并不是:

same =>         n,GotoIf($["${diversion}" = ""]?1004,1:have_diversion])

0
投票

您应该将新上下文包含在from-external中,或者转到MissingDiversion,1004,1

© www.soinside.com 2019 - 2024. All rights reserved.