[OpenSIPS-Users] regex value too long OR how to properly quote/escape Redis raw query

Calvin Ellison calvin.ellison at voxox.com
Sun Apr 4 20:09:58 EST 2021


I need to post a JSON object to Elsasticsearch, and I am using Redis as a
queue via cache_raw_query and the RPUSH command. The JSON object contains
spaces, which appears to cause the OpenSIPS Redis client to break the
string into pieces and push each of them to Redis separately.

1. Maybe I'm not quoting correctly?
RPUSH snarf-cdrs 'object_goes_here'

It doesn't seem to matter if I enclose the Resid list value in single
quotes or not.

I initially resolved this problem by escaping spaces with their escaped
Unicode equivalent. This has the desired result in Elasticsearch, but now
my JSON object is bigger and the regex replacement fails. Is there a
workaround?

$var(replaceSpace) = "/ /\\\u00a0/sg";
$avp(body) = $(json_compact(body){re.subst,$var(replaceSpace)});

DBG:core:tr_eval_re: Trying to apply regexp [/ /\\u00a0/sg] on :
[{"index":"snarf-2021.04.03","time":"2021-04-03T03:34:18","TID":"006508","BLOCKED":1,"SVCPORT":"8.38.43.182","CALLID":"bf0ea503853749618c747a995b7f0102","SOURCEIP":"192.168.47.130","MEDIAIP":"192.168.47.130","ANI":"2132850555","DNIS":"2132850555","SNARF":"NONE","FRAUD":0,"TCPA":0,"NEIGHLATA":"1","NEIGHRC":"1","NEIGHBLOCK":"1","NEIGHPREFIX":"1","ATFN":0,"BTFN":0,"ALRN":"2132620105","AState":"CA","ANetwork":"
BANDWIDTH.COM CLEC- LLC - CA","AOCN":"979E","ARatecenter":"LSAN DA
01","AClass":"L","ALATA":"730","ACountry":"US","AReachable":"1","AReason":"SS7
ID","ADNC":"0","AGood":"1","ADNO":"0","BLRN":"2132620105","BState":"CA","BNetwork":"
BANDWIDTH.COM CLEC- LLC - CA","BOCN":"979E","BRatecenter":"LSAN DA
01","BClass":"L","BLATA":"730","BCountry":"US","BReachable":"1","BReason":"SS7
ID","BDNC":"0","BGood":"1","BDNO":"0","TRIGGERS":["neighBlock"],"RULES":{"tid":"006508","rep":"none","fraud":0,"tcpa":95,"aclass":false,"adno":false,"atfn":false,"bclass":false,"bdnc":false,"bgood":false,"neighBlock":true,"neighLata":false,"neighRc":false,"neighPrefix":false}}]
Apr  3 03:34:18 ve-lab /usr/sbin/opensips[14291]: DBG:core:tr_eval_re: we
must compile the regexp
Apr  3 03:34:18 ve-lab /usr/sbin/opensips[14291]: DBG:core:subst_parser:
ok, se is 0x7f8737c1f0e8
Apr  3 03:34:18 ve-lab /usr/sbin/opensips[14291]: ERROR:core:tr_eval_re:
regex value too long
[{"index":"snarf-2021.04.03","time":"2021-04-03T03:34:18","TID":"006508","BLOCKED":1,"SVCPORT":"8.38.43.182","CALLID":"bf0ea503853749618c747a995b7f0102","SOURCEIP":"192.168.47.130","MEDIAIP":"192.168.47.130","ANI":"2132850555","DNIS":"2132850555","SNARF":"NONE","FRAUD":0,"TCPA":0,"NEIGHLATA":"1","NEIGHRC":"1","NEIGHBLOCK":"1","NEIGHPREFIX":"1","ATFN":0,"BTFN":0,"ALRN":"2132620105","AState":"CA","ANetwork":"
BANDWIDTH.COM CLEC- LLC - CA","AOCN":"979E","ARatecenter":"LSAN DA
01","AClass":"L","ALATA":"730","ACountry":"US","AReachable":"1","AReason":"SS7
ID","ADNC":"0","AGood":"1","ADNO":"0","BLRN":"2132620105","BState":"CA","BNetwork":"
BANDWIDTH.COM CLEC- LLC - CA","BOCN":"979E","BRatecenter":"LSAN DA
01","BClass":"L","BLATA":"730","BCountry":"US","BReachable":"1","BReason":"SS7
ID","BDNC":"0","BGood":"1","BDNO":"0","TRIGGERS":["neighBlock"],"RULES":{"tid":"006508","rep":"none","fraud":0,"tcpa":95,"aclass":false,"adno":false,"atfn":false,"bclass":false,"bdnc":false,"bgood":false,"neighBlock":true,"neighLata":false,"neighRc":false,"neighPrefix":false}}]

opensips 3.1.1
Ubuntu 18.04.5 LTS
Linux ve-lab 4.15.0-140-generic #144-Ubuntu SMP Fri Mar 19 14:12:35 UTC
2021 x86_64 x86_64 x86_64 GNU/Linux


Regards,

*Calvin Ellison*
Systems Architect
calvin.ellison at voxox.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210404/01e05649/attachment.html>


More information about the Users mailing list