Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asterisk 如何使不同语境的扩展能够相互沟通?_Asterisk - Fatal编程技术网

Asterisk 如何使不同语境的扩展能够相互沟通?

Asterisk 如何使不同语境的扩展能够相互沟通?,asterisk,Asterisk,sip.conf [101] context = technical-office [102] context = employment-department [101] context = technical-office [102] context = technical-office extension.conf [technical-office] exten => 101,1,answer() exten => 101,2,dial(si

sip.conf

[101]
context = technical-office
[102]
context = employment-department
    [101]
    context = technical-office
    [102]
    context = technical-office
extension.conf

[technical-office]
exten => 101,1,answer()
exten => 101,2,dial(sip/101)
exten => 101,3,hangup()

[employment-department]
exten => 102,1,answer()
exten => 102,2,dial(sip/102)
exten => 102,3,hangup()
    [technical-office]
    exten => _1XX,1,answer()
    exten => _1XX,n,dial(sip/${EXTEN})
    exten => _1XX,n,hangup()

当我使用“101”分机拨“102”时,我有一个错误“没有路由到目的地”。但是上下文是相同的,没有错误,这是因为您没有正确的上下文。 SIP peer 101指向上下文技术办公室,而您在该上下文中没有扩展102。 要使其正常工作,请使用:

sip.conf

[101]
context = technical-office
[102]
context = employment-department
    [101]
    context = technical-office
    [102]
    context = technical-office
extension.conf

[technical-office]
exten => 101,1,answer()
exten => 101,2,dial(sip/101)
exten => 101,3,hangup()

[employment-department]
exten => 102,1,answer()
exten => 102,2,dial(sip/102)
exten => 102,3,hangup()
    [technical-office]
    exten => _1XX,1,answer()
    exten => _1XX,n,dial(sip/${EXTEN})
    exten => _1XX,n,hangup()
这两部电话在同一个环境中,所以如果101拨打102,它将工作,如果102拨打101,它也将工作。 实际上1XX被称为模式,${EXTEN}是指您拨打的分机。
这在星号拨号计划中非常常见。

当然,您可以从一个上下文拨号到下一个上下文

sip.conf:

[101]
context = technical-office
[102]
context = employment-department
extensions.conf:

[technical-office]
include => dial-context

[employment-department]
include => dial-context

[dial-context]
exten => _1XX,1,answer()
exten => _1XX,n,dial(sip/${EXTEN})
exten => _1XX,n,hangup()
您的示例不起作用,因为ext=>XXX表示拨号电话,而不是from电话。如果您在dialplan(extensions.conf)101 x 102上进行交换,允许上下文A上的扩展调用扩展102,并以另一种方式进行同样的操作,那么您的示例将起作用

查看或查找星号完整介绍的书籍

希望能有帮助