Copyright © 2007 1und1 Internet AG, BASIS AudioNet GmbH
initial_probability
(string)rand_event()
rand_set_prob(probabiltiy)
rand_reset_prob()
rand_get_prob()
sleep(time)
usleep(time)
rand_set_prop
rand_reset_prob
rand_get_prob
$RANDOM
initial_probability
parameter usagerand_event()
usagerand_set_prob()
usagerand_reset_prob()
usagerand_get_prob()
usagesleep
usageusleep
usagerand_set_prob
usagerand_reset_prob
usagerand_get_prob
usageRANDOM pseudo-variable
usageThe cfgutils module can be used to introduce some randomness to the behaviour of the server. It provides some setup functions and the "rand_event" function. This function return either true or false, depending on a random value and a specified probability. E.g. if you set via fifo or script a probability value of 5%, then 5% of all calls to rand_event will return true. The pseudovariable "$RANDOM" could be used to introduce random values e.g. into a SIP reply.
The benefit of this module is the probability of the decision can be manipulated by external applications such as web interface or command line tools. The probability must be specified as percent value, ranging from 0 to 100.
The module exports commands to FIFO server that can be used to change the global settings via FIFO interface. The FIFO commands are: "set_prob", "reset_prob" and "get_prob".
This module can be used for simple load-shedding, e.g. reply 5% of the Invites with a 503 error and a adequate random Retry-After value.
Due the openser architecture the module uses only one seed for all the children, that means if you have for example three children, the random descision and the returned random value will repeat three times.
The module provides as well some functions to delay the execution of the server. The functions "sleep" and "usleep" could be used to let the server wait a specific time interval.
The module depends on the following modules (in the other words the listed modules must be loaded before this module):
none
rand_event()
Return true or false, depending on a random value and a probability value.
rand_set_prob(probabiltiy)
Set the "probability" of the decision.
"probability" can have a value from the range 0..100.
sleep(time)
Waits "time" seconds.
Meaning of the parameters is as follows:
time - Time to wait in seconds.
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
usleep(time)
Waits "time" milli-seconds.
Meaning of the parameters is as follows:
time - Time to wait in milli-seconds.
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
rand_set_prop
Set the probability value to the given parameter. The parameter should be a percent value.
The parameter value must be a number from 0 to 100.
rand_reset_prob
Reset the probability value to the inital start value.
This command don't need a parameter.
rand_get_prob
Return the actual probability setting.
The function return the actual probability value.
Take a look at http://www.openser-project.org/.
First at all check if your question was already answered on one of our mailing lists:
User Mailing List - http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Developer Mailing List - http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel
E-mails regarding any stable OpenSER release should be sent to
<users@lists.openser-project.org>
and e-mails regarding development versions
should be sent to <devel@lists.openser-project.org>
.
If you want to keep the mail private, send it to
<team@lists.openser-project.org>
.
Please follow the guidelines provided at: http://sourceforge.net/tracker/?group_id=139143.