asthost*CLI> core show function REGEX
-= Info about function 'REGEX' =-
[Synopsis]
Check string against a regular expression.
[Description]
Return '1' on regular expression match or '0' otherwise
Please note that the space following the double quotes separating the regex
from the data is optional and if present, is skipped. If a space is desired at
the beginning of the data, then put two spaces there; the second will not be
skipped.
[Syntax]
REGEX("regular expression" string)
[Arguments]
Not available
[See Also]
Not available
编写您的拨号计划 *
扩展名. conf文件:
[default]
exten => _[*#+0-9].,1,Set(match=${REGEX("^\\+?[0-9#*]+$" ${EXTEN})})
same => n,GotoIf($["${match}" = "1"]?proceed:endcall)
same => n(proceed),Answer()
same => n(endcall),Hangup()
重新加载您的拨号计划 *
在星号cli上键入"拨号计划重新加载":
asthost*CLI> dialplan reload
检查您的拨号计划 *
在星号cli上键入"拨号计划显示默认值":
asthost*CLI> dialplan show default
[ Context 'default' created by 'pbx_config' ]
'_[*#+0-9].' => 1. Set(match=${REGEX("^\\+?[0-9#*]+$" ${EXTEN})}) [extensions.conf:7]
2. GotoIf($["${match}" = "1"]?proceed:endcall) [extensions.conf:8]
[proceed] 3. Answer() [extensions.conf:9]
[endcall] 4. Hangup() [extensions.conf:10]
-= 1 extension (4 priorities) in 1 context. =-
asthost*CLI> core set verbose 3
Console verbose was OFF and is now 3.
asthost*CLI> channel originate Local/*1203#023212232@default application Hangup
-- Called *1203#023212232@default
-- Executing [*1203#023212232@default:1] Set("Local/*1203#023212232@default-00000019;2", "match=1") in new stack
-- Executing [*1203#023212232@default:2] GotoIf("Local/*1203#023212232@default-00000019;2", "1?proceed:endcall") in new stack
-- Goto (default,*1203#023212232,3)
-- Executing [*1203#023212232@default:3] Answer("Local/*1203#023212232@default-00000019;2", "") in new stack
-- Local/*1203#023212232@default-00000019;1 answered
== Spawn extension (default, *1203#023212232, 3) exited non-zero on 'Local/*1203#023212232@default-00000019;2'
exten => _.,1,AGI(Your AGI SCRIPT,${EXTEN}) // Pass the extension number to your Agi script.If that match your requirement set an agi variable **match** to 1
exten => s,n,GotoIf($["${match}" = "1"]?proceed:endcall) //Check the match variable status and proceed based on that
exten => s,n(proceed),Answer()
exten => s,n(endcall),Hangup()
3条答案
按热度按时间zlwx9yxi1#
您可以使用REGEX function
在星号cli上键入"core show function REGEX":
扩展名. conf文件:
在星号cli上键入"拨号计划重新加载":
在星号cli上键入"拨号计划显示默认值":
从您的SIP端点开始呼叫,即通过Local-Channel发起呼叫。不要忘记将详细级别设置为3,这样您就可以看到拨号计划输出。
bqjvbblv2#
我不认为星号支持regex表达式中这么大的灵活性。
实现这一点的最佳方法是,将此扩展变量传递给AGI,并在那里进行正则表达式匹配。
这只是实现您的要求的一个选项
xriantvc3#
不如这样:
您可能需要锚定它: