2011/6/16 Daniel-Constantin Mierla <miconda(a)gmail.com>om>:
that function is probably for ser-like AVPs.
back to your original need, you can use directly if conditions like:
if($var(x) & 2) { ... }
will be true if the second bit is set. You have to use the power of two for
the appropriate integer value to match the bit position.The master branch has bitwise
left/right shift operations as well
Ok, so the above example if($var(x) & 2) { ... } will just work
because the number 2 has the bit 2 with value 1 (well, in fact the bit
1 as the first one is the bit 0). But if I want to compare the bit 5 I
need first to get 2^5 (for the second & operator) which I can get
using bitwise left/right shift functions, am I right? (since there is
no way in kamailio to calculate 2^N directly).
--
Iñaki Baz Castillo
<ibc(a)aliax.net>