[OpenSIPS-Users] rl_check, limit parameter as a variable
Ben Newlin
Ben.Newlin at genesys.com
Wed May 8 08:26:46 EDT 2019
Alexey,
My guess would be that the cache fetch is retrieving the value as a string, while rl_check is expecting an integer. When you set it explicitly as an integer in the script, it works. Have you tried converting the retrieved cache value to an integer using a transformation [1]?
[1] https://www.opensips.org/Documentation/Script-Tran-2-4#toc3
Ben Newlin
On 5/8/19, 7:27 AM, "Users on behalf of Alexey Kazantsev via Users" <users-bounces at lists.opensips.org on behalf of users at lists.opensips.org> wrote:
Hi list !
The idea is to store limit value in local cache, to be able to change it without
OpenSIPS restart. But when I store it in local cache, it is not applied
to 'limit' parameter of rl_check [1] function. Though it is fetched successfully.
[1] https://opensips.org/html/docs/modules/2.4.x/ratelimit.html#func_rl_check
------------------------------------------------
working:
# initial INVITE
if(is_method("INVITE")) {
... ...
$var(rl) = 1;
xlog("L_NOTICE", "cfg_line $cfg_line ; var(rl) is $var(rl)");
if (!rl_check("pipe_$rU", "$var(rl)", "SBT")) {
sl_send_reply("503", "Server Unavailable");
exit;
};
------------------------------------------------
NOT working:
# initial INVITE
if(is_method("INVITE")) {
... ...
cache_fetch("local", "incoming:ratelimit", $var(rl));
xlog("L_NOTICE", "cfg_line $cfg_line ; var(rl) is $var(rl)");
if (!rl_check("pipe_$rU", "$var(rl)", "SBT")) {
sl_send_reply("503", "Server Unavailable");
exit;
};
-----------------------------------------------
BR, Alexey
http://alexeyka.zantsev.com/
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list