As I see you use $var() in the example
If you use $var in the configuration itself, then make sure you call
$var() from the same worker
if it is an async operation and data is transferred via the $var() then the
data will be at least wrong depending on what you are setting to the
variable it also can be corrupted.
Just a workaround ( not a bug fix ) to unblock processes
To use Lua-based base64 (for example
)
then you don't need to rely on Kamailio-based implementation
чт, 28 нояб. 2024 г. в 13:34, Dirk Brouwers |
Hello,
To clarify, I am consistently using the base64t transformation for both
cases.
In kamailio.cfg, I use the transformation
`$(var(encoded_json){s.decode.base64t})`, which correctly decodes the
Base64 string.
In Lua, I am passing the same transformation to
`KSR.pv.get("$(var(encoded_json){s.decode.base64t})")`, but the output
appears corrupted when logged using KSR.xlog.xinfo.
There is no mix between base64 and base64t in my tests.
What I forgot to mention in my previous question is that I am using
Kamailio version 5.7.6 (x86_64/linux).
Please let me know if you need additional information.
Kind regards,
Dbrcm
-----Original Message-----
From: Daniel-Constantin Mierla <miconda(a)gmail.com>
Sent: Thursday, November 28, 2024 12:21
To: Kamailio (SER) - Users Mailing List <sr-users(a)lists.kamailio.org>
Cc: Dirk Brouwers |
CM.com <Dirk.Brouwers(a)cm.com>
Subject: Re: [SR-Users] Potential Bug in Kamailio: Base64 Decode
Transformation Not Working in Lua but Works in kamailio.cfg
[EXTERNAL EMAIL]
Hello,
I see you mention both base64 and base64t, while they are very similar,
there are some differences in charsets and if encoded with one might not be
properly decoded with the other. Is it only one used or it is a mix what
you try?
Cheers,
Daniel
On 28.11.24 11:32, Dirk Brouwers |
CM.com via sr-users wrote:
Dear Kamailio Developers,
I am writing to report a potential bug in Kamailio's handling of base64
decoding when using the Lua scripting interface (app_lua).
It appears that base64 decoding behaves
inconsistently between Lua
scripts and kamailio.cfg.
When using `$(var(encoded_json){s.decode.base64t})` in kamailio.cfg,
where
$var(encoded_json) contains the encoded base64 string:
`eyJmb28iOiJiYXIifQ` it decodes to the correct `{"foo":"bar"}`.
But when using the same transformation in Lua
`KSR.xlog.xinfo("Decoded
in Lua: ".. KSR.pv.get("$(var(encoded_json){s.decode.base64t})"))` it
logs a corrupted encoded base64 string: `Decoded in Lua:
..]..#035z{b.?...#036..-....`
Thank you in advance for looking into this issue. Please let me know if
you need
additional details or test cases.
Kind regards,
Dbrcm
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions --
sr-users(a)lists.kamailio.org To unsubscribe send an email to
sr-users-leave(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to
the
sender!
--
Daniel-Constantin Mierla (@
asipto.com)
twitter.com/miconda --
linkedin.com/in/miconda Kamailio Consultancy,
Training and Development Services --
asipto.com
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions --
sr-users(a)lists.kamailio.org
To unsubscribe send an email to sr-users-leave(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to
the sender!