<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Anton,<br>
      <br>
      Try to use dlg_list MI command and see the ongoing calls. It looks
      like some calls, from opensips perspective, do not close - you
      need to run a sip tracing and correlated with the dialogs in
      memory, to learn why some do not close: missing BYE ? malformed
      BYE ? BYE with no did ?<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 14.05.2015 11:12, Anton wrote:<br>
    </div>
    <blockquote cite="mid:555458EE.9070401@ptcomm.ru" type="cite">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      Good time!   <br>
      <br>
      Sometimes, the subscriber receives a "503", "Simultaneous calls
      limit reached".<br>
      I guess it's because of the incorrectness of the dialogue.<br>
      It helps to restart Opensips<br>
      It is necessary to determine the cause of non-completion of
      dialogue.<br>
      I think they need to use for this database, but how to do it?<br>
      And how to identify and remove the cause with the help of the
      database?<br>
      Thanks!<br>
      <br>
      <br>
      part of the CFG below:<br>
      <br>
      #### Dialog Module<br>
      loadmodule "dialog.so"<br>
      modparam("dialog", "db_url",
      "mysql://opensips:opensipsrw@localhost/opensips")<br>
      modparam("dialog", "table_name", "dialog")<br>
      modparam("dialog", "db_mode", 1)<br>
      modparam("dialog", "db_update_period", 60)<br>
      modparam("dialog", "profiles_with_value",
      "gwquota;subscriberquota")<br>
      <br>
      modparam("auth_db", "load_credentials",
      "$avp(subscriber_username)=username")<br>
      <br>
      route[subscriberquota] {<br>
      <br>
          avp_db_query("select quota from subscriber where
      username='$var(subscriber)'","$avp(subscriberquota)");<br>
          if ($avp(subscriberquota) == 0) {<br>
              xlog("Subscriberquota route, NO LIMIT FOR USER
      &lt;$var(subscriber)&gt;");<br>
              return;<br>
          }<br>
          $var(size) = 0;<br>
          get_profile_size("subscriberquota", "$var(subscriber)",
      "$var(size)");<br>
          if( $var(size) &gt;= $avp(subscriberquota) ){<br>
              sl_send_reply("503", "Simultaneous calls limit reached");<br>
              xlog("Subscriberquota route, Limit of $var(size) active
      calls has been reached for subscriber $var(subscriber)");<br>
              exit;<br>
          }<br>
          set_dlg_profile("subscriberquota","$var(subscriber)");<br>
          get_profile_size("subscriberquota", "$var(subscriber)",
      "$var(size)");<br>
          xlog("Subscriberquota route, there are now $var(size) active
      calls for subscriber $var(subscriber)");<br>
          return;<br>
      <br>
      }<br>
      <br>
      route[gwquota] {<br>
      <br>
          #avp_db_query("select quota from quota where
      username='$avp(gw_id)'","$avp(gwquota)");<br>
          if ($avp(gw_attrs) == 0) {<br>
              xlog("GWquota route, NO LIMIT FOR GW $avp(gw_id)");<br>
              return;<br>
          }<br>
          $avp(gwquota) = $avp(gw_attrs);<br>
          $var(size) = 0;<br>
          get_profile_size("gwquota", "$avp(gw_id)", "$var(size)");<br>
          if( $var(size) &gt;= $avp(gwquota) ){<br>
              sl_send_reply("503", "Simultaneous calls limit reached");<br>
              xlog("GWquota route, Limit of $var(size) active calls has
      been reached for GW $avp(gw_id)");<br>
              exit;<br>
          }<br>
          set_dlg_profile("gwquota","$avp(gw_id)");<br>
          get_profile_size("gwquota", "$avp(gw_id)", "$var(size)");<br>
          xlog("GWquota route, there are now $var(size) active calls for
      GW $avp(gw_id)");<br>
          return;<br>
      <br>
      }<br>
      <br>
      <div>route[dialog] {</div>
      <div><br>
      </div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>if

        (has_totag()) {</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        sequential requests within a dialog should</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        take the path determined by record-routing</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>if

        (loose_route()) {</div>
      <div><br>
      </div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>if

        (method=="BYE" || method=="CANCEL") {</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>setflag(ACC_DO);

        # do accounting ...</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>setflag(ACC_FAILED);

        # ... even if the transaction fails</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}
        else if (is_method("INVITE")) {</div>
      <div>                # even if in most of the cases is useless, do
        RR for</div>
      <div>                # re-INVITEs alos, as some buggy clients do
        change route set</div>
      <div>                # during the dialog.</div>
      <div>                record_route();</div>
      <div>            }</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        route it out to whatever destination was set by loose_route()</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        in $du (destination URI).</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>route(relay);</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}
        else {</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>if

        ( is_method("ACK") ) {</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>if

        ( t_check_trans() ) {</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>t_relay();</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>exit;</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}
        else {</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        ACK without matching transaction -&gt;</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        ignore and discard</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>exit;</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>sl_send_reply("404","Not

        here");</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>exit;</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
      <div><br>
      </div>
      <div>}</div>
      <div><br>
      </div>
      <div>route[invite] {</div>
      <div><br>
      </div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>#
        account only INVITEs</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>if

        (is_method("INVITE")) {</div>
      <div>        create_dialog("B");</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>xlog("L_INFO",

        "New invite recived\n");</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>perl_exec("test");</div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>xlog("L_INFO",

        "Execution perl function result is $retcode\n");</div>
      <div>        if (is_from_gw("0","i","$avp(gw_attrs)")) {</div>
      <div>            route(gwquota);</div>
      <div>            route(terminate);</div>
      <div>        } else {</div>
      <div>            route(auth);</div>
      <div>            $DLG_timeout=60;</div>
      <div>            $var(subscriber) = $avp(subscriber_username);</div>
      <div>            route(subscriberquota);</div>
      <div>            route(originate);</div>
      <div>        }</div>
      <div><br>
      </div>
      <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
      <div><br>
      </div>
      <div>}</div>
      <br>
      <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>