[SR-Users] converting integer to string

Daniel-Constantin Mierla miconda at gmail.com
Thu May 26 16:57:13 CEST 2016


Apparently the string representation for avps via pv framework used
unsigned int. I pushed a patch to master to use signed version.

What you can do is to use $var(auth_code) instead of $avp(auth_code).

Cheers,
Daniel


On 25/05/16 19:33, Henry Fernandes wrote:
> In Kamailio 4.2, I’m having problems converting an AVP integer value
> into a string. 
>
> My Kamailio config stores the return code from auth_check() and
> outputs it.  
>
>     $avp(auth_code) = auth_check("$fd", "subscriber", "1");
>
>     xlog("L_NOTICE", “response = $avp(auth_code)”);
>
>
> When I check the AVP against an integer, it behaves normally.
>  However, I cannot convert it to a string.  The return value -3
> (invalid user) gets converted to the string “18446744073709551613”
> when outputting it.
>
>
> My hunch is that Kamailio is treating the AVP as an unsigned integer
> (rather than a signed integer) when it converts it to a string.  If I
> try this with an AVP with a positive integer, it works as expected.
>
>
> Can someone tell me how to convert a negative integer into a string in
> Kamailio?
>
> -H
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://www.asipto.com - http://www.kamailio.org
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160526/526c57ab/attachment.html>


More information about the sr-users mailing list