2015-02-08 59 views
0

我想在\ Asterisk中將\ \和\轉換爲\。我嘗試過使用REPLACE,但是我無法使它工作。我目前的做法是如下我如何在星號中使用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}") 

當我發送迴應喜「回聲嗨,我得到的錯誤

ERROR[8239]: func_strings.c:804 replace: The characters to search for and the variable name must not be empty. 

我用chan_mobile是否有幫助。

回答

0

什麼是功能n要夾板說明?

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]) 

你必須使用\ 「而不是」

+0

我有點sl because,因爲我沒有注意到你不能用2個字符替換1個字符。然而,我通過在'和'之間加入輸入來解決這個問題,我用\替換\'。謝謝你的幫助,你的回答真的有幫助。(對不起,遲到的答案,我的服務器死了,所以我不得不切換一些硬件)。 – user1938742 2015-02-26 09:28:23

相關問題