<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <span id="result_box" class="short_text" lang="en"><span class="hps">Good
        time! Sorry</span> <span class="hps">- can</span> <span
        class="hps">not</span> <span class="hps">in this topic</span><span>,
        but it can</span> <span class="hps">help</span><span>?</span></span><br>
    <br>
    Sometimes, the subscriber receives a "503", "Simultaneous calls
    limit reached".<br>
    I guess it's because of the incorrectness of the dialog.<br>
    It helps to restart Opensips...<br>
    It is necessary to determine the cause of non-completion of dialog.<br>
    I think they need to use for this DB, but how to do it?<br>
    And how to identify and remove the cause with the help of the
    database?<br>
    P<span id="result_box" class="short_text" lang="en"><span
        class="hps">please, help</span></span>. 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><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
    <div>}</div>
    <br>
    <br>
    <div class="moz-cite-prefix">26.12.2014 12:06, John Nash пишет:<br>
    </div>
    <blockquote
cite="mid:CAA4rGPzpP+Vv=68kJxQyB-osCeidyObO0pur+QLTs87qr-nkRg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>Hello Bogdan,<br>
                  <br>
                  Probably I did not explain well. I am using OpenSIPS
                  (1.12.0dev-notls (x86_64/linux))<br>
                  <br>
                </div>
                When dialog is created I see the MI command output as
                ...<br>
                 opensipsctl fifo dlg_list_ctx<br>
                dialog::  <b>hash=3028:502141575</b><br>
                        state:: 4<br>
                        user_flags:: 0<br>
                        timestart:: 1419578844<br>
                        datestart:: 2014-12-26 07:27:24<br>
                        timeout:: 1419582444<br>
                        dateout:: 2014-12-26 08:27:24<br>
                        callid:: a8d3a13820394340b2c6b54867126726<br>
              </div>
              ---------------- and so on
              -------------------------------------------------<br>
              <br>
            </div>
            But in database values are like ..<br>
          </div>
          <b>dlg_id (This column is big int) = 13005663113863</b><br>
        </div>
        call_id = a8d3a13820394340b2c6b54867126726<br>
        <div>
          <div><br>
          </div>
          <div>Even all dialog update queries (when i see debug=4) I can
            see dialog is updated using the key dlg_id = 13005663113863
            (Big int value) ...I think it is very very good to use a big
            int value for unique dialog ID as DB updates will be much
            faster. But I am unable to find some way to access this
            dlg_id = 13005663113863 in script (I basically want to
            update dialogs with some custom values).<br>
            <br>
          </div>
          <div>Am i using the correct code? May be I am using some
            "under construction" works?<br>
            <br>
          </div>
          <div>John<br>
          </div>
          <div><br>
            <br>
            <div><br>
              <div>
                <div><br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Dec 26, 2014 at 1:45 PM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
              moz-do-not-send="true" 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>
              <div>It is the same value, but in var is kept ad string
                representation.</div>
              <div><br>
              </div>
              <div>Regards,</div>
              <div>Bogdan</div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>
                <div style="font-size:9px;color:#575757">Sent from
                  Samsung Mobile</div>
              </div>
              <div>
                <div class="h5"><br>
                  <br>
                  -------- Original message --------<br>
                  From: John Nash <br>
                  Date:26/12/2014 09:59 (GMT+02:00) <br>
                  To: Bogdan-Andrei Iancu <br>
                  Cc: OpenSIPS users mailling list <br>
                  Subject: Re: [OpenSIPS-Users] New Big int dlg_id of
                  dialog table <br>
                  <br>
                  <div dir="ltr">this variable holds a string value for
                    dilog DID but in my table there is a field big int
                    which stores some kind of id <br>
                  </div>
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On Fri, Dec 26, 2014 at
                      1:16 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
                          moz-do-not-send="true"
                          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 text="#000000" bgcolor="#FFFFFF">
                          <div><tt>Hi John,<br>
                              <br>
                              See the $DLG_did variable from the dialog
                              module:<br>
                                  <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/1.11.x/dialog.html#id297237"
                                target="_blank">http://www.opensips.org/html/docs/modules/1.11.x/dialog.html#id297237</a><br>
                              <br>
                              Regards,<br>
                            </tt>
                            <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                            <span> On 26.12.2014 07:10, John Nash wrote:<br>
                            </span></div>
                          <blockquote type="cite"><span>
                              <div dir="ltr">I was just wondering if
                                there is any way to get dlg_id value in
                                a script using some psudo variable. like
                                in earlier versions we had $DLG_did<br>
                              </div>
                              <br>
                              <fieldset></fieldset>
                              <br>
                            </span>
                            <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                          </blockquote>
                          <br>
                        </div>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </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>