[OpenSIPS-Users] Rate Limit Module

Richard Robson rrobson at greenlightcrm.com
Thu Mar 3 17:12:50 CET 2016


I'm using 2.1 and cant see the ratelimit module limiting calls. I'm just
testing at the moment but i;'ve set the limit to 2 and i'm making 2
simultaneous calls from the downstream asterisk. tHis is then
loadbalancing to out upstream sip supplier

This is the part catching the INVITE then loadbalancing and rate
limiting. The loadbalancer is working OK.

        if (is_method("INVITE")) {

                if (lb_start("2","calls")) {

                        setflag(SST_FLAG);
                        create_dialog('B');
                        $var(limit) = 2;
                        if (!rl_check("$du", "$var(limit)", "RED")) { #
Check Rate limit


                                if (lb_start("3","calls")) {

                                setflag(SST_FLAG);
                                create_dialog('B');
                                $var(limit) = 1;
                                        if (!rl_check("$du",
"$var(limit)","RED")) {
                                                sl_send_reply("503",
"Server Unavailable");

                                                exit;
                                        }
                                }
                        }
                }

                t_on_branch("per_branch_ops");
                t_on_reply("handle_nat");
                t_on_failure("missed_call");
 
                if (rtpengine_offer())

        }


If I make 3 calls I would expect one of the calls to get dropped and to
use the other load balancer pool I can see the Counter going to 3 which
is more than the limit of 2 and the drop rate at 0. I am getting the
same results using TAILDROP too.

[root at gl-sip-01 ~]# opensipsctl fifo rl_list
PIPE::  id=sip:sip-wholesale.aql.com algorithm=RED limit=2 counter=3
PIPE::  drop_rate=0
[root at gl-sip-01 ~]# opensipsctl fifo rl_list
PIPE::  id=sip:sip-wholesale.aql.com algorithm=RED limit=2 counter=3
PIPE::  drop_rate=0
[root at gl-sip-01 ~]# opensipsctl fifo rl_list
PIPE::  id=sip:sip-wholesale.aql.com algorithm=RED limit=2 counter=3
PIPE::  drop_rate=0
[root at gl-sip-01 ~]# opensipsctl fifo rl_list
PIPE::  id=sip:sip-wholesale.aql.com algorithm=RED limit=2 counter=0
PIPE::  drop_rate=0
[root at gl-sip-01 ~]# opensipsctl fifo rl_list
PIPE::  id=sip:sip-wholesale.aql.com algorithm=RED limit=2 counter=0
PIPE::  drop_rate=0
[root at gl-sip-01 ~]# opensipsctl fifo rl_list
PIPE::  id=sip:sip-wholesale.aql.com algorithm=RED limit=2 counter=0
PIPE::  drop_rate=0

Regards,

-- 
Richard Robson
Greenlight Support




More information about the Users mailing list