<div dir="ltr">Thanks for the input Bogdan.<div><br></div><div>We found that the problem was due to some calls failing to get the response.</div><div><br></div><div>Since we had the dialog timeout of 6 hours, which was not in sync with application logic, we were sending more calls than available destinations.</div><div><br></div><div>We have updated the dialog timeout in par with the application and this should resolve the issue for us.</div><div><br></div><div>Regards,</div><div>Chandan</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 17, 2016 at 3:15 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Chandan,<br>
      <br>
      Could you check what is the status of the calls (see the &quot;State&quot;
      field) ? I guess the call are listed in state 5 (terminated) - and
      this is the reason why you do not see them as counted by LB.<br>
      <br>
      Regards,<br>
    </tt>
    <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre><div><div class="h5">
    <div>On 16.08.2016 12:47, Chandan PR wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Hi Guys,
        <div><br>
        </div>
        <div>Opendsips Version : 1.9.x</div>
        <div><br>
        </div>
        <div>We have configured the load balancer with 8 ports.</div>
        <div><br>
        </div>
        <div>When the calls are ongoing, the lb_list shows the load
          balancer is running full.</div>
        <div><br>
        </div>
        <div>
          <div>root@Dev-Chandan-Opensips-LB:/<wbr>usr/local/opensips/sbin#
            ./opensipsctl fifo lb_list</div>
          <div>Destination:: sip:<a href="http://192.168.248.62:5060" target="_blank">192.168.248.62:5060</a>
            id=152 group=1 enabled=yes auto-re=on</div>
          <div><span style="white-space:pre-wrap">        </span>Resource::
            channel max=4 load=4</div>
          <div>Destination:: sip:<a href="http://192.168.248.64:5060" target="_blank">192.168.248.64:5060</a>
            id=153 group=1 enabled=yes auto-re=on</div>
          <div><span style="white-space:pre-wrap">        </span>Resource::
            channel max=4 load=4</div>
          <div><br>
          </div>
          <div>When I check the dialog_list, I see some older dialogs
            which are yet to be cleared.</div>
          <div><br>
          </div>
          <div>root@Dev-Chandan-Opensips-LB:/<wbr>usr/local/opensips/sbin#
            ./opensipsctl fifo dlg_list | grep &quot;callid&quot;</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610041471339775929_<wbr>ZTLT_931</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610151471339775929_<wbr>ZTLT_937</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610221471339775929_<wbr>ZTLT_942</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610081471339775929_<wbr>ZTLT_933</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610181471339775929_<wbr>ZTLT_939</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610191471339775929_<wbr>ZTLT_940</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610131471339775929_<wbr>ZTLT_936</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610031471339775929_<wbr>ZTLT_930</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610061471339775929_<wbr>ZTLT_932</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610161471339775929_<wbr>ZTLT_938</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610271471339775929_<wbr>ZTLT_945</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610371471339775929_<wbr>ZTLT_951</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610101471339775929_<wbr>ZTLT_934</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610311471339775929_<wbr>ZTLT_947</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610211471339775929_<wbr>ZTLT_941</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610241471339775929_<wbr>ZTLT_943</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610341471339775929_<wbr>ZTLT_949</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610011471339775929_<wbr>ZTLT_929</div>
          <div><span style="white-space:pre-wrap">        </span>callid::
            14713396610111471339775929_<wbr>ZTLT_935</div>
          <div>root@Dev-Chandan-Opensips-LB:/<wbr>usr/local/opensips/sbin#
            ./opensipsctl fifo dlg_list | grep &quot;callid&quot; | wc -l</div>
          <div>13</div>
          <div>root@Dev-Chandan-Opensips-LB:/<wbr>usr/local/opensips/sbin# </div>
        </div>
        <div><br>
        </div>
        <div><b>Even when the lb_list shows the load as 0, I see some
            dialogs present and getting cleared after around 10-12
            seconds.</b></div>
        <div><br>
        </div>
        <div>What would be the impact of this delay in clearing the
          dialogs? Can this lead to lot many calls rejected with
          &quot;Destination Full&quot; (We are experiencing this issue in our
          production, where a huge number of calls rejected)?</div>
        <div><br>
        </div>
        <div>Is there any way to reduce this delay or clear the dialogs
          immediately?</div>
        <div><br>
        </div>
        <div><b><u>Dialog Module Settings:</u></b></div>
        <div>
          <div>#### DIALOG module</div>
          <div>loadmodule &quot;dialog.so&quot;</div>
          <div>modparam(&quot;dialog&quot;, &quot;dlg_match_mode&quot;, 1)</div>
          <div>modparam(&quot;dialog&quot;, &quot;default_timeout&quot;, 21600)  #
            6 hours timeout</div>
          <div>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 2)</div>
          <div>modparam(&quot;dialog&quot;, &quot;db_url&quot;,</div>
          <div><span style="white-space:pre-wrap">        </span>&quot;mysql://opensips:opensipsrw@<wbr>localhost/opensips&quot;)
            #</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><b><u>Load Balancer Script:</u></b></div>
        <div>
          <div>#</div>
          <div># $Id: opensips_loadbalancer.m4 9723 2013-02-01 15:10:50Z
            bogdan_iancu $</div>
          <div>#</div>
          <div># OpenSIPS loadbalancer script</div>
          <div>#     by OpenSIPS Solutions &lt;<a href="mailto:team@opensips-solutions.com" target="_blank">team@opensips-solutions.com</a>&gt;</div>
          <div>#</div>
          <div># This script was generated via &quot;make menuconfig&quot;, from</div>
          <div>#   the &quot;Load Balancer&quot; scenario.</div>
          <div># You can enable / disable more features /
            functionalities by</div>
          <div>#   re-generating the scenario with different options.</div>
          <div>#</div>
          <div># Please refer to the Core CookBook at:</div>
          <div>#      <a href="http://www.opensips.org/Resources/DocsCookbooks" target="_blank">http://www.opensips.org/<wbr>Resources/DocsCookbooks</a></div>
          <div># for a explanation of possible statements, functions and
            parameters.</div>
          <div>#</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>####### Global Parameters #########</div>
          <div><br>
          </div>
          <div>debug=3</div>
          <div>log_stderror=no</div>
          <div>log_facility=LOG_LOCAL1</div>
          <div><br>
          </div>
          <div>fork=yes</div>
          <div>children=4</div>
          <div><br>
          </div>
          <div>/* uncomment the following lines to enable debugging */</div>
          <div>#debug=6</div>
          <div>#fork=no</div>
          <div>#log_stderror=yes</div>
          <div><br>
          </div>
          <div>/* uncomment the next line to enable the auto temporary
            blacklisting of </div>
          <div>   not available destinations (default disabled) */</div>
          <div>#disable_dns_blacklist=no</div>
          <div><br>
          </div>
          <div>/* uncomment the next line to enable IPv6 lookup after
            IPv4 dns </div>
          <div>   lookup failures (default disabled) */</div>
          <div>#dns_try_ipv6=yes</div>
          <div><br>
          </div>
          <div>/* comment the next line to enable the auto discovery of
            local aliases</div>
          <div>   based on revers DNS on IPs */</div>
          <div>auto_aliases=no</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>listen=udp:<a href="http://192.168.248.111:5060" target="_blank">192.168.248.111:<wbr>5060</a>
              # CUSTOMIZE ME</div>
          <div><br>
          </div>
          <div>disable_tcp=no</div>
          <div>listen=tcp:<a href="http://192.168.248.111:5060" target="_blank">192.168.248.111:<wbr>5060</a>
              # CUSTOMIZE ME </div>
          <div><br>
          </div>
          <div>disable_tls=yes</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>####### Modules Section ########</div>
          <div><br>
          </div>
          <div>#set module path</div>
          <div>mpath=&quot;/usr/local/opensips/<wbr>lib64/opensips/modules/&quot;</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#### SIGNALING module</div>
          <div>loadmodule &quot;signaling.so&quot;</div>
          <div><br>
          </div>
          <div>#### StateLess module</div>
          <div>loadmodule &quot;sl.so&quot;</div>
          <div><br>
          </div>
          <div>#### Transaction Module</div>
          <div>loadmodule &quot;tm.so&quot;</div>
          <div>modparam(&quot;tm&quot;, &quot;fr_timer&quot;, 30)</div>
          <div>modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 120)</div>
          <div>modparam(&quot;tm&quot;, &quot;restart_fr_on_each_reply&quot;, 0)</div>
          <div>modparam(&quot;tm&quot;, &quot;onreply_avp_mode&quot;, 1)</div>
          <div><br>
          </div>
          <div>#### Record Route Module</div>
          <div>loadmodule &quot;rr.so&quot;</div>
          <div>/* do not append from tag to the RR (no need for this
            script) */</div>
          <div>modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)</div>
          <div><br>
          </div>
          <div>#### MAX ForWarD module</div>
          <div>loadmodule &quot;maxfwd.so&quot;</div>
          <div><br>
          </div>
          <div>#### SIP MSG OPerationS module</div>
          <div>loadmodule &quot;sipmsgops.so&quot;</div>
          <div><br>
          </div>
          <div>#### FIFO Management Interface</div>
          <div>loadmodule &quot;mi_fifo.so&quot;</div>
          <div>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)</div>
          <div>modparam(&quot;mi_fifo&quot;, &quot;fifo_mode&quot;, 0666)</div>
          <div><br>
          </div>
          <div>#### URI module</div>
          <div>loadmodule &quot;uri.so&quot;</div>
          <div>modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)</div>
          <div><br>
          </div>
          <div>#### MYSQL module</div>
          <div>loadmodule &quot;db_mysql.so&quot;</div>
          <div><br>
          </div>
          <div>#### AVPOPS module</div>
          <div>loadmodule &quot;avpops.so&quot;</div>
          <div><br>
          </div>
          <div>#### ACCounting module</div>
          <div>loadmodule &quot;acc.so&quot;</div>
          <div>/* what special events should be accounted ? */</div>
          <div>modparam(&quot;acc&quot;, &quot;early_media&quot;, 0)</div>
          <div>modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 0)</div>
          <div>/* by default we do not adjust the direct of the
            sequential requests.</div>
          <div>   if you enable this parameter, be sure the enable
            &quot;append_fromtag&quot;</div>
          <div>   in &quot;rr&quot; module */</div>
          <div>modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)</div>
          <div>modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, &quot;ACC_FAILED&quot;)</div>
          <div>/* account triggers (flags) */</div>
          <div>modparam(&quot;acc&quot;, &quot;log_flag&quot;, &quot;ACC_DO&quot;)</div>
          <div>modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, &quot;ACC_MISSED&quot;)</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#### DIALOG module</div>
          <div>loadmodule &quot;dialog.so&quot;</div>
          <div>modparam(&quot;dialog&quot;, &quot;dlg_match_mode&quot;, 1)</div>
          <div>modparam(&quot;dialog&quot;, &quot;default_timeout&quot;, 21600)  # 6 hours
            timeout</div>
          <div>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 2)</div>
          <div>modparam(&quot;dialog&quot;, &quot;db_url&quot;,</div>
          <div><span style="white-space:pre-wrap">        </span>&quot;mysql://opensips:opensipsrw@<wbr>localhost/opensips&quot;)
            # CUSTOMIZE ME</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#### LOAD BALANCER module</div>
          <div>loadmodule &quot;load_balancer.so&quot;</div>
          <div>modparam(&quot;load_balancer&quot;, &quot;db_url&quot;,</div>
          <div><span style="white-space:pre-wrap">        </span>&quot;mysql://opensips:opensipsrw@<wbr>localhost/opensips&quot;)
            # CUSTOMIZE ME</div>
          <div>modparam(&quot;load_balancer&quot;, &quot;probing_method&quot;, &quot;OPTIONS&quot;)</div>
          <div><br>
          </div>
          <div>modparam(&quot;load_balancer&quot;, &quot;probing_interval&quot;, 15)</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>####### Routing Logic ########</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># main request routing logic</div>
          <div>route{</div>
          <div><span style="white-space:pre-wrap">        </span>if
            (!mf_process_maxfwd_header(&quot;3&quot;<wbr>)) {</div>
          <div><span style="white-space:pre-wrap">                </span>send_reply(&quot;483&quot;,&quot;looping&quot;);</div>
          <div><span style="white-space:pre-wrap">                </span>exit;</div>
          <div><span style="white-space:pre-wrap">        </span>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><span style="white-space:pre-wrap">        </span>if (
            has_totag() ) {</div>
          <div><span style="white-space:pre-wrap">                </span>#
            sequential request -&gt; obey Route indication</div>
          <div><span style="white-space:pre-wrap">                </span>xlog(&quot;Loose
            Route for $avp(iurl) over $avp(dest) $avp(calltype) \n&quot;);</div>
          <div><span style="white-space:pre-wrap">                </span>loose_route();</div>
          <div>                t_relay();</div>
          <div>                exit;</div>
          <div>        }</div>
          <div><br>
          </div>
          <div>        # handle cancel and re-transmissions</div>
          <div><span style="white-space:pre-wrap">        </span>if (
            is_method(&quot;CANCEL&quot;) ) {</div>
          <div><span style="white-space:pre-wrap">                </span>if (
            t_check_trans() )</div>
          <div><span style="white-space:pre-wrap">                        </span>t_relay();</div>
          <div><span style="white-space:pre-wrap">                </span>exit;</div>
          <div><span style="white-space:pre-wrap">        </span>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>        # from now on we have only the initial requests</div>
          <div>        if (!is_method(&quot;INVITE&quot;)) {</div>
          <div>                send_reply(&quot;405&quot;,&quot;Method Not Allowed&quot;);</div>
          <div>                exit;</div>
          <div>        }</div>
          <div><br>
          </div>
          <div>        # initial request</div>
          <div><span style="white-space:pre-wrap">        </span>record_route();</div>
          <div><span style="white-space:pre-wrap">        </span>$avp(iurl)
            = $(hdr(P-Nuance-Initial-URL));</div>
          <div><span style="white-space:pre-wrap">        </span>$avp(calltype)
            = $(hdr(P-Nuance-Call-Type));</div>
          <div>        xlog(&quot;Sending call $fu $avp(iurl) $avp(calltype)
            \n&quot;);<span style="white-space:pre-wrap">        </span></div>
          <div><span style="white-space:pre-wrap">        </span>xlog(&quot;Current
            Dialogs count $DLG_count \n&quot;);</div>
          <div><span style="white-space:pre-wrap">        </span># LB
            function returns negative if no suitable destination (for
            requested resources) is found,</div>
          <div>        # or if all destinations are full</div>
          <div>        if ( !load_balance(&quot;1&quot;,&quot;channel&quot;) ) {</div>
          <div><span style="white-space:pre-wrap">        </span>    
            xlog(&quot;All Destinations are full. Sending 500! $fu
            $(hdr(P-Nuance-Initial-URL)) CURRENT DIALOGS $DLG_count
            \n&quot;);</div>
          <div>             send_reply(&quot;500&quot;,&quot;Service full&quot;);</div>
          <div>             exit;</div>
          <div>        }</div>
          <div><span style="white-space:pre-wrap">        </span>$avp(dest)
            = $du;</div>
          <div><span style="white-space:pre-wrap">        </span>xlog(&quot;Call
            sent over $avp(dest) $fu $(hdr(P-Nuance-Initial-URL))\<wbr>n&quot;);</div>
          <div><span style="white-space:pre-wrap">        </span>t_on_reply(&quot;test&quot;);</div>
          <div>        # arm a failure route for be able to catch a
            failure event and to do </div>
          <div>        # failover to the next available destination</div>
          <div>        t_on_failure(&quot;LB_failed&quot;);</div>
          <div><br>
          </div>
          <div>        # send it out</div>
          <div><span style="white-space:pre-wrap">        </span>if
            (!t_relay()) {</div>
          <div><span style="white-space:pre-wrap">                </span>sl_reply_error();</div>
          <div><span style="white-space:pre-wrap">        </span>}</div>
          <div><br>
          </div>
          <div>}</div>
          <div><br>
          </div>
          <div>#onreply_route {</div>
          <div>#<span style="white-space:pre-wrap">        </span>xlog(&quot;OpenSIPS
            received a reply $avp(iurl) rs= $rs | fu= $fu | si= $si |
            Ri= $Ri ===&quot;);</div>
          <div>#}</div>
          <div><br>
          </div>
          <div>onreply_route[test] {</div>
          <div><span style="white-space:pre-wrap">        </span>xlog(&quot;Reply
            $rs received from $si for the call $avp(iurl)&quot;);</div>
          <div>}</div>
          <div><br>
          </div>
          <div>failure_route[LB_failed]</div>
          <div>{</div>
          <div>        # skip if call was canceled </div>
          <div><span style="white-space:pre-wrap">        </span>if
            (t_was_cancelled()) {</div>
          <div><span style="white-space:pre-wrap">                </span>exit;</div>
          <div><span style="white-space:pre-wrap">        </span>}</div>
          <div><span style="white-space:pre-wrap">        </span>xlog(&quot;Call
            $avp(iurl) sent over $avp(dest) failed with code
            $T_reply_code\n&quot;);</div>
          <div>        </div>
          <div><span style="white-space:pre-wrap">        </span># Checking
            only for Destination Failure</div>
          <div><span style="white-space:pre-wrap">        </span># If the
            destination is failed, disable it and reroute the call</div>
          <div>        #if ( t_check_status(&quot;[56][0-9][0-9]<wbr>&quot;)) {</div>
          <div>        if ( t_check_status(&quot;503&quot;)) {</div>
          <div><span style="white-space:pre-wrap">        </span>        #
            this is a case for failover</div>
          <div>                xlog(&quot;Marking $avp(dest) disabled as it
            failed for call $avp(iurl) with code $T_reply_code\n&quot;);</div>
          <div>                #xlog(&quot;call $avp(iurl) failed with code
            $T_reply_code from $avp(dest)\n&quot;);</div>
          <div><span style="white-space:pre-wrap">                </span># mark
            failed destination as disabled </div>
          <div>                lb_disable();</div>
          <div>                # try to re-route to next available
            destination</div>
          <div>                #if ( !load_balance(&quot;1&quot;,&quot;channel&quot;) ) {</div>
          <div><span style="white-space:pre-wrap">                </span>#    
             xlog(&quot;RETRY FAILED SENDING 500&quot;);<span style="white-space:pre-wrap">        </span></div>
          <div>                #      send_reply(&quot;500&quot;,&quot;Service Full&quot;);</div>
          <div>                #      exit;</div>
          <div>                #}</div>
          <div>                #xlog(&quot;REPORT: re-routing call to $du
            \n&quot;);</div>
          <div>                #t_relay();</div>
          <div>        }</div>
          <div><span style="white-space:pre-wrap">        </span>send_reply(&quot;$T_reply_code&quot;,&quot;<wbr>Call
            Failed&quot;);</div>
          <div>}</div>
          <div><br>
          </div>
        </div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Chandan</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>______________________________<wbr>_________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div></div></div>