Hello Olle,

If you are to reimplement this by scripting instead of developing a C module, maybe you could use redis as a database, and for each invite of a customer, create a unique key in the redis database like this:

CUSTOMER_A:CALLID

Then set this key to auto expire in let's 10 seconds for instance, with TTL command http://redis.io/commands/ttl .

Then to check the number of invite per seconds for CUSTOMER_A smoothed over a window of 10 seconds, you count the keys in the DB that starts with CUSTOMER_A ( KEYS CUSTOMER_A*) and divide it by 10.

Of course you would have to use a completely empty redis database used only for this purpose in order to reduce the time spent by the  keys command to find the number of key matching.











On Thu, Jul 3, 2014 at 11:48 AM, Olle E. Johansson <oej@edvina.net> wrote:
I am looking for calls setups per second - not concurrent calls.
Sorry for not being exact.

/O

On 03 Jul 2014, at 13:41, Fred Posner <fred@palner.com> wrote:

> I've done this with dialog and a sql lookup/update.
>
> The sql call updates the table with how many calls are in total for the
> "client" and how many international calls. There's a max calls and a max
> international.
>
> If current < max, the call can go through.
>
> The db allows me to combine the lookup over multiple media servers and
> kamailio servers. The lookup checks the db so any modifications occur in
> real-time.
>
> Fred Posner
> The Palner Group, Inc.
> http://www.palner.com (web)
> +1-503-914-0999 (direct)
> +1-954-472-2896 (fax)
>
> On 07/03/2014 07:37 AM, Olle E. Johansson wrote:
>> Hi!
>>
>> Have you implemented a per-customer rate limit in Calls per second? If so - how?
>>
>> I've played with ratelimit/pipelimit and it seems like I can define a database with one pipe per customer - but have to restart Kamailio to add customers. There are warnings for low timer settings, like 1 second, but I don't know how up-to-date those warnings are.
>>
>> I guess I could play with hash tables and implement something pike-like there, but it seems like a workaround for something pretty common.
>>
>> So the question remains - how are you limiting on a cps per customer?
>>
>> /O
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users@lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users