<p>In the following I'm specifically referencing the kinds of stats you can obtain from:<br>
opensipsctl fifo get_statistics all</p>

<p>I'm not sure of the right way to do this. I think there are a number of reasons why during script processing we'd want to check on the international statistics. Normally I think it would be for resource management. </p>

<p>One particular idea I had was to "preserve children to handle call tear downs during very heavy traffic". The switch will always have a melt down point. It's important that when it does melt down, that melt down is graceful and as harmless as possible. In a "typical" switch, INVITE transactions perform costly lookups that can hang children. As load increases, the likelihood of hanging children increases. Unfortunately, this blocks <em>all</em> request types being processed by OpenSIPs. Ultimately, I'd like to be able to say something like, if 75% of my children are busy then do X. For example:</p>

<pre><code>if (($internal_stat(child_load)) &gt; 75 &amp;&amp; is_method("INVITE")) {
    send_reply("500","Server too busy");
    exit;
</code></pre>

<p>The net effect is that when the server load on the child is &gt; 75 we simply don't take any new calls. In this scenario, we essentially are reserving 25% of our processing capability to ensure we can process things like BYEs, ACKs, maybe even re-INVITEs for existing sessions. </p>

<p>Without this (the today scenario), if all children are blocked, we ignore BYEs, we ignore ACKs, calls get stuck in a hung state and it's a big mess. </p>

<p>Of course, I'm making some pretty application specific assumptions. Specifically that INVITEs are expensive and BYEs are cheap. This is more or less why I'm looking for a scriptable way to do this so the script writer can apply the logic as it's appropriate.</p>

<p>In the above example <code>$internal_stat(child_load)</code> is the new thing I want, and is essentially the value of:<br>
load:-load = 0</p>

<p>I'd welcome some suggestions for alternate ways to do this as well. </p>

<p>Thanks!<br>
-Brett</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/362">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/5479561__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyOTE0ODgwNywiZGF0YSI6eyJpZCI6NDYwODkzNDl9fQ==--a3a1970f4ba2e5bed5d87286cfb2c29439a2e903.gif" width="1" /></p>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"View this Issue on GitHub","action":{"@type":"ViewAction","url":"https://github.com/OpenSIPS/opensips/issues/362","name":"View Issue"}}</script>