<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<tt>Hi, Pat!<br>
<br>
The way you are using $rl_count is wrong, because the $rl_count
pseudo variable only accepts strings or other pvars, not formatted
strings (such as </tt><tt>"cps_$avp(trunk_group)").<br>
To achieve what you are trying to do is to assign the name to a
pvar and feed it in the $rl_count's name:<br>
<br>
$var(rl_name) = "cps_" + </tt><tt>$avp(trunk_group);</tt><br>
<tt>$json(call_details/tg_cps) = $rl_count($var(rl_name));<br>
<br>
Let me know how this goes.<br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 01/13/2017 12:48 AM, Pat Burke
wrote:<br>
</div>
<blockquote
cite="mid:d676419757de6872b9d20bad693ee455@voxtelesys.com"
type="cite">
<title></title>
<div class="iw_mail" dir="ltr">Hello,
<div><br>
</div>
<div>I am trying to get the current rate limit value using
$rl_count, but it is giving the following error.</div>
<div> ERROR:ratelimit:pv_get_rl_count: invalid name</div>
<div>
<div> WARNING:core:do_assign: no value in right
expression at /etc/opensips/opensips_proxy.cfg:598</div>
<div> 4024438929 SCRIPT:CCLIMIT:INFO: rl_limit for
cps_90761 = 0</div>
<div><br>
</div>
</div>
<div>Here is the code</div>
<div><br>
</div>
<div>
<div> $json(call_details/tg_cps) = 0; # Default to 0</div>
<div><br>
</div>
<div>...</div>
<div><br>
</div>
<div> if ($avp(maxcps) != NULL && $avp(maxcps) >
0) {</div>
<div> if (!rl_check("cps_$avp(trunk_group)",
"$avp(maxcps)")) {</div>
<div> xlog("L_NOTICE", "$rU SCRIPT:CPSLIMIT:DBG:
Max $avp(maxcps) cps reached for trunk group
$avp(trunk_group) \n");</div>
<div> $avp(error_reason) = $avp(error_reason) +
$avp(trunk_group) + " CPS limit reached.";</div>
<div> send_reply("403", "Max CPS limit reached");</div>
<div> exit;</div>
<div> }</div>
<div> }</div>
<div> </div>
<div> $json(call_details/tg_cps) =
$rl_count("cps_$avp(trunk_group)");</div>
<div> xlog("L_INFO", "$rU SCRIPT:CCLIMIT:INFO: rl_limit for
cps_$avp(trunk_group) = $json(call_details/tg_cps) \n");</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>From the command opensipsctl fifo rl_list | grep
cps_90761, I get</div>
<div> PIPE:: id=cps_90761 algorithm=TAILDROP limit=2
counter=0</div>
<div><br>
</div>
<div>What am I missing?<br>
<br>
<div class="signature">
<div style="font-family: arial, helvetica, sans-serif;
font-size: 16px;"><span data-mce-style="color: #808080;
font-family: arial,helvetica,sans-serif; font-size:
11pt;" style="color: rgb(128, 128, 128); font-size:
11pt;">Regards,</span></div>
<div style="font-family: arial, helvetica, sans-serif;
font-size: 16px;">
<span data-mce-style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 11pt;"
style="color: rgb(128, 128, 128); font-size: 11pt;"><strong>Pat
Burke</strong></span><br>
<br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>