<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, &quot;Bogdan-Andrei Iancu&quot; &lt;<a 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 &quot;address&quot; table is cached at startup).<br>
<br>
Regards,<br>
<br>
Bogdan-Andrei Iancu<br>
OpenSIPS Founder and Developer<br>
<a 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(&quot;ip&quot;,&quot;$si&quot;);<br>
        get_profile_size(&quot;ip&quot;,&quot;$si&quot;,&quot;$var(calls)&quot;);<br>
check_address(&quot;0&quot;,&quot;$si&quot;,&quot;$sp&quot;,&quot;$proto&quot;,&quot;$avp(ctx)&quot;);<br>
        xlog(&quot;$avp(ctx)\n&quot;);<br>
        xlog(&quot;L_INFO&quot;,&quot;Customer IP $si has $var(calls) concurrent calls, and limit is 12\n&quot;);<br>
<br>
        if($var(calls)&gt;$avp(ctx)) {<br>
                xlog(&quot;Customer IP $si exceeded number of calls $var(calls)/12\n&quot;);<br>
                send_reply(&quot;486&quot;, &quot;Busy here, channel limit exceeded.&quot;);<br>
                exit;<br>
        }<br>
}<br>
<br>
Bogdan, how expensive is `check_address(&quot;0&quot;,&quot;$si&quot;,&quot;$sp&quot;,&quot;$proto&quot;,&quot;$avp(ctx)&quot;)`?<br>
<br>
Terrance<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a 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>