[OpenSIPS-Users] Orderly shutdown

Saint Michael venefax at gmail.com
Thu Oct 27 18:06:50 UTC 2022


I want to thank everybody. I finished my project with the help of Vlad Paiu.
Saint Michael

On Thu, Oct 27, 2022 at 12:52 PM Saint Michael <venefax at gmail.com> wrote:
>
> Thanks Bogdan-Andrei
>
> however, if I try to set the whole flag to 0 (from an initial value of
> 15), I get
>
> /usr/local/bin/opensips-cli -x mi set_gflag 0
> ERROR: command 'set_gflag' returned: 400: Bad parameter value
>
> if we somehow get through that issue, then the code would be?
>
> if (is_gflag(0)) {
> xlog("$ci Shutting Down\r\n");
> sl_send_reply(503,"Temporary Failure");
> append_to_reply(503,"Temporary Failure\r\n");
> exit;
> else {
> xlog("$ci Gflag is not set\r\n");
>         }
>
> Sorry for being so pushy. I am open to pay consultancy fees. It's just
> that I already lost a lot of money because I killed opensips with 700
> open calls and lost the billing.
>
>
> On Thu, Oct 27, 2022 at 12:21 PM Bogdan-Andrei Iancu
> <bogdan at opensips.org> wrote:
> >
> > OK, let's do a "back to school" when comes to binary representation and ops
> >
> > Decimal 15 (what you set for initial) is 1111, so all bits (index 0-3)
> > are set to 1, to true. So, when you set (to value 1) the gflag with idx
> > "1" , nothing will be actually changed as it is already 1 :P
> >
> > Regards,
> >
> > Bogdan-Andrei Iancu
> >
> > OpenSIPS Founder and Developer
> >    https://www.opensips-solutions.com
> > OpenSIPS Bootcamp 5-16 Dec 2022, online
> >    https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
> >
> > On 10/27/22 7:05 PM, Saint Michael wrote:
> > > this code does not seem to work: I set the initial value to 15, inside
> > > opensips.cfg
> > > modparam("gflags", "initial", 15)
> > >
> > > Then:
> > > /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.
> > > I imagine that we have a 32 bit field, and we set a bit to 1 for bits 0..31.
> > >
> > > On Thu, Oct 27, 2022 at 11:32 AM Bogdan-Andrei Iancu
> > > <bogdan at opensips.org> wrote:
> > >> Ok, docs fixed, thanks Karsten for spotting the error [0]
> > >>
> > >> Michael, that;s right, if the gflag is set, just reject the code with
> > >> 503 Service Unavailable . You also may consider adding a Retry-After
> > >> header [1] using the append_to_reply() function.
> > >>
> > >> [0]
> > >> https://github.com/OpenSIPS/opensips/commit/5945746b09b480dd0b7f8ea4b3584e4521bdac3a
> > >> [1] https://www.ietf.org/rfc/rfc3261.html#section-20.33
> > >> [2]
> > >> https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_to_reply
> > >>
> > >> Regards,
> > >>
> > >> Bogdan-Andrei Iancu
> > >>
> > >> OpenSIPS Founder and Developer
> > >>     https://www.opensips-solutions.com
> > >> OpenSIPS Bootcamp 5-16 Dec 2022, online
> > >>     https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
> > >>
> > >> On 10/27/22 4:15 PM, Saint Michael wrote:
> > >>> YES
> > >>> Maybe we should fix the documentation?
> > >>> now the real question is, what goes inside the bracket if the flag
> > >>> value matches, to reject the call:
> > >>> I propose
> > >>> {
> > >>> sl_send_reply(503,"Declined");
> > >>>                           exit;
> > >>> }
> > >>>
> > >>>
> > >>> On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer <kwem at gmx.de> wrote:
> > >>>> Hi,
> > >>>>
> > >>>> I am not familiar with the gflags module, but
> > >>>>
> > >>>> Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:
> > >>>>> for testing I added
> > >>>>> route{
> > >>>>> if (is_gflag("1")) {
> > >>>>>                   t_relay("udp:10.0.0.1:5060");
> > >>>>>           } else {
> > >>>>>                   t_relay("udp:10.0.0.2:5060");
> > >>>>>           }
> > >>>> I think, You should remove the quotes around the "1".
> > >>>>
> > >>>> I think, the example in the docs may be wrong (Your code was from the
> > >>>> docs, I think). See section 1.4.3, where
> > >>>>           if(is_gflag(4))
> > >>>> is written.
> > >>>>
> > >>>> HTH,
> > >>>>
> > >>>> Karsten
> > >>>>
> > >>>>
> > >>>>
> > >>>> _______________________________________________
> > >>>> Users mailing list
> > >>>> Users at lists.opensips.org
> > >>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >



More information about the Users mailing list