[OpenSIPS-Users] Managing Concurrent Calls

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Sep 7 11:57:03 CEST 2015


Hi Schneur,

I was asking as maybe you could took advantage of the "load_credentials" 
option in auth_db module:
http://www.opensips.org/html/docs/modules/1.11.x/auth_db.html#id293578
where you can load (during digest auth) extra columns from the 
subscriber table during the query for loading the passwd.

Best regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 05.09.2015 02:25, Schneur Rosenberg wrote:
>
>
> 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.
>
> This allows me to limit the channels on an account and not just on a 
> single device, for a virtual PRI setting.
>
> 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;"
>
> 1st table
>
> CREATE TABLE `custom_deviceToEnterprise` (
>
>   `id` bigint(20) NOT NULL AUTO_INCREMENT,
>
>   `username` varchar(50) NOT NULL,
>
>   `enterprise` varchar(50) NOT NULL,
>
>   PRIMARY KEY (`id`)
>
> )
>
> 2nd table
>
> CREATE TABLE `custom_enterpriseConcurrent` (
>
>   `id` bigint(20) NOT NULL AUTO_INCREMENT,
>
>   `enterprise` varchar(25) NOT NULL,
>
>   `chLimit` varchar(5) NOT NULL,
>
>   PRIMARY KEY (`id`)
>
> )
>
> ▶ Show quoted text
>
> On Sep 4, 2015 6:42 AM, "Bogdan-Andrei Iancu" <bogdan at opensips.org 
> <mailto:bogdan at opensips.org>> wrote:
>
>     Hi Schneur,
>
>     Do you originally load the limit from the subscriber table ?
>
>     Best regards,
>
>     Bogdan-Andrei Iancu
>     OpenSIPS Founder and Developer
>     http://www.opensips-solutions.com
>
>     On 04.09.2015 12:36, Schneur Rosenberg wrote:
>>
>>     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.
>>
>>     On Sep 4, 2015 4:52 AM, "Bogdan-Andrei Iancu"
>>     <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>
>>         Hi Terrance,
>>
>>         That check is not expensive as it is done in memory cache
>>         (the "address" table is cached at startup).
>>
>>         Regards,
>>
>>         Bogdan-Andrei Iancu
>>         OpenSIPS Founder and Developer
>>         http://www.opensips-solutions.com
>>
>>         On 03.09.2015 21:42, Terrance Devor wrote:
>>
>>             Lovely!
>>
>>             For those that need to limit concurrent call on OpenSIPS,
>>             here is the solution:
>>
>>             route[limit] {
>>                     set_dlg_profile("ip","$si");
>>             get_profile_size("ip","$si","$var(calls)");
>>             check_address("0","$si","$sp","$proto","$avp(ctx)");
>>                     xlog("$avp(ctx)\n");
>>                     xlog("L_INFO","Customer IP $si has $var(calls)
>>             concurrent calls, and limit is 12\n");
>>
>>                     if($var(calls)>$avp(ctx)) {
>>                             xlog("Customer IP $si exceeded number of
>>             calls $var(calls)/12\n");
>>                             send_reply("486", "Busy here, channel
>>             limit exceeded.");
>>                             exit;
>>                     }
>>             }
>>
>>             Bogdan, how expensive is
>>             `check_address("0","$si","$sp","$proto","$avp(ctx)")`?
>>
>>             Terrance
>>
>>
>>
>>         _______________________________________________
>>         Users mailing list
>>         Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150907/4634a974/attachment.htm>


More information about the Users mailing list