[SR-Users] Storing an integer value into AVP from REDIS string

Stephen Bucklin steve at telcoelectronics.uk
Tue May 21 09:34:28 CEST 2019


Daniel,
Sorry, I did not see your reply as well. I struggle with mobile email! :-)
Yes, as above I used the s.int but was possibly looking at a more elegantly
constructed methid when moving the value into the avp at the start.
Steve

On Tue, 21 May 2019 at 07:50, Stephen Bucklin <steve at telcoelectronics.uk>
wrote:

> Hi,
> I would like to set is an an integer. Forgive me as I am on mobile so this
> is from memory. I am getting a string using REDIS something like:
>
> Redis_cmd("dB","GET key:xyz","r")
>
> I now have some string in $redus(r=>value) say
>
> {"this":"that","mum":"3","other":"here"}
>
> I have used the jansson_get to move the value of the specific key into an
> AVP for use. If I move the value 3 that is keyed by "num" from the Jason
> into the AVP it is a string. I can use $avp(val) = $(avp(val){s.int}) and
> that will work but was wondering if there was a more elegant solution to
> this?
> Just finding my way around this new landscape :-)
>
> Steve
>
>
> On Mon, 20 May 2019 at 18:14, Alex Balashov <abalashov at evaristesys.com>
> wrote:
>
>> You want to validate that the value is an integer, or coerce the internal
>> type of the AVP to integer?
>>
>>>> Sent from mobile, with due apologies for brevity and errors.
>>
>> > On May 20, 2019, at 7:52 AM, Stephen Bucklin <steve at telcoelectronics.uk>
>> wrote:
>> >
>> > Hi,
>> > Any quick thoughts. I am using a REDIS "GET" to retrieve a JSON obj as
>> a string from REDIS and then the JANSSON get value to extract a key value
>> from the string and pop it into an AVP ($avp(val)) and wish to ensure the
>> value is an integer in the AVP. New to this, be kind :-)
>> > Steve
>> > _______________________________________________
>> > Kamailio (SER) - Users Mailing List
>> > sr-users at lists.kamailio.org
>> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190521/0298144a/attachment.html>


More information about the sr-users mailing list