On 21/09/2023 08:10, Daniel-Constantin Mierla wrote:
Hello,
where do you use the value? Do you set it to $var(...) or another
variable? Which? Or do you use it to compose a string with some address
having q parameter?
Hi Daniel,
I actually found the issue. I am using an SQLite db for this, and it is
a bit funny in how it handles floating point. I get the correct value
when I query "SELECT 1.00 - (20.00/100.00);"
Thanks
-Barry
Cheers,
Daniel
On 20.09.23 17:17, Barry Flanagan wrote:
> On Wed, 20 Sep 2023, at 14:36, Barry Flanagan wrote:
>> Hi
>>
>> I need to take in a priority (from 0 to 100, 0 being highest prio) and
>> convert this into a Q value between 0 and 1.0
>>
>> My idea was to simply do:
>>
>> q_value = 1 - ($var(priority)/100)
>>
>> However, it seems Kamailio only deals in integers in the config. A
>> Previous post suggested using xavp vars, but this ends up the same result.
>>
>> Apart from doing a pseudo SQL query "SELECT 1 - (20/100)" is there any
>> way within the config I can do such maths?
>>
> I tried using the SQL, and although the query returns "0.8000" the
resulting var seems to only interpret this as an integer. How can I force it to be a
string? I tried changing my select to "SELECT cast(1 - (20/100) as char(10)) AS
qval" but still my result var is saved as 1
>
> Thanks
> -Barry
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> 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!
> Edit mailing list options or unsubscribe:
--
-Barry