<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>


<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
<div dir="ltr">Hello, <br><br>I am trying to use the rate limit module using Kamailio 1.5.2. I feel that I got it but I would<br>&nbsp;like some pointers and recommendations.<br><br>These are my settings: (this is a lab of course), I used 1 on the timer_interval because I am<br>&nbsp;generating the calls manually and wanted to see it in action quickly: <br><br><br># ---- ratelimit -------<br>modparam("ratelimit", "timer_interval", 1)<br>modparam("ratelimit", "reply_code", 506)<br>modparam("ratelimit", "reply_reason", "Rejecting due to high load")<br>modparam("ratelimit", "queue", "0:INVITE")<br>modparam("ratelimit", "pipe", "0:TAILDROP:1")<br><br><br><div>
<div>&nbsp;then in the route section:<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (method=="INVITE") {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("L_INFO","mylog: RL found INVITE.\n");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!rl_check()) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("L_INFO","mylog: RL dropped message.\n");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rl_drop();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("L_INFO","mylog: RL found INVITE but did not drop it.\n");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br><br><br>The TAILDROP algorithm seems to work better than the RED, based on what I expected of course (with 1 sec timer interval and 1 calls/sec on the pipe). <br>Making manual calls one right after the other almost always triggered the protecting when there was another call on the same second.<br><br><br>But these lines (1.6.3.&nbsp;<code class="varname">pipe</code>) on the doc got me kind of confused:<br><br>"                When specifying a limit, the unit depends on the algorithm used and <br>doesn't
                need to be specified also (eg, for TAILDROP or RED, limit means packets/sec,
                whereas with the FEEDBACK <br>algorithm, it means [CPU] load factor).<br><br>For these 2 lines below, does this mean that the interval =10 will be overridden by the 100 calls/sec on the TAILDROP algorithm?<br><br>modparam("ratelimit", "timer_interval", 10)<br>modparam("ratelimit", "pipe", "0:TAILDROP:100")<br><br>I made a quick test and with timer_interval = 10 and TAILDROP:1, it looks like the protection kicks in almost every 10 secs: (Dec 2 19:44:07&nbsp; and Dec&nbsp; 2 19:43:57),<br><br>&nbsp;tail -f proxy.log | grep RL<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:54 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:54 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:55 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:55 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL dropped message.<br>Dec&nbsp; 2 19:43:58 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:58 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:01 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:01 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:04 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:04 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE but did not drop it.<br>Dec&nbsp; 2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL dropped message.<br>Dec&nbsp; 2 19:44:10 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.<br>Dec&nbsp; 2 19:44:10 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE but did not drop it.<br><br><br></div></div></div>                                               </div></body>
</html>