我想在Asterisk中转义\到\\和“到\”。我试过使用REPLACE但是我无法让它工作。我目前的方法如下
exten => sms,1,Set(UNSAFESMSTXT=${REPLACE(SMSTXT,\\,\\\\)})
exten => sms,2,Set(SAFESMSTXT=${REPLACE(UNSAFESMSTXT,",\\")})
; Echo escaped input to terminal safely
exten => sms,n,System(echo "${SAFESMSTXT}")
当我发送echo hi“echo hi时,我收到错误
ERROR[8239]: func_strings.c:804 replace: The characters to search for and the variable name must not be empty.
如果有帮助,我会使用chan_mobile。
答案 0 :(得分:0)
功能描述中不清楚的是什么?
Asterisk func REPLACE
Synopsis:
Replace a set of characters in a given string with another character.
Description:
Iterates through a string replacing all the <find-chars> with <replace-ch
ar>. <replace-char> may be either empty or contain one character. If empty,
all <find-chars> will be deleted from the output.
NOTE: The replacement only occurs in the output. The original variable is
not altered.
Syntax:
REPLACE(varname,find-chars[,replace-char])
你有使用\&#34;而不是&#34;