[Kamailio-Users] Comparing AVPs to user variables
Daniel-Constantin Mierla
miconda at gmail.com
Wed Sep 23 07:26:05 CEST 2009
On 22.09.2009 21:37 Uhr, Alex Balashov wrote:
> The $avp(s:call_limit) came from a numerical database field, but was
> returned by a Perl script (via the Perl module), perhaps as a string,
> not sure.
if you are not sure both are int, use the {s.int} transformation to
force that.
Cheers,
Daniel
>
> catalina oancea wrote:
>
>> How did your vars get their values? This problem happened to me once
>> when I got string values instead of integers from mysql.
>> The comparison was made as if the values were strings not integers.
>>
>>
>> 2009/9/22 Daniel-Constantin Mierla <miconda at gmail.com>:
>>> Hello,
>>>
>>> On 22.09.2009 18:43 Uhr, Alex Balashov wrote:
>>>> Is there a known bug in Kamailio 1.4.1 that causes comparisons like
>>>> this
>>>> to be inaccurate?
>>> not remember right now, could you try with the last in that branch?
>>> If still
>>> there, should be fixed - 1.4.x is still maintained for such bugs,
>>> which is
>>> pretty strange considering that comparing such variables is done
>>> very often
>>> in my configs.
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>>> get_profile_size("people", "$avp(s:person_id)",
>>>> "$var(u_call_count)");
>>>>
>>>> ...
>>>>
>>>> if($var(u_call_count) >= $avp(s:call_limit))
>>>>
>>>> In this case, $var(u_call_count) was 3 and $avp(s:call_limit) was
>>>> 26 - I
>>>> printed both values beforehand. Yet, the comparison was evaluated
>>>> as true.
>>>>
>>>> I worked around the problem by storing the profile size in an AVP
>>>> as well
>>>> and comparing them instead, and it seems to have solved the problem:
>>>>
>>>> if($avp(s:u_call_count) >= $avp(s:call_limit))
>>>>
>>>> However, I was wondering if this is a known problem in 1.4.1 and
>>>> possibly
>>>> 1.4.x.
>>>>
>>>> Thanks!
>>>>
>>> --
>>> Daniel-Constantin Mierla
>>> * http://www.asipto.com/
>>>
>>>
>>> _______________________________________________
>>> Kamailio (OpenSER) - Users mailing list
>>> Users at lists.kamailio.org
>>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>>
>
>
--
Daniel-Constantin Mierla
* http://www.asipto.com/
More information about the Users
mailing list