btw, I just tested with:
KSR.pv.sets("$var(x)", "{\"foo\":\"bar\"}");
KSR.pv.sets("$var(e)", KSR.pv.get("$(var(x){s.encode.base64t})"));
KSR.pv.sets("$var(d)", KSR.pv.get("$(var(e){s.decode.base64t})"));
KSR.info("===== data: " .. KSR.pv.get("$var(x)") .. " - " ..
KSR.pv.get("$var(e)") .. " - " .. KSR.pv.get("$var(d)") .. "\n");
and the log looks good:
INFO: <core> [core/kemi.c:107]: sr_kemi_core_info(): ===== data:
{"foo":"bar"} - eyJmb28iOiJiYXIifQ - {"foo":"bar"}
Cheers,
Daniel
On 28.11.24 12:21, Daniel-Constantin Mierla wrote:
> 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 --
>> [email protected]
>> To unsubscribe send an email to [email protected]
>> 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
>
--
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 --
[email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!