<div dir="ltr">Hello Olle,<div><br></div><div>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:</div>
<div><br></div><div>CUSTOMER_A:CALLID</div><div><br></div><div>Then set this key to auto expire in let's 10 seconds for instance, with TTL command <a href="http://redis.io/commands/ttl">http://redis.io/commands/ttl</a> .</div>
<div><br></div><div>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.</div>
<div><br></div><div>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.</div><div><br></div>
<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 3, 2014 at 11:48 AM, Olle E. Johansson <span dir="ltr"><<a href="mailto:oej@edvina.net" target="_blank">oej@edvina.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am looking for calls setups per second - not concurrent calls.<br>
Sorry for not being exact.<br>
<span class="HOEnZb"><font color="#888888"><br>
/O<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 03 Jul 2014, at 13:41, Fred Posner <<a href="mailto:fred@palner.com">fred@palner.com</a>> wrote:<br>
<br>
> I've done this with dialog and a sql lookup/update.<br>
><br>
> The sql call updates the table with how many calls are in total for the<br>
> "client" and how many international calls. There's a max calls and a max<br>
> international.<br>
><br>
> If current < max, the call can go through.<br>
><br>
> The db allows me to combine the lookup over multiple media servers and<br>
> kamailio servers. The lookup checks the db so any modifications occur in<br>
> real-time.<br>
><br>
> Fred Posner<br>
> The Palner Group, Inc.<br>
> <a href="http://www.palner.com" target="_blank">http://www.palner.com</a> (web)<br>
> <a href="tel:%2B1-503-914-0999" value="+15039140999">+1-503-914-0999</a> (direct)<br>
> <a href="tel:%2B1-954-472-2896" value="+19544722896">+1-954-472-2896</a> (fax)<br>
><br>
> On 07/03/2014 07:37 AM, Olle E. Johansson wrote:<br>
>> Hi!<br>
>><br>
>> Have you implemented a per-customer rate limit in Calls per second? If so - how?<br>
>><br>
>> 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.<br>

>><br>
>> I guess I could play with hash tables and implement something pike-like there, but it seems like a workaround for something pretty common.<br>
>><br>
>> So the question remains - how are you limiting on a cps per customer?<br>
>><br>
>> /O<br>
>> _______________________________________________<br>
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
>> <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
>> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
>><br>
><br>
> _______________________________________________<br>
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
> <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div></div></blockquote></div><br></div>