<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" <<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>> 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 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)>$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 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>