[Kamailio-Users] cfgutils module
Alex Balashov
abalashov at evaristesys.com
Wed Aug 5 12:03:28 CEST 2009
Alex Balashov wrote:
> Daniel-Constantin Mierla wrote:
>
>> IIRC, the mi command takes a bitmask as value while the config
>> function takes the index in bitmask. So, if you want to test flag 2:
>>
>> if(is_gflag("2"))
>>
>> kamctl fifo set_gflag 4
>>
>> 4 = 2^2
>>
>> For flag ten you have to set it via mi to 2^10 which is 1024.
>>
>> Try and see if works.
>
> This seems inconsistent and needlessly complicated and does not follow
> from the documentation at all. I would recommend changing the set_gflag
> MI function to take the bit offset as an argument rather than the
> bitmask if is_gflag() checks the offset.
Well, OK, I take that back -- it does follow from the documentation, if
the parenthetical statements are payed careful attention. I still think
it should be changed on the MI side to be more consistent and easier to
work with.
The other problem with the current situation is that in order to set a
particular bit to 1 without wiping out any other flags that may have
been set in the past, it is necessary to first get the current value
from get_gflags and manually do the math. That's needlessly complex for
users who aren't programmers; not everybody has the powers of 2 and the
common products of powers of 2 memorised.
-- Alex
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (678) 237-1775
More information about the Users
mailing list