<html><body><div>Hi, thanks for the reply. The issue was that my comparison was being treated as a string instead of an integer so 2 > 15. Once I converted to integers this looked to be resolved:<br><br>$avp(s:sim_calls) = $(avp(s:sim_calls){s.int});<br><br>$avp(s:cnt) = $(avp(s:cnt){s.int});<br><br> if($avp(s:cnt) >= $avp(s:sim_calls)) {<br></div><div><br>On Apr 06, 2011, at 11:15 AM, Bogdan-Andrei Iancu <bogdan@opensips.org> wrote:<br><br><div><blockquote type="cite"><div class="msg-quote" bgcolor="#ffffff" text="#000000">
Hi Logan,
<br>
<br>
what are the printed xlogs from your script ? interesting is to see
the values for $avp(s:cnt) and $avp(s:sim_calls) .<br>
<br>
Regards,<br>
Bogdan<br>
<br>
On 03/15/2011 04:15 PM, logan wrote:
<blockquote cite="" type="cite">
<div>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">I have a uuid in the
usr_preferences table set to attribute = sim_calls with value
= 15 calls allowed but am getting the concurrency limit error
when 2 calls are up and trying to establish the 3rd call. Can
anyone help figure out why?</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">Config Snips:</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"avp_table", "usr_preferences")</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"use_domain", 0)</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"uuid_column", "uuid")</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"username_column", "username")</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"domain_column", "domain")</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"attribute_column", "attribute")</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"value_column", "value")</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("avpops",
"type_column", "type")</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">loadmodule "dialog.so"</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("dialog",
"dlg_flag", 4)</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("dialog",
"db_mode", 1)</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"># TODO: rename profile
"caller" to something more deliberate</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">modparam("dialog",
"profiles_with_value", "caller;carrierin;carrierout")</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> # fetch group the
user belongs to</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
avp_db_query("select grp from grp where
username='$avp(s:username)'", "$avp(s:group)");</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
if(avp_check("$avp(s:group)","re/.*/g")) {</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
xlog("L_INFO", "----- user $avp(s:username) belongs to
$avp(s:group) group\n");</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> # find
out how many calls are allowed, match username to uuid column</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
if(avp_db_load("$avp(s:group)/uuid","$avp(s:sim_calls)")) {</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
xlog("L_INFO", "----- group $avp(s:group) can have max
$avp(s:sim_calls) calls\n");</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> #
check active calls</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
get_profile_size("caller","$avp(s:group)","$avp(s:cnt)");</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
xlog("L_INFO", "----- currently the group $avp(s:group) has
$avp(s:cnt) active outgoing calls\n");</p>
<p style="margin: 0px; font: 12px Times; min-height: 140px;" _mce_style="margin: 0px; font: 12px Times; min-height: 140px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> #
reject if there is more than $sim_calls active calls from this
user</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
if($avp(s:cnt) >= $avp(s:sim_calls)) {</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
sl_send_reply("486","Concurrency Limit Exceeded");</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
exit;</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> }
else {</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
# store dialog on the profile</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
set_dlg_profile("caller","$avp(s:group)");</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> }</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> } else
{</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
xlog("L_INFO", "----- group $avp(s:group) doesn't have
sim_calls limit\n");</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> }</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> } else {</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
xlog("L_INFO", "----- user $avp(s:username) doesn't belong to
any groups\n");</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> };</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">root@sip01:~#
opensipsctl fifo profile_get_values caller</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">value:: 80 count=2</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">root@sip01:~#
opensipsctl fifo profile_get_values carrierin</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">value:: 192.168.1.234
count=2</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">profile_list_dlgs:</p>
<p style="margin: 0px; font: 12px Times; min-height: 14px;" _mce_style="margin: 0px; font: 12px Times; min-height: 14px;"><br>
</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">opensipsctl fifo
profile_list_dlgs caller</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">dialog::
hash=57:1237628390</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> state:: 4</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> user_flags:: 0</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> timestart::
1299009653</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> timeout:: 1786844</p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> callid:: <a href="mailto:32d75fda0adefcc6454938161fa8f488@69.25.128.234" _mce_href="mailto:32d75fda0adefcc6454938161fa8f488@69.25.128.234"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">32d75fda0adefcc6454938161fa8f488@192.168.1.234</span></a></span></p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> from_uri:: <a href="mailto:sip%3A%2B16465222041@69.25.128.234" _mce_href="mailto:sip%3A%2B16465222041@69.25.128.234"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:+16465222041@192.168.1.234</span></a></span></p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> to_uri:: <a href="mailto:sip%3A%2B19194397540@72.15.219.141" _mce_href="mailto:sip%3A%2B19194397540@72.15.219.141"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:+18642227540@10.1.0.141</span></a></span></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> caller_tag::
as303e8090</p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> caller_contact::
<a href="mailto:sip%3A%2B16465222041@69.25.128.234" _mce_href="mailto:sip%3A%2B16465222041@69.25.128.234"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:+16465222041@192.168.1234</span></a></span></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> callee_cseq:: 102</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
caller_route_set:: </p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> caller_bind_addr::
udp:<a href="http://72.15.219.141:5060/" _mce_href="http://72.15.219.141:5060/"><span style="text-decoration: underline; color: rgb(20, 56,
231);" _mce_style="text-decoration: underline; color: #1438e7;">10.1.0.141:5060</span></a><div style="width:0px; height:0px;"> </div></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> callee_tag::
as6b251cdf</p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> callee_contact::
<a href="mailto:sip%3A9194397540@72.15.219.137" _mce_href="mailto:sip%3A9194397540@72.15.219.137"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:8642227540@10.1.0.137</span></a></span></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> caller_cseq:: 102</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
callee_route_set:: </p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> callee_bind_addr::
udp:<a href="http://72.15.219.141:5060/" _mce_href="http://72.15.219.141:5060/"><span style="text-decoration: underline; color: rgb(20, 56,
231);" _mce_style="text-decoration: underline; color: #1438e7;">10.1.0.141:5060</span></a><div style="width:0px; height:0px;"> </div></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">dialog::
hash=1234:1922532974</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> state:: 4</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> user_flags:: 0</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> timestart::
1299009708</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> timeout:: 1786898</p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> callid:: <a href="mailto:61e4b8a31839e0c311ed482c6453317a@69.25.128.234" _mce_href="mailto:61e4b8a31839e0c311ed482c6453317a@69.25.128.234"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">61e4b8a31839e0c311ed482c6453317a@192.168.1.234</span></a></span></p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> from_uri:: <a href="mailto:sip%3A%2B12127858470@69.25.128234" _mce_href="mailto:sip%3A%2B12127858470@69.25.128.234"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:+12127858470@192.168.1.234</span></a></span></p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> to_uri:: <a href="mailto:sip%3A%2B19194397540@7215.219.141" _mce_href="mailto:sip%3A%2B19194397540@7215.219.141"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:+18642227540@10.1.0.141</span></a></span></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> caller_tag::
as7c87f91d</p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> caller_contact::
<a href="mailto:sip%3A%2B12127858470@69.25.128.234" _mce_href="mailto:sip%3A%2B12127858470@69.25.128.234"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:+12127858470@192.168.1.234</span></a></span></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> callee_cseq:: 102</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
caller_route_set:: </p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> caller_bind_addr::
udp:<a href="http://72.15219.141:5060/" _mce_href="http://72.15.219.141:5060/"><span style="text-decoration: underline; color: rgb(20, 56,
231);" _mce_style="text-decoration: underline; color: #1438e7;">10.1.0.141:5060</span></a><div style="width:0px; height:0px;"> </div></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> callee_tag::
as7bd2b3e8</p>
<p style="margin: 0px; font: 12px Times; color: rgb(20, 56,
231);" _mce_style="margin: 0px; font: 12px Times; color: #1438e7;"><span style="color: rgb(0, 0, 0);" _mce_style="color: #000000;"> callee_contact::
<a href="mailto:sip%3A9194397540@72.15.219.137" _mce_href="mailto:sip%3A9194397540@72.15.219.137"><span style="text-decoration: underline;" _mce_style="text-decoration: underline;">sip:8642227540@10.1.0.137</span></a></span></p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> caller_cseq:: 102</p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;">
callee_route_set:: </p>
<p style="margin: 0px; font: 12px Times;" _mce_style="margin: 0px; font: 12px Times;"> callee_bind_addr::
udp:<a href="http://72.15.219.141:5060/" _mce_href="http://72.15.219.141:5060/"><span style="text-decoration: underline; color: rgb(20, 56,
231);" _mce_style="text-decoration: underline; color: #1438e7;">10.1.0.141:5060</span></a><div style="width:0px; height:0px;"> </div></p>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature">--
Bogdan-Andrei Iancu
OpenSIPS eBootcamp - 2nd of May 2011
OpenSIPS solutions and "know-how"</pre>
</div></blockquote></div></div></body></html>