<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <meta name="qrichtext" content="1">
    <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
      margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Hi
      Terrance,<br>
    </p>
    <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
      margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br>
      You can put your extra data into the "context_info" column in the
      address table. The can be automatically loaded via the
      check_xx_address functions :<br>
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.11.x/permissions.html#id294839">http://www.opensips.org/html/docs/modules/1.11.x/permissions.html#id294839</a><br>
    </p>
    <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
      margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br>
    </p>
    <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
      margin-right:0px; -qt-block-indent:0; text-indent:0px;">Best
      regards,
      <!--EndFragment--></p>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
p, li { white-space: pre-wrap; }
</style>
    <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 03.09.2015 03:49, Terrance Devor
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA+w+2f9CUKoRd8mToQqHQHQG6bXhdYxwGLowfps1Z8ngpJ1Ggg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello Everyone,
        <div><br>
        </div>
        <div>Thank you Bogdan for the script. I simply plugged the
          little bit of code bellow in my script and everything just
          worked.</div>
        <div>Seems to be a theme with OpenSips "It just works...." lol.</div>
        <div><br>
        </div>
        <div>route[limit] {<br>
        </div>
        <div>
          <div>        set_dlg_profile("ip","$si");</div>
          <div>        get_profile_size("ip","$si","$var(calls)");</div>
          <div>        xlog("L_INFO","Customer IP $si has $var(calls)
            concurrent calls, and limit is 12\n");</div>
          <div><br>
          </div>
          <div>        if($var(calls)&gt;12) {</div>
          <div>                xlog("Customer IP $si exceeded number of
            calls $var(calls)/12\n");</div>
          <div>                send_reply("486", "Busy here, channel
            limit exceeded.");</div>
          <div>                exit;</div>
          <div>        }</div>
          <div>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>My question now, is limit is hardcoded for testing
            purposes (ie, $var(calls)&gt;12). My approach would be to
            add a `channel` field to the</div>
        </div>
        <div style="">`address` table, so we can limit the number of
          channel per IP. From there, I would query that table on
          initial INVITE and pull the channel</div>
        <div style="">value as per IP address. This approach will of
          course not take advantage of the amazing caching design of
          OpenSIPS.</div>
        <div style=""><br>
        </div>
        <div style="">Before I go this route, is it possible to extract
          a cached `channel` value from the database for a `$si`. I did
          not see this value anywhere.</div>
        <div style=""><br>
        </div>
        <div style="">Thanks in Advance,</div>
        <div style=""><br>
        </div>
        <div style="">Terrance.</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Aug 17, 2015 at 1:02 PM,
          Terrance Devor <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:ter.devor@gmail.com" target="_blank">ter.devor@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Ahhhh sweet! Will go through it and update
              this email if I have any issues.
              <div><br>
              </div>
              <div>Thanks Bogdan!</div>
              <span class="HOEnZb"><font color="#888888">
                  <div><br>
                  </div>
                  <div>T​</div>
                </font></span></div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>