the fact that $var cannot hold value seems to be a constant cause of confusion. opensips version 1.9.0 has this:
$var() script variables have now an explicit value of NULL, so values can be (a) integer, (b) string or (c) NULL. The NULL value can be tested in an "if" conditions
i don't know how it is implemented, but might be a good idea for kamailio too.
-- juha
Hello,
On 10/12/13 01:28, Juha Heinanen wrote:
the fact that $var cannot hold value seems to be a constant cause of confusion.
this confusion is similar to the fact that $ci cannot be null as well (or many other pvs). Then also $avp(...) doesn't hold $null value -- is_null(...) for an avp is 'it doesn't exist'.
There is a patch for it and is not big, but I don't find it really clarifying the overall situation just moving to a new behavior the $val(...). I proposed to make it configurable via mod param, but then was no other follow up. Now I think it might be better to make it a new class of variables and proper say in docs that one can hold $null, the other cannot hold - e.g., $lv(...) for local variable . I do rely a lot on the fact that $var(...) comes initialized with 0 and it is reset to 0.
For anyone interesting in working on it, patch is on tracker: https://sip-router.org/tracker/index.php?do=details&task_id=141#comment2... Cheers, Daniel