Asterisk 数组中存在星号GotoIf比较变量
目前我正在使用以下条件:Asterisk 数组中存在星号GotoIf比较变量,asterisk,Asterisk,目前我正在使用以下条件: exten => 1237,n,GotoIf($[ $[ "${text}" = "yes" ] | $[ "${text}" = "ok" ] | $[ "${text}" = "perfect" ] ]?interest:retry) 这是定义这种语法的更好方法吗?我想将文本的值与字符串数组进行比较,但我找不到方法。例如: exten => 1237,n,GotoIf($[ $[ "${text}" in ARRAY("yes","ok","pe
exten => 1237,n,GotoIf($[ $[ "${text}" = "yes" ] | $[ "${text}" = "ok" ]
| $[ "${text}" = "perfect" ] ]?interest:retry)
这是定义这种语法的更好方法吗?我想将文本的值与字符串数组进行比较,但我找不到方法。例如:
exten => 1237,n,GotoIf($[ $[ "${text}" in ARRAY("yes","ok","perfect") ] ]?interest:retry)
我不知道星号中的
运算符,但您可以使用正则表达式匹配:
GotoIf($[ "${text}" =~ "^(yes|no|perfect)$"]?interest:retry)
我不知道星号中的运算符,但您可以使用正则表达式匹配:
GotoIf($[ "${text}" =~ "^(yes|no|perfect)$"]?interest:retry)
这几乎就是你需要的
exten = 1237,n,Set(STRARRAY='yes-ok-perfect')
exten = 1237,n,GotoIF($[ ${FIELDNUM(STRARRAY,-,${text})} > 0 ]?interest:retry)
这几乎就是你需要的
exten = 1237,n,Set(STRARRAY='yes-ok-perfect')
exten = 1237,n,GotoIF($[ ${FIELDNUM(STRARRAY,-,${text})} > 0 ]?interest:retry)
美好的但最好总是添加引号(更改)。很好。但最好总是添加引号(更改)。