On 08/14/2014 12:49 PM, AliReza Khoshgoftar Monfared wrote:
Hi list,
A quick question,
What is the best way to limit the rate of the kamailio, Say I want it to process only 200 INVITEs per second
I know this can be done using ratelimit module, but what if I want to change this rate dynamically? say, in an overload control scenario, I am getting a recommended rate piggybacked in my replies, and I read it, then how can I change the messge processing rate of kamailio in runtime inside my script?
Is there a way to change the rate using ratelimit but inside script as messages come?
The RPC function (rl.set_pipe) does it, but can I call it inside my script?
There is presently no good means of accomplishing that except by implementing your own rate-limiting mechanism. The easiest way to do that is probably through the use of 'htable'. Sample a number of calls per unit of time and then divide by the sampling period to get approximate CPS.
The 'updateexpire' parameter to the definition of an htable was added to make things like this easier:
http://kamailio.org/docs/modules/4.1.x/modules/htable.html#htable.p.htable