<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Chandan,<br>
      <br>
      Could you check what is the status of the calls (see the "State"
      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 class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 16.08.2016 12:47, Chandan PR wrote:<br>
    </div>
    <blockquote
cite="mid:CADh=Fyicu3n2wPYGsNYNAEC=na2VWqFqNjmdsCcXEP=k3AxL1w@mail.gmail.com"
      type="cite">
      <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:/usr/local/opensips/sbin#
            ./opensipsctl fifo lb_list</div>
          <div>Destination:: sip:<a moz-do-not-send="true"
              href="http://192.168.248.62:5060">192.168.248.62:5060</a>
            id=152 group=1 enabled=yes auto-re=on</div>
          <div><span class="" style="white-space:pre">        </span>Resource::
            channel max=4 load=4</div>
          <div>Destination:: sip:<a moz-do-not-send="true"
              href="http://192.168.248.64:5060">192.168.248.64:5060</a>
            id=153 group=1 enabled=yes auto-re=on</div>
          <div><span class="" style="white-space:pre">        </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:/usr/local/opensips/sbin#
            ./opensipsctl fifo dlg_list | grep "callid"</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610041471339775929_ZTLT_931</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610151471339775929_ZTLT_937</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610221471339775929_ZTLT_942</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610081471339775929_ZTLT_933</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610181471339775929_ZTLT_939</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610191471339775929_ZTLT_940</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610131471339775929_ZTLT_936</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610031471339775929_ZTLT_930</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610061471339775929_ZTLT_932</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610161471339775929_ZTLT_938</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610271471339775929_ZTLT_945</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610371471339775929_ZTLT_951</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610101471339775929_ZTLT_934</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610311471339775929_ZTLT_947</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610211471339775929_ZTLT_941</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610241471339775929_ZTLT_943</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610341471339775929_ZTLT_949</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610011471339775929_ZTLT_929</div>
          <div><span class="" style="white-space:pre">        </span>callid::
            14713396610111471339775929_ZTLT_935</div>
          <div>root@Dev-Chandan-Opensips-LB:/usr/local/opensips/sbin#
            ./opensipsctl fifo dlg_list | grep "callid" | wc -l</div>
          <div>13</div>
          <div>root@Dev-Chandan-Opensips-LB:/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
          "Destination Full" (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 style="">#### DIALOG module</div>
          <div style="">loadmodule "dialog.so"</div>
          <div style="">modparam("dialog", "dlg_match_mode", 1)</div>
          <div style="">modparam("dialog", "default_timeout", 21600)  #
            6 hours timeout</div>
          <div style="">modparam("dialog", "db_mode", 2)</div>
          <div style="">modparam("dialog", "db_url",</div>
          <div style=""><span class="" style="white-space:pre">        </span>"mysql://opensips:opensipsrw@localhost/opensips")
            #</div>
        </div>
        <div style=""><br>
        </div>
        <div style=""><br>
        </div>
        <div style=""><b><u>Load Balancer Script:</u></b></div>
        <div style="">
          <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 moz-do-not-send="true"
              href="mailto:team@opensips-solutions.com">team@opensips-solutions.com</a>&gt;</div>
          <div>#</div>
          <div># This script was generated via "make menuconfig", from</div>
          <div>#   the "Load Balancer" 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 moz-do-not-send="true"
              href="http://www.opensips.org/Resources/DocsCookbooks">http://www.opensips.org/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 moz-do-not-send="true"
              href="http://192.168.248.111:5060">192.168.248.111:5060</a>
              # CUSTOMIZE ME</div>
          <div><br>
          </div>
          <div>disable_tcp=no</div>
          <div>listen=tcp:<a moz-do-not-send="true"
              href="http://192.168.248.111:5060">192.168.248.111: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="/usr/local/opensips/lib64/opensips/modules/"</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#### SIGNALING module</div>
          <div>loadmodule "signaling.so"</div>
          <div><br>
          </div>
          <div>#### StateLess module</div>
          <div>loadmodule "sl.so"</div>
          <div><br>
          </div>
          <div>#### Transaction Module</div>
          <div>loadmodule "tm.so"</div>
          <div>modparam("tm", "fr_timer", 30)</div>
          <div>modparam("tm", "fr_inv_timer", 120)</div>
          <div>modparam("tm", "restart_fr_on_each_reply", 0)</div>
          <div>modparam("tm", "onreply_avp_mode", 1)</div>
          <div><br>
          </div>
          <div>#### Record Route Module</div>
          <div>loadmodule "rr.so"</div>
          <div>/* do not append from tag to the RR (no need for this
            script) */</div>
          <div>modparam("rr", "append_fromtag", 0)</div>
          <div><br>
          </div>
          <div>#### MAX ForWarD module</div>
          <div>loadmodule "maxfwd.so"</div>
          <div><br>
          </div>
          <div>#### SIP MSG OPerationS module</div>
          <div>loadmodule "sipmsgops.so"</div>
          <div><br>
          </div>
          <div>#### FIFO Management Interface</div>
          <div>loadmodule "mi_fifo.so"</div>
          <div>modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")</div>
          <div>modparam("mi_fifo", "fifo_mode", 0666)</div>
          <div><br>
          </div>
          <div>#### URI module</div>
          <div>loadmodule "uri.so"</div>
          <div>modparam("uri", "use_uri_table", 0)</div>
          <div><br>
          </div>
          <div>#### MYSQL module</div>
          <div>loadmodule "db_mysql.so"</div>
          <div><br>
          </div>
          <div>#### AVPOPS module</div>
          <div>loadmodule "avpops.so"</div>
          <div><br>
          </div>
          <div>#### ACCounting module</div>
          <div>loadmodule "acc.so"</div>
          <div>/* what special events should be accounted ? */</div>
          <div>modparam("acc", "early_media", 0)</div>
          <div>modparam("acc", "report_cancels", 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
            "append_fromtag"</div>
          <div>   in "rr" module */</div>
          <div>modparam("acc", "detect_direction", 0)</div>
          <div>modparam("acc", "failed_transaction_flag", "ACC_FAILED")</div>
          <div>/* account triggers (flags) */</div>
          <div>modparam("acc", "log_flag", "ACC_DO")</div>
          <div>modparam("acc", "log_missed_flag", "ACC_MISSED")</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#### DIALOG module</div>
          <div>loadmodule "dialog.so"</div>
          <div>modparam("dialog", "dlg_match_mode", 1)</div>
          <div>modparam("dialog", "default_timeout", 21600)  # 6 hours
            timeout</div>
          <div>modparam("dialog", "db_mode", 2)</div>
          <div>modparam("dialog", "db_url",</div>
          <div><span class="" style="white-space:pre">        </span>"mysql://opensips:opensipsrw@localhost/opensips")
            # CUSTOMIZE ME</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#### LOAD BALANCER module</div>
          <div>loadmodule "load_balancer.so"</div>
          <div>modparam("load_balancer", "db_url",</div>
          <div><span class="" style="white-space:pre">        </span>"mysql://opensips:opensipsrw@localhost/opensips")
            # CUSTOMIZE ME</div>
          <div>modparam("load_balancer", "probing_method", "OPTIONS")</div>
          <div><br>
          </div>
          <div>modparam("load_balancer", "probing_interval", 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 class="" style="white-space:pre">        </span>if
            (!mf_process_maxfwd_header("3")) {</div>
          <div><span class="" style="white-space:pre">                </span>send_reply("483","looping");</div>
          <div><span class="" style="white-space:pre">                </span>exit;</div>
          <div><span class="" style="white-space:pre">        </span>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><span class="" style="white-space:pre">        </span>if (
            has_totag() ) {</div>
          <div><span class="" style="white-space:pre">                </span>#
            sequential request -&gt; obey Route indication</div>
          <div><span class="" style="white-space:pre">                </span>xlog("Loose
            Route for $avp(iurl) over $avp(dest) $avp(calltype) \n");</div>
          <div><span class="" style="white-space:pre">                </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 class="" style="white-space:pre">        </span>if (
            is_method("CANCEL") ) {</div>
          <div><span class="" style="white-space:pre">                </span>if (
            t_check_trans() )</div>
          <div><span class="" style="white-space:pre">                        </span>t_relay();</div>
          <div><span class="" style="white-space:pre">                </span>exit;</div>
          <div><span class="" style="white-space:pre">        </span>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>        # from now on we have only the initial requests</div>
          <div>        if (!is_method("INVITE")) {</div>
          <div>                send_reply("405","Method Not Allowed");</div>
          <div>                exit;</div>
          <div>        }</div>
          <div><br>
          </div>
          <div>        # initial request</div>
          <div><span class="" style="white-space:pre">        </span>record_route();</div>
          <div><span class="" style="white-space:pre">        </span>$avp(iurl)
            = $(hdr(P-Nuance-Initial-URL));</div>
          <div><span class="" style="white-space:pre">        </span>$avp(calltype)
            = $(hdr(P-Nuance-Call-Type));</div>
          <div>        xlog("Sending call $fu $avp(iurl) $avp(calltype)
            \n");<span class="" style="white-space:pre">        </span></div>
          <div><span class="" style="white-space:pre">        </span>xlog("Current
            Dialogs count $DLG_count \n");</div>
          <div><span class="" style="white-space:pre">        </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("1","channel") ) {</div>
          <div><span class="" style="white-space:pre">        </span>    
            xlog("All Destinations are full. Sending 500! $fu
            $(hdr(P-Nuance-Initial-URL)) CURRENT DIALOGS $DLG_count
            \n");</div>
          <div>             send_reply("500","Service full");</div>
          <div>             exit;</div>
          <div>        }</div>
          <div><span class="" style="white-space:pre">        </span>$avp(dest)
            = $du;</div>
          <div><span class="" style="white-space:pre">        </span>xlog("Call
            sent over $avp(dest) $fu $(hdr(P-Nuance-Initial-URL))\n");</div>
          <div><span class="" style="white-space:pre">        </span>t_on_reply("test");</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("LB_failed");</div>
          <div><br>
          </div>
          <div>        # send it out</div>
          <div><span class="" style="white-space:pre">        </span>if
            (!t_relay()) {</div>
          <div><span class="" style="white-space:pre">                </span>sl_reply_error();</div>
          <div><span class="" style="white-space:pre">        </span>}</div>
          <div><br>
          </div>
          <div>}</div>
          <div><br>
          </div>
          <div>#onreply_route {</div>
          <div>#<span class="" style="white-space:pre">        </span>xlog("OpenSIPS
            received a reply $avp(iurl) rs= $rs | fu= $fu | si= $si |
            Ri= $Ri ===");</div>
          <div>#}</div>
          <div><br>
          </div>
          <div>onreply_route[test] {</div>
          <div><span class="" style="white-space:pre">        </span>xlog("Reply
            $rs received from $si for the call $avp(iurl)");</div>
          <div>}</div>
          <div><br>
          </div>
          <div>failure_route[LB_failed]</div>
          <div>{</div>
          <div>        # skip if call was canceled </div>
          <div><span class="" style="white-space:pre">        </span>if
            (t_was_cancelled()) {</div>
          <div><span class="" style="white-space:pre">                </span>exit;</div>
          <div><span class="" style="white-space:pre">        </span>}</div>
          <div><span class="" style="white-space:pre">        </span>xlog("Call
            $avp(iurl) sent over $avp(dest) failed with code
            $T_reply_code\n");</div>
          <div>        </div>
          <div><span class="" style="white-space:pre">        </span># Checking
            only for Destination Failure</div>
          <div><span class="" style="white-space:pre">        </span># If the
            destination is failed, disable it and reroute the call</div>
          <div>        #if ( t_check_status("[56][0-9][0-9]")) {</div>
          <div>        if ( t_check_status("503")) {</div>
          <div><span class="" style="white-space:pre">        </span>        #
            this is a case for failover</div>
          <div>                xlog("Marking $avp(dest) disabled as it
            failed for call $avp(iurl) with code $T_reply_code\n");</div>
          <div>                #xlog("call $avp(iurl) failed with code
            $T_reply_code from $avp(dest)\n");</div>
          <div><span class="" style="white-space:pre">                </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("1","channel") ) {</div>
          <div><span class="" style="white-space:pre">                </span>#    
             xlog("RETRY FAILED SENDING 500");<span class="" style="white-space:pre">        </span></div>
          <div>                #      send_reply("500","Service Full");</div>
          <div>                #      exit;</div>
          <div>                #}</div>
          <div>                #xlog("REPORT: re-routing call to $du
            \n");</div>
          <div>                #t_relay();</div>
          <div>        }</div>
          <div><span class="" style="white-space:pre">        </span>send_reply("$T_reply_code","Call
            Failed");</div>
          <div>}</div>
          <div><br>
          </div>
        </div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Chandan</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>