[OpenSIPS-Users] Value comparison issue
Michele Pinassi
michele.pinassi at unisi.it
Wed May 31 10:00:15 UTC 2023
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230531/d4bfd897/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x14FC37E53C24B98E.asc
Type: application/pgp-keys
Size: 7774 bytes
Desc: OpenPGP public key
URL: <http://lists.opensips.org/pipermail/users/attachments/20230531/d4bfd897/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.opensips.org/pipermail/users/attachments/20230531/d4bfd897/attachment.sig>
More information about the Users
mailing list