<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Schneur,<br>
      <br>
      Do you originally load the limit from the subscriber table ?<br>
      <br>
      Best 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 04.09.2015 12:36, Schneur Rosenberg
      wrote:<br>
    </div>
    <blockquote
cite="mid:CANvjR0V338hHT1jTgvrwhv4rXii-qwQTFKkdK1EZ9ZAiZgWkNw@mail.gmail.com"
      type="cite">
      <p dir="ltr">I limit mine on account and I used memcache to store
        the limits because its not something that changes on a constant
        basis, so it only does a db query maximum once a hour per
        device.</p>
      <div class="gmail_quote">On Sep 4, 2015 4:52 AM, "Bogdan-Andrei
        Iancu" &lt;<a moz-do-not-send="true"
          href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>&gt;
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Terrance,<br>
          <br>
          That check is not expensive as it is done in memory cache (the
          "address" table is cached at startup).<br>
          <br>
          Regards,<br>
          <br>
          Bogdan-Andrei Iancu<br>
          OpenSIPS Founder and Developer<br>
          <a moz-do-not-send="true"
            href="http://www.opensips-solutions.com" rel="noreferrer"
            target="_blank">http://www.opensips-solutions.com</a><br>
          <br>
          On 03.09.2015 21:42, Terrance Devor wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            Lovely!<br>
            <br>
            For those that need to limit concurrent call on OpenSIPS,
            here is the solution:<br>
            <br>
            route[limit] {<br>
                    set_dlg_profile("ip","$si");<br>
                    get_profile_size("ip","$si","$var(calls)");<br>
            check_address("0","$si","$sp","$proto","$avp(ctx)");<br>
                    xlog("$avp(ctx)\n");<br>
                    xlog("L_INFO","Customer IP $si has $var(calls)
            concurrent calls, and limit is 12\n");<br>
            <br>
                    if($var(calls)&gt;$avp(ctx)) {<br>
                            xlog("Customer IP $si exceeded number of
            calls $var(calls)/12\n");<br>
                            send_reply("486", "Busy here, channel limit
            exceeded.");<br>
                            exit;<br>
                    }<br>
            }<br>
            <br>
            Bogdan, how expensive is
            `check_address("0","$si","$sp","$proto","$avp(ctx)")`?<br>
            <br>
            Terrance<br>
            <br>
          </blockquote>
          <br>
          <br>
          _______________________________________________<br>
          Users mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
          <a moz-do-not-send="true"
            href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
            rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
        </blockquote>
      </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>