<div dir="ltr">Hi,<div><br></div><div>maybe this is a valid example:</div><div><a href="http://kamailio.org/docs/modules/devel/modules/dispatcher.html#idp3610384">http://kamailio.org/docs/modules/devel/modules/dispatcher.html#idp3610384</a><br></div><div><br></div><div>Kind regards,</div><div>Carsten</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-12 17:11 GMT+01:00 Richard Good <span dir="ltr"><<a href="mailto:richard.good@smilecoms.com" target="_blank">richard.good@smilecoms.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi<br><br>Sounds like a good idea. <br><br></div>Please can you elaborate more on what you mean by a script callback via dedicated route - or point me towards somewhere in kamailio where this is already used so I can re-use it.<br><br>Regards<br></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><table style="width:450.0pt" width="600" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="padding:0cm" valign="top"><table width="320px" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family:Arial,sans-serif;color:rgb(117,179,67);line-height:18px;padding-left:15px;padding-top:10px"><font><b>Richard Good<br></b></font></td>
                
        </tr>
        <tr>
                 <td style="font-family:Arial,sans-serif;color:rgb(117,179,67);line-height:18px;padding-left:15px;padding-top:10px"><font><b>Senior Manager: Applications & Services<br></b></font></td>
        </tr>
        <tr>
                 <td style="font-family:Arial,sans-serif;color:rgb(134,145,154);line-height:18px;padding-left:15px;padding-top:10px"><font><b>Smile Communications Pty (Ltd)</b></font></td>
        </tr>
        <tr>
                <td>
                <table width="100%" cellpadding="0" cellspacing="0">
            <tbody><tr>
                <td style="font-family:Arial,sans-serif;color:rgb(134,145,154);line-height:18px;padding-left:15px;padding-top:10px" width="27%">
                        <font><b>Mobile:</b></font>
                </td>
                <td style="font-family:Arial,sans-serif;color:rgb(134,145,154);line-height:18px;padding-left:10px;padding-top:10px" width="73%"><font>
                        <a href="tel:%2B27%20%280%29%2072%20389%208365" value="+27723898365" target="_blank">+27 (0) 72 389 8365</a>
                </font></td>
            </tr>                
            
            <tr>
                <td style="font-family:Arial,sans-serif;color:rgb(134,145,154);line-height:18px;padding-left:15px;padding-top:10px">
                <font><b>   Skype:</b></font>
                </td>
                <td style="font-family:Arial,sans-serif;color:rgb(134,145,154);line-height:18px;padding-left:10px;padding-top:10px"><font>
                        richard.a.good<br></font></td>
            </tr>
            
            </tbody></table>
        </td>
        </tr>
        <tr>
                <td style="font-family:Arial,sans-serif;color:rgb(117,179,67);line-height:18px;padding-left:15px;padding-top:10px">
        <font><a style="font-family:Arial;color:rgb(117,179,67);text-decoration:none" href="mailto:name.surname@smilecoms.com" target="_blank">richard.good@smilecoms.com</a></font></td>
        </tr>
    <tr>
                <td style="font-family:Arial,sans-serif;color:rgb(117,179,67);line-height:18px;padding-left:15px;padding-top:10px">
        <font><a style="font-family:Arial;color:rgb(117,179,67);text-decoration:underline" href="http://www.smilecoms.com" target="_blank">www.smilecoms.com</a></font></td>
        </tr>
        <tr>
                <td>
                        <font><img src="http://196.33.227.129/%7Esmlcoms/sigs/pty/images/smile_signature_07_09.jpg" alt="" height="111" width="320"></font></td></tr></tbody></table></td></tr><tr><td style="padding:3.75pt 0cm 3.75pt 0cm" valign="top"><br></td></tr></tbody></table><table style="width:450.0pt" width="600" border="0" cellpadding="0" cellspacing="0"><tbody><tr style="min-height:10.5pt"><td rowspan="3" style="width:173.25pt;padding:0cm 0cm 0cm 0cm;min-height:10.5pt" valign="top" width="231"><br></td><td style="padding:0cm 0cm 0cm 0cm;min-height:10.5pt" valign="top"><br></td></tr><tr style="min-height:42.75pt"><td style="padding:0cm 0cm 0cm 0cm;min-height:42.75pt" valign="top"><br></td></tr></tbody></table><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"></span></div></div></div><div><div class="h5">
