<html><head></head><body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72" style="background-color: rgb(255, 255, 255); line-height: initial;">                                                                                      <div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">Your best bet for this is the pipelimit module, which is designed for just that purpose.</div>                                                                                                                                     <div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);"><br style="display:initial"></div>                                                                                                                                     <div style="display:none"></div>                                                              <div style="font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">--<br>Alex Balashov | Principal | Evariste Systems LLC<br>303 Perimeter Center North, Suite 300<br>Atlanta, GA 30346<br>United States<br><br>Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)<br>Web: http://www.evaristesys.com/, http://www.csrpswitch.com/<br><br>Sent from my BlackBerry.</div>                                                                                                                                                                                  <table width="100%" style="background-color:white;border-spacing:0px;"> <tbody><tr><td colspan="2" style="font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);">                           <div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in; font-family: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;">  <div><b>From: </b>Ali Taher</div><div><b>Sent: </b>Friday, June 19, 2015 10:32</div><div><b>To: </b>'Kamailio (SER) - Users Mailing List'</div><div><b>Reply To: </b>Kamailio (SER) - Users Mailing List</div><div><b>Subject: </b>Re: [SR-Users] Kamailio invite counter</div></div></td></tr></tbody></table><div style="border-style: solid none none; border-top-color: rgb(186, 188, 209); border-top-width: 1pt; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"></div><br><div id="_originalContent" style="background-color: white;"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--><div class="WordSection1"><p class="MsoNormal"><span style="color:#1F497D">Hi Alex,<o:p></o:p></span></p><p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color:#1F497D">I need to limit the number of requests received within 1 second, meaning that if the number of request during 1 second exceeds a certain limit(let’s say 1000 call per second), these requests must be blocked.<o:p></o:p></span></p><p class="MsoNormal"><span style="color:#1F497D">How can I reset the counter every one second to achieve this?<o:p></o:p></span></p><p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color:#1F497D">Thanks,<o:p></o:p></span></p><p class="MsoNormal"><span style="color:#1F497D">Ali<o:p></o:p></span></p><p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p><div><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b>From:</b> sr-users [mailto:sr-users-bounces@lists.sip-router.org] <b>On Behalf Of </b>Alex Balashov<br><b>Sent:</b> Friday, June 19, 2015 5:16 PM<br><b>To:</b> Ali Taher<br><b>Subject:</b> Re: [SR-Users] Kamailio invite counter<o:p></o:p></p></div></div><p class="MsoNormal"><o:p> </o:p></p><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D">Ali,</span><span style="font-size:12.0pt;color:#1F497D"><o:p></o:p></span></p></div><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D"><o:p> </o:p></span></p></div><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D">$var variables do not persist outside the scope of the processing of a single SIP message. They live in the private memory of every receiver process.<o:p></o:p></span></p></div><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D"><o:p> </o:p></span></p></div><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D">Take a look at the 'htable' or 'statistics' modules.<o:p></o:p></span></p></div><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D"><o:p> </o:p></span></p></div><div><p class="MsoNormal" style="background:white"><span style="color:#1F497D">--<br>Alex Balashov | Principal | Evariste Systems LLC<br>303 Perimeter Center North, Suite 300<br>Atlanta, GA 30346<br>United States<br><br>Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)<br>Web: <a href="http://www.evaristesys.com/">http://www.evaristesys.com/</a>, <a href="http://www.csrpswitch.com/">http://www.csrpswitch.com/</a><br><br>Sent from my BlackBerry.<o:p></o:p></span></p></div><table class="MsoNormalTable" border="0" cellpadding="0" width="100%" style="width:100.0%;background:white;border-spacing:0px"><tbody><tr><td style="padding:.75pt .75pt .75pt .75pt;font-size:initial;text-align:initial"><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><div><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">From: </span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">Ali Taher<o:p></o:p></span></p></div><div><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">Sent: </span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">Friday, June 19, 2015 09:55<o:p></o:p></span></p></div><div><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">To: </span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">'Kamailio (SER) - Users Mailing List'<o:p></o:p></span></p></div><div><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">Reply To: </span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">Kamailio (SER) - Users Mailing List<o:p></o:p></span></p></div><div><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">Subject: </span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">[SR-Users] Kamailio invite counter<o:p></o:p></span></p></div></div></td></tr></tbody></table><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p><div id="_originalContent"><p class="MsoNormal">Hello,<o:p></o:p></p><p class="MsoNormal"> <o:p></o:p></p><p class="MsoNormal">I want to define a counter  that increase in every invite.<o:p></o:p></p><p class="MsoNormal">I tried the below :<o:p></o:p></p><p class="MsoNormal"> <o:p></o:p></p><p class="MsoNormal">if (is_method("INVITE"))<o:p></o:p></p><p class="MsoNormal">                {      <o:p></o:p></p><p class="MsoNormal">$var(u)=$var(u)+1;<o:p></o:p></p><p class="MsoNormal">xlog("L_INFO","Counter : $var(u) " );<o:p></o:p></p><p class="MsoNormal">}<o:p></o:p></p><p class="MsoNormal"> <o:p></o:p></p><p class="MsoNormal">But the counter is reset to 1 randomly (even before restarting kamailio service)<o:p></o:p></p><p class="MsoNormal"> <o:p></o:p></p><p class="MsoNormal">How can have a proper counter that count invite messages.<o:p></o:p></p><p class="MsoNormal"> <o:p></o:p></p><p class="MsoNormal">Thanks<o:p></o:p></p><p class="MsoNormal">Ali<o:p></o:p></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><br><br><o:p></o:p></span></p></div></div><br><!--end of _originalContent --></div></body></html>