[OpenSIPS-Users] Managing Concurrent Calls
Schneur Rosenberg
rosenberg11219 at gmail.com
Sat Sep 5 01:25:59 CEST 2015
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> wrote:
> Hi Schneur,
>
> Do you originally load the limit from the subscriber table ?
>
> Best regards,
>
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developerhttp://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> 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
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150904/eddc6fd4/attachment.htm>
More information about the Users
mailing list