<br><div class="gmail_quote">On 12 January 2015 at 16:00, Ovidiu Sas <span dir="ltr"><<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">In addition to the warning, it would be nice to run a script callback via a dedicated route, to let the admin take some decisions in real time.</p>
<p dir="ltr">Regards,<br>
Ovidiu Sas </p><div><div>
<div class="gmail_quote">On Jan 12, 2015 8:16 AM, "Richard Good" <<a href="mailto:richard.good@smilecoms.com" target="_blank">richard.good@smilecoms.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Module: kamailio<br>
Branch: master<br>
Commit: e688d656427dd00d48f1e309c5d8ef991e432b67<br>
URL: <a href="https://github.com/kamailio/kamailio/commit/e688d656427dd00d48f1e309c5d8ef991e432b67" target="_blank">https://github.com/kamailio/kamailio/commit/e688d656427dd00d48f1e309c5d8ef991e432b67</a><br>
<br>
Author: Richard Good <<a href="mailto:richard.good@smilecoms.com" target="_blank">richard.good@smilecoms.com</a>><br>
Committer: Richard Good <<a href="mailto:richard.good@smilecoms.com" target="_blank">richard.good@smilecoms.com</a>><br>
Date: 2015-01-12T15:08:08+02:00<br>
<br>
modules/cdp: new mod param: workerq_length_threshold_percentage<br>
<br>
This is the threshold of the length of the worker queue as a percentage of<br>
the maximum queue size - when exceeded a warning is written to the log<br>
file. Nice to check if worker queue is growing.<br>
<br>
---<br>
<br>
Modified: modules/cdp/doc/cdp_admin.xml<br>
Modified: modules/cdp/mod.c<br>
Modified: modules/cdp/worker.c<br>
<br>
---<br>
<br>
Diff:  <a href="https://github.com/kamailio/kamailio/commit/e688d656427dd00d48f1e309c5d8ef991e432b67.diff" target="_blank">https://github.com/kamailio/kamailio/commit/e688d656427dd00d48f1e309c5d8ef991e432b67.diff</a><br>
Patch: <a href="https://github.com/kamailio/kamailio/commit/e688d656427dd00d48f1e309c5d8ef991e432b67.patch" target="_blank">https://github.com/kamailio/kamailio/commit/e688d656427dd00d48f1e309c5d8ef991e432b67.patch</a><br>
<br>
---<br>
<br>
diff --git a/modules/cdp/doc/cdp_admin.xml b/modules/cdp/doc/cdp_admin.xml<br>
index cdf65d2..234e270 100644<br>
--- a/modules/cdp/doc/cdp_admin.xml<br>
+++ b/modules/cdp/doc/cdp_admin.xml<br>
@@ -126,6 +126,24 @@ modparam("cdp", "latency_threshold", 1000)<br>
 </programlisting><br>
       </example><br>
     </section><br>
+    <section><br>
+      <title>workerq_length_threshold_percentage (int)</title><br>
+<br>
+      <para>The threshold of the length of the worker queue as a percentage of<br>
+         the maximum queue size - when exceeded a warning is written to the log<br>
+         file. 0  means disabled</para><br>
+<br>
+      <para><emphasis> Default value is <quote>0</quote>. </emphasis></para><br>
+<br>
+      <example><br>
+        <title>Set <varname>workerq_length_threshold_percentage</varname> parameter</title><br>
+<br>
+        <programlisting format="linespecific">...<br>
+modparam("cdp", "workerq_length_threshold_percentage", 25)<br>
+...<br>
+       </programlisting><br>
+      </example><br>
+    </section><br>
   </section><br>
<br>
   <section><br>
diff --git a/modules/cdp/mod.c b/modules/cdp/mod.c<br>
index 6857d82..90900d3 100644<br>
--- a/modules/cdp/mod.c<br>
+++ b/modules/cdp/mod.c<br>
@@ -62,6 +62,7 @@ char* config_file="DiameterPeer.xml";         /**< default DiameterPeer configuration f<br>
 unsigned int latency_threshold = 500;                  /**< default threshold for Diameter calls (ms) */<br>
 unsigned int *latency_threshold_p = &latency_threshold;<br>
 unsigned int workerq_latency_threshold = 100;  /**< default threshold for putting a task into worker queue (ms) */<br>
+unsigned int workerq_length_threshold_percentage = 0;  /**< default threshold for worker queue length, percentage of max queue length - by default disabled */<br>
<br>
 extern dp_config *config;                              /**< DiameterPeer configuration structure */<br>
