[OpenSIPS-Users] Problem with gflags

Saint Michael venefax at gmail.com
Thu Oct 27 15:26:40 UTC 2022


this code does not seem to work: the initial value is 15, inside opensips.cfg

/usr/local/bin/opensips-cli -x mi set_gflag 1
"OK"
/usr/local/bin/opensips-cli -x mi get_gflags
{
    "hex": "0xF",
    "dec": "15"
}

Maybe I am not following the whole thing. I apologize.


On Thu, Oct 27, 2022 at 11:14 AM Saint Michael <venefax at gmail.com> wrote:
>
> I am afraid I am not seeing it clearly:
> from the command line I set
> opensips-cli -x mi set_gflag 1
> "OK"
> what function will test if this is true inside the code?
> this does not work
> if (is_gflag(1)) {
> xlog("$ci Shutting Down\r\n");
>         }
>  else {
> xlog("$ci Gflag is not 1\r\n");
>         }
>
> it is counterintuitive that you set Bit 1 from the command line and
> then test it inside the code but it fails the test.
> How can I print the current gflag inside xlog();
>
>
>
> On Thu, Oct 27, 2022 at 11:00 AM Liviu Chircu <liviu at opensips.org> wrote:
> >
> > On 27.10.2022 17:55, Saint Michael wrote:
> > > I just need to know how to check for the gflag inside the code
> > > this:
> > >   if (is_gflag("1")) {..}
> > > does not work, even if the flag is (1), as I wrote this test from the
> > > command line works
> > >
> > > opensips-cli -x mi is_gflag 1
> > > true
> > >
> > > As you can see, unless you can test for the gflag value inside the
> > > code, it cannot be used. The module gflag is of a great importance
> > > when managing Opensips, because it allows for an orderly shutdown
> > > without losing CDR, that is: money.
> > >
> > > Many thanks.
> >
> > Script: is_gflag(0) (is bit "0" set?)
> > MI: is_gflag(1)     (are all bits in bitmask "1" set?)
> >
> > --
> > Liviu Chircu
> > www.twitter.com/liviuchircu | www.opensips-solutions.com
> >



More information about the Users mailing list