$avp(s:sim_calls) = $(avp(s:sim_calls){s.int});
$avp(s:cnt) = $(avp(s:cnt){s.int});
if($avp(s:cnt) >= $avp(s:sim_calls)) {
On Apr 06, 2011, at 11:15 AM, Bogdan-Andrei Iancu <[email protected]> wrote:
Hi Logan,
what are the printed xlogs from your script ? interesting is to see the values for $avp(s:cnt) and $avp(s:sim_calls) .
Regards,
Bogdan
On 03/15/2011 04:15 PM, logan wrote: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?
Config Snips:
modparam("avpops", "avp_table", "usr_preferences")
modparam("avpops", "use_domain", 0)
modparam("avpops", "uuid_column", "uuid")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "attribute_column", "attribute")
modparam("avpops", "value_column", "value")
modparam("avpops", "type_column", "type")
loadmodule "dialog.so"
modparam("dialog", "dlg_flag", 4)
modparam("dialog", "db_mode", 1)
# TODO: rename profile "caller" to something more deliberate
modparam("dialog", "profiles_with_value", "caller;carrierin;carrierout")
# fetch group the user belongs to
avp_db_query("select grp from grp where username='$avp(s:username)'", "$avp(s:group)");
if(avp_check("$avp(s:group)","re/.*/g")) {
xlog("L_INFO", "----- user $avp(s:username) belongs to $avp(s:group) group\n");
# find out how many calls are allowed, match username to uuid column
if(avp_db_load("$avp(s:group)/uuid","$avp(s:sim_calls)")) {
xlog("L_INFO", "----- group $avp(s:group) can have max $avp(s:sim_calls) calls\n");
# check active calls
get_profile_size("caller","$avp(s:group)","$avp(s:cnt)");
xlog("L_INFO", "----- currently the group $avp(s:group) has $avp(s:cnt) active outgoing calls\n");
# reject if there is more than $sim_calls active calls from this user
if($avp(s:cnt) >= $avp(s:sim_calls)) {
sl_send_reply("486","Concurrency Limit Exceeded");
exit;
} else {
# store dialog on the profile
set_dlg_profile("caller","$avp(s:group)");
}
} else {
xlog("L_INFO", "----- group $avp(s:group) doesn't have sim_calls limit\n");
}
} else {
xlog("L_INFO", "----- user $avp(s:username) doesn't belong to any groups\n");
};
root@sip01:~# opensipsctl fifo profile_get_values caller
value:: 80 count=2
root@sip01:~# opensipsctl fifo profile_get_values carrierin
value:: 192.168.1.234 count=2
profile_list_dlgs:
opensipsctl fifo profile_list_dlgs caller
dialog:: hash=57:1237628390
state:: 4
user_flags:: 0
timestart:: 1299009653
timeout:: 1786844
callid:: [email protected]
from_uri:: sip:[email protected]
to_uri:: sip:[email protected]
caller_tag:: as303e8090
caller_contact:: sip:[email protected]
callee_cseq:: 102
caller_route_set::
caller_bind_addr:: udp:10.1.0.141:5060
callee_tag:: as6b251cdf
callee_contact:: sip:[email protected]
caller_cseq:: 102
callee_route_set::
callee_bind_addr:: udp:10.1.0.141:5060
dialog:: hash=1234:1922532974
state:: 4
user_flags:: 0
timestart:: 1299009708
timeout:: 1786898
callid:: [email protected]
from_uri:: sip:[email protected]
to_uri:: sip:[email protected]
caller_tag:: as7c87f91d
caller_contact:: sip:[email protected]
callee_cseq:: 102
caller_route_set::
caller_bind_addr:: udp:10.1.0.141:5060
callee_tag:: as7bd2b3e8
callee_contact:: sip:[email protected]
caller_cseq:: 102
callee_route_set::
callee_bind_addr:: udp:10.1.0.141:5060
-- Bogdan-Andrei Iancu OpenSIPS eBootcamp - 2nd of May 2011 OpenSIPS solutions and "know-how"
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
