在extensions.conf
中,我可以在另一个中引用一个全局变量吗?
[globals]
GROUP1=SIP/3333&SIP/3334&SIP/3335
GROUP2=SIP/4442&SIP/4441&SIP/4442
GROUP3=SIP/5553&SIP/5550&SIP/5556
喜欢这个吗?
EMERGENCY=${GROUP1}&${GROUP2}&${GROUP3}|9999|30
如果没有,我该怎么办?
答案 0 :(得分:2)
是的,这是完全可行的。正如arheops所提到的,当以RTL顺序计算表达式时,变量的值将被替换。
拨号方案示例:
[general]
[globals]
TEST1=SIP/111&SIP/222
TEST2=SIP/333&SIP/444
TEST_GROUP=${TEST1}&${TEST2}
[default]
exten => 1,1,NoOp()
same => n,NoOp(${TEST1})
same => n,NoOp(${TEST2})
same => n,NoOp(${TEST_GROUP})
same => n,Dial(${TEST_GROUP})
same => n,Hangup()
exten => 2,1,NoOp()
same => n,Wait(5)
same => n,Hangup()
使用Asterisk 1.8的新结帐执行示例,显示变量值:
*CLI> channel originate Local/1@default extension 2@default
-- Executing [1@default:1] NoOp("Local/1@default-505e;2", "") in new stack
-- Executing [1@default:2] NoOp("Local/1@default-505e;2", "SIP/111&SIP/222") in new stack
-- Executing [1@default:3] NoOp("Local/1@default-505e;2", "SIP/333&SIP/444") in new stack
-- Executing [1@default:4] NoOp("Local/1@default-505e;2", "SIP/111&SIP/222&SIP/333&SIP/444") in new stack
-- Executing [1@default:5] Dial("Local/1@default-505e;2", "SIP/111&SIP/222&SIP/333&SIP/444") in new stack
答案 1 :(得分:0)
你做不到。只需创建enother逻辑或外部脚本来创建dialplan文件