Hi all,I am writing to you again after a long time for a strange issue in my Opensips 1.11 routing logic.
I have implemented a per-user call limit and i have to compare current call value with max calls allowed:
main() {
...
if (is_method("INVITE")) {
if (!create_dialog()) {
send_reply("500","Internal Server Error");
exit;
}
set_dlg_profile("call", "$rU"); # caller
set_dlg_profile("call", "$fU"); # called
get_profile_size("call", "$rU", "$var(calls)"); # What's the call
limit for $rU?
## <-- CONCURRENT CALLS LIMIT BASED ON DESTINATION
if(avp_db_load("$ru/username","$avp(maxcalls)")) {
if($var(calls)>$avp(maxcalls)) {
xlog("L_INFO","$ci - User $rU has $var(calls) calls (max
$avp(maxcalls) calls): BUSY\n");
sl_send_reply("486", "Busy: try later");
exit;
} else {
xlog("L_INFO","$ci - User $rU has $var(calls) calls (max
$avp(maxcalls) calls): ALLOW\n");
}
} else {
xlog("L_INFO","$ci - User $rU has $var(calls) calls. NO LIMIT
HERE\n");
}
# -->
...
Seems that there's a problem with "if($var(calls)>$avp(maxcalls))"
because in logs i got:
User XXXX has 2 calls (max 10 calls): BUSY ... User XXXX has 1 calls (max 10 calls): ALLOW Any hints or suggestion? Thanks for your help. -- Michele Pinassi Università degli Studi di Siena
OpenPGP_0x14FC37E53C24B98E.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
