<div dir="ltr"><p dir="ltr"><br>
No, I created 2 tables, one has a record for each device and to what account code they belong to, 2nd table lists every account code and how many simultaneous calls they can make, then I just run a query to get account code and maximum concurrent calls allowed for the account code the query obviously is a perfect candidate for memcaching because the info rarely changes so I run cache_fetch before running the query.</p>
<p dir="ltr">This allows me to limit the channels on an account and not just on a single device, for a virtual PRI setting.</p>
<p dir="ltr">Here is the simple query "select dev.username, ent.chLimit from custom_deviceToEnterprise as dev, custom_enterpriseConcurrent as ent where dev.username='$fU' and dev.enterprise=ent.enterprise;"</p>
<p dir="ltr">1st table</p>
<p dir="ltr">CREATE TABLE `custom_deviceToEnterprise` (</p>
<p dir="ltr"> `id` bigint(20) NOT NULL AUTO_INCREMENT,</p>
<p dir="ltr"> `username` varchar(50) NOT NULL,</p>
<p dir="ltr"> `enterprise` varchar(50) NOT NULL,</p>
<p dir="ltr"> PRIMARY KEY (`id`)</p>
<p dir="ltr">)<br><br></p>
<p dir="ltr">2nd table</p>
<p dir="ltr">CREATE TABLE `custom_enterpriseConcurrent` (</p>
<p dir="ltr"> `id` bigint(20) NOT NULL AUTO_INCREMENT,</p>
<p dir="ltr"> `enterprise` varchar(25) NOT NULL,</p>
<p dir="ltr"> `chLimit` varchar(5) NOT NULL,</p>
<p dir="ltr"> PRIMARY KEY (`id`)</p>
<p dir="ltr">)</p>
<p dir="ltr">▶ Show quoted text<br>
</p>
<div class="gmail_quote">On Sep 4, 2015 6:42 AM, "Bogdan-Andrei Iancu" <<a href="mailto:bogdan@opensips.org" target="_blank">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">
<div 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 cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
<div>On 04.09.2015 12:36, Schneur Rosenberg
wrote:<br>
</div>
<blockquote 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" <<a href="mailto:bogdan@opensips.org" target="_blank">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>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a 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>
</div>