[OpenSIPS-Users] regex value too long OR how to properly quote/escape Redis raw query
Răzvan Crainea
razvan at opensips.org
Fri Apr 9 11:17:34 EST 2021
Hi, Calvin!
The "regex value too long" error should have already been fixed[1], but
I somehow forgot to inform you :(. Can you please run another test now
and let us know if there are other issues?
[1]
https://github.com/OpenSIPS/opensips/commit/a8f8aabc245ca86bd40a9eddf9befcd74a087be1
Best regards,
Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com
On 4/9/21 12:02 AM, Calvin Ellison wrote:
> Any suggestion for resolving "regex value too long" when using
> the re.subst transformation?
>
> Any way to fix the Redis client so it does not break on spaces when the
> value is single-quoted? From what I understand, modern Redis servers
> support single-quoted strings.
>
>
> On Sun, Apr 4, 2021 at 1:09 PM Calvin Ellison <calvin.ellison at voxox.com
> <mailto:calvin.ellison at voxox.com>> wrote:
>
> 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
> <http://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
> <http://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
> <http://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
> <http://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 <mailto:calvin.ellison at voxox.com>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
More information about the Users
mailing list