[OpenSIPS-Users] rl_check, limit parameter as a variable

Alexey Kazantsev kurgan-rus at inbox.ru
Wed May 8 07:25:50 EDT 2019


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/


More information about the Users mailing list