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

Calvin Ellison calvin.ellison at voxox.com
Fri Apr 9 17:24:58 EST 2021


Thanks, Răzvan! Better late than never :)

Should we expect to see this fix in 3.1 LTS soon?


Regards,

*Calvin Ellison*
Systems Architect
calvin.ellison at voxox.com
+1 (213) 285-0555

-----------------------------------------------
*voxox.com <http://www.voxox.com/> *
5825 Oberlin Drive, Suite 5
San Diego, CA 92121
[image: Voxox]


On Fri, Apr 9, 2021 at 4:18 AM Răzvan Crainea <razvan at opensips.org> wrote:

> 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
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210409/98a0dd8b/attachment.html>


More information about the Users mailing list