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