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 Chircu
www.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
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to