[Kamailio-Devel] How to escape "$" when using it into a string?
Iñaki Baz Castillo
ibc at aliax.net
Sun Jan 11 19:28:11 CET 2009
Hi, I've created a exported function with two string parameters:
pcre_match(string, regex)
- 'string' is a simple string or pseudo-variable.
- 'regex' is also a simple string or pseudo-variable which in my code I
compile to a PCRE regular expression (no usage of t_regex so I don't want to
use "fixup_regexp").
The function in the Kamailio script would be like:
if pcre_match("$fU", "^ibc$") ...
Unfortunatelly I can't use it since Kamailio complains about the syntax of the
second parameter (because the $) and gives an error:
------
ERROR:core:pv_parse_spec: error searching pvar ""
ERROR:core:pv_parse_spec: wrong char [$/36] in [$] at [0 (0)]
ERROR:core:fixup_spve: wrong format[^ibc\$]
ERROR:core:fix_actions: fixing failed (code=-1) at cfg line 677
ERROR:core:main: failed to fix configuration with err code -1
------
Ok, I understand the problem: when the Kamailio reads the $ it expects a
pseudo-variable ($ru, $dd...) but it finds:
"^ibc$"
so tries to lookup for a pseudo-variable called "" and returns error.
How could I solve it? How could escape a $ when using it in a string argument
of Kamailio script?
Thanks a lot.
--
Iñaki Baz Castillo
More information about the Devel
mailing list