[OpenSIPS-Users] opensips - graceful maintenance mode?

solarmon solarmon at one-n.co.uk
Tue Jan 21 06:47:44 EST 2020


Hi Liviu,

OK, I understand now. Thank you.

I was hoping not to touch the routing script at this moment.

So to be clear, I cannot use the dispatcher endpoint method to stop
responding to SIP Options pings? If I can do that, then that is the
equivalent - since our platform would see opensips as unhealthy and not
send calls to it.

Thank you.

On Tue, 21 Jan 2020 at 11:43, Liviu Chircu <liviu at opensips.org> wrote:

> On 21.01.2020 13:06, solarmon wrote:
>
> Thanks for the tip about the $shv global variables. The link you gave is
> for 3.1.x, I found the equivalent for 2.4.x which is the version I'm
> currently using. Is the 'drain' feature also included in this 2.4.x
> implementation?
>
> The shared variables ($shv) support has stayed the same throughout the
> years.  And the "drain"
> feature is something that each script writer can build for themselves,
> there is no ready-made solution.
>
>
> Do you have any specific examples of how to do this 'drain' mode?
>
> A possible way to do it (adjust as per your platform):
>
> ...
> loadmodule "cfgutils.so"
> modparam("cfgutils", "shvset", "drain_mode=i:0")
> ...
>
> route {
>   if (!has_totag() && $shv(drain_mode)) {
>       append_hf("Retry-After: 60 (Server Restarting)\r\n");
>       send_reply(503, "Maintenance");
>       exit;
>   }
> }
>
>
> When I try the 'opensipsctl fifo shv_get debug' on my opensips server I
> get the following error:
>
> 500 command 'shv_get' not available
>
> I assume I need to have the 'cfgutils' module enabled and loaded for it
> to work?
>
> Exactly.  See my above example of defining $shv variables.
> Best regards,
>
> --
> Liviu Chircuwww.twitter.com/liviuchircu | www.opensips-solutions.com
>
> OpenSIPS Summit, Amsterdam, May 2020
>   www.opensips.org/events
> OpenSIPS Bootcamp, Miami, March 2020
>   www.opensips.org/training
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200121/58d2e87b/attachment.html>


More information about the Users mailing list