gflags module script and MI command difference

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gflags module script and MI command difference

Arto Kuiri

Hi,


I noticed that in opensips script gflags and MI commands gflags is off by 1.


if i have this kind of check:


if(is_gflag("1")) {
   xlog("** MAINTANCE MODE \n");
}


and I try to set it on with MI command:

opensipsctl fifo set_gflag 1

it wont work, but this works:

opensipsctl fifo set_gflag 2

is this intended? If it is, I think documentation should mention it?

Tested this with 2.4.x

Regards,
Arto Kuiri


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: gflags module script and MI command difference

Bogdan-Andrei Iancu-2
Hi Arto,

No, there should be no offset at all. The is_gflag function takes as parameter the index of the bit to be checked, while the MI functions (like set_gflag) take as parameter a bitmask with all the bits to be operated with.

So, if you setting the bitmask 2 -> you set bit index 1 (2<<1) . With bitmask 1 you set the bit index 0 (2<<0).

Regards,
Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Summit 2018
  http://www.opensips.org/events/Summit-2018Amsterdam
On 02/09/2018 01:43 PM, Arto Kuiri wrote:

Hi,


I noticed that in opensips script gflags and MI commands gflags is off by 1.


if i have this kind of check:


if(is_gflag("1")) {
   xlog("** MAINTANCE MODE \n");
}


and I try to set it on with MI command:

opensipsctl fifo set_gflag 1

it wont work, but this works:

opensipsctl fifo set_gflag 2

is this intended? If it is, I think documentation should mention it?

Tested this with 2.4.x

Regards,
Arto Kuiri



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users