<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 21.01.2020 13:06, solarmon wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOXfywM6cyzfQD9SNGT8C34m37=PL7nYo3kUWQz4OzfS6pAJ1g@mail.gmail.com">
<div>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?<br>
</div>
</blockquote>
<tt>The shared variables ($shv) support has stayed the same
throughout the years. And the "drain"<br>
feature is something that each script writer can build for
themselves, there is no ready-made solution.</tt>
<blockquote type="cite"
cite="mid:CAOXfywM6cyzfQD9SNGT8C34m37=PL7nYo3kUWQz4OzfS6pAJ1g@mail.gmail.com">
<div><br>
</div>
<div>Do you have any specific examples of how to do this 'drain'
mode?</div>
</blockquote>
<tt>A possible way to do it (adjust as per your platform):<br>
<br>
...<br>
loadmodule "cfgutils.so"<br>
modparam("cfgutils", "shvset", "drain_mode=i:0")<br>
...<br>
<br>
route {<br>
if (!has_totag() && $shv(drain_mode)) {<br>
append_hf("Retry-After: 60 (Server Restarting)\r\n");<br>
send_reply(503, "Maintenance");<br>
exit;<br>
}<br>
}</tt>
<blockquote type="cite"
cite="mid:CAOXfywM6cyzfQD9SNGT8C34m37=PL7nYo3kUWQz4OzfS6pAJ1g@mail.gmail.com">
<div><br>
</div>
<div>When I try the 'opensipsctl fifo shv_get debug' on my
opensips server I get the following error:</div>
<div><br>
</div>
<div>500 command 'shv_get' not available<br>
</div>
<div><br>
</div>
<div>I assume I need to have the '<span
style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify">cfgutils</span><span
style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify">' </span>module
enabled and loaded for it to work?</div>
</blockquote>
<p><tt>Exactly. See my above example of defining $shv variables.</tt></p>
<tt>Best regards,</tt>
<pre class="moz-signature" cols="72">--
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/liviuchircu">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a>
OpenSIPS Summit, Amsterdam, May 2020
<a class="moz-txt-link-abbreviated" href="http://www.opensips.org/events">www.opensips.org/events</a>
OpenSIPS Bootcamp, Miami, March 2020
<a class="moz-txt-link-abbreviated" href="http://www.opensips.org/training">www.opensips.org/training</a></pre>
</body>
</html>