<br>
@@ -165,6 +166,7 @@ static param_export_t cdp_params[] = {<br>
        { "config_file",                                PARAM_STRING,   &config_file},                          /**< configuration filename */<br>
        { "latency_threshold",                  PARAM_INT,              &latency_threshold},            /**<threshold above which we will log*/<br>
        { "workerq_latency_threshold",  PARAM_INT,              &workerq_latency_threshold},/**<time threshold putting job into queue*/<br>
+       { "workerq_length_threshold_percentage",        PARAM_INT,              &workerq_length_threshold_percentage},/**<queue length threshold - percentage of max queue length*/<br>
        { 0, 0, 0 }<br>
 };<br>
<br>
@@ -215,7 +217,7 @@ static int cdp_init( void )<br>
                LM_ERR("failed to register stat\n");<br>
                return -1;<br>
        }<br>
-<br>
+<br>
        if (register_module_stats( <a href="http://exports.name" target="_blank">exports.name</a>, mod_stats)!=0 ) {<br>
                LM_ERR("failed to register core statistics\n");<br>
                return -1;<br>
diff --git a/modules/cdp/worker.c b/modules/cdp/worker.c<br>
index 5ab215c..4a45bc4 100644<br>
--- a/modules/cdp/worker.c<br>
+++ b/modules/cdp/worker.c<br>
@@ -70,6 +70,7 @@ task_queue_t *tasks; /**< queue of tasks */<br>
 cdp_cb_list_t *callbacks; /**< list of callbacks for message processing */<br>
<br>
 extern unsigned int workerq_latency_threshold; /**<max delay for putting task into worker queue */<br>
+extern unsigned int workerq_length_threshold_percentage;       /**< default threshold for worker queue length, percentage of max queue length */<br>
 /**<br>
  * Initializes the worker structures, like the task queue.<br>
  */<br>
@@ -207,6 +208,8 @@ void cb_remove(cdp_cb_t *cb) {<br>
 int put_task(peer *p, AAAMessage *msg) {<br>
<br>
     struct timeval start, stop;<br>
+    int num_tasks, length_percentage;<br>
+<br>
     long elapsed_useconds=0, elapsed_seconds=0, elapsed_millis=0;<br>
     lock_get(tasks->lock);<br>
<br>
@@ -246,6 +249,13 @@ int put_task(peer *p, AAAMessage *msg) {<br>
         LM_WARN("Error releasing tasks->empty semaphore > %s!\n", strerror(errno));<br>
     lock_release(tasks->lock);<br>
<br>
+    if(workerq_length_threshold_percentage > 0) {<br>
+       num_tasks = tasks->end - tasks->start;<br>
+       length_percentage = num_tasks/tasks->max*100;<br>
+       if(length_percentage > workerq_length_threshold_percentage) {<br>
+           LM_WARN("Queue length has exceeded length threshold percentage [%i] and is length [%i]", length_percentage, num_tasks);<br>
+       }<br>
+    }<br>
     //int num_tasks = tasks->end - tasks->start;<br>
     //LM_ERR("Added task to task queue.  Queue length [%i]", num_tasks);<br>
<br>
<br>
<br>
_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br></div></div></div>

<br>
<span><font color="#888888"><pre>This email is subject to the disclaimer of Smile Communications at <a href="http://www.smilecoms.com/home/email-disclaimer/" target="_blank">http://www.smilecoms.com/home/<u></u>email-disclaimer/</a><a href="http://www.smilecoms.com/disclaimer" target="_blank"></a></pre></font></span><br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Carsten Bock<br>CEO (Geschäftsführer)<br><br>ng-voice GmbH<br>Schomburgstr. 80<br>D-22767 Hamburg / Germany<br><br><a href="http://www.ng-voice.com" target="_blank">http://www.ng-voice.com</a><br>mailto:<a href="mailto:carsten@ng-voice.com" target="_blank">carsten@ng-voice.com</a><br><br>Office +49 40 5247593-0<br>Fax +49 40 5247593-99<br><br>Sitz der Gesellschaft: Hamburg<br>Registergericht: Amtsgericht Hamburg, HRB 120189<br>Geschäftsführer: Carsten Bock<br>Ust-ID: DE279344284<br><br>Hier finden Sie unsere handelsrechtlichen Pflichtangaben:<br><a href="http://www.ng-voice.com/imprint/" target="_blank">http://www.ng-voice.com/imprint/</a></div>
</div>