FreePBX/Asterisk 拆分 Telefonica/O2 'To:' 头的规则
FreePBX / Asterisk 使用中继的上下文提取 DID 号码,然后将其与入站路由的 DID 号码匹配。
使用 Telefonica/O2 的中继时,传入 SIP INVITE 消息的 To: 头如下所示:
to_header_example.txt
sip:0891234567;phone-context=telefonica.de@telefonica.de;user=phone但拨打 E.164 FQTN 时,它也可以如下所示:
to_header_e164_example.txt
sip:0891234567;phone-context=telefonica.de@telefonica.de;user=phone使用 from-pstn-toheader 上下文提取此内容时,提取的 DID 将是 0891234567;phone-context=telefonica.de。
这无法与 DID 匹配,因为入站路由 DID 只能由数字组成,不能包含分号。
因此,我编写了这个自定义上下文来正确提取 DID:
from-pstn-toheader-o2.conf
[from-pstn-toheader-o2]
exten => _.,1,Goto(from-pstn,${CUT(CUT(CUT(PJSIP_HEADER(read,To),\;,1),@,1),:,2)},1)要安装此上下文,请将其添加到 FreePBX 或 Asterisk 的 /etc/asterisk/extensions_custom.conf 中并重新加载 Asterisk(如果你不知道如何操作,请参见如何在 FreePBX 中重启 Asterisk,或者直接重启你的 FreePBX)
要使用此上下文,请转到中继的设置,将 Context 设置为 from-pstn-toheader-o2。然后,应用配置。
之后,你的 DID 将被正确匹配(上例中为 0891234567),;phone-context=telefonica.de 部分将被忽略。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow