Hi all, Opensips 1.11 here. I've tried implementing max concurrent calls limitation for some of our users, inspired by tutorial found at https://www.opensips.org/Documentation/Tutorials-ConcurrentCallsLimitation and using AVP to set per-account calls limit.
In table usr_preferences i've a row like: id uuid username domain attribute type value 1298 6911 voip.xxxx.it maxcalls 0 1 and on dialplan i've: #### AVP module loadmodule "avpops.so" modparam("avpops","db_url","mysql://voip:7PDzZ2ADNxZzmzfA@192.168.1.1/opensips") modparam("avpops","avp_table","usr_preferences") modparam("avpops","uuid_column", "uuid") modparam("avpops","use_domain",0) modparam("avpops","domain_column","domain") modparam("avpops","attribute_column","attribute") modparam("avpops","value_column","value") modparam("avpops","type_column","type") ... route() { [...] if (is_method("INVITE")) { set_dlg_profile("caller", "$ru"); get_profile_size("caller", "$ru", "$var(size)"); ## <-- CONCURRENT CALLS LIMIT BASED ON DESTINATION if(avp_db_load("$ru/username","$avp(maxcalls)")) { if($var(size) > $avp(maxcalls)) { xlog("L_INFO","$ci - User $rU has $var(size) calls (max $avp(maxcalls) calls): BUSY\n"); sl_send_reply("486", "Busy: try later"); exit; } else { xlog("L_INFO","$ci - User $rU has $var(size) calls (max $avp(maxcalls) calls): ALLOW\n"); } } [...] } This way seems to work perfectly except when calls come from our mediagateways, that append port to signals, like (captured with sngrep): INVITE 333xxxx@172.20.1.4:506 5...@voip.xxxx.it:5060 28 172.20.1.4:5060 193.xxxxxxx:5060 REJECTED 28ad94e804782466 0:10 INVITE 5...@voip.xxxx.it 5...@voip.xxx.it 20 193.205.4.182:5060 193.xxxxxxx:5060 CANCELLED 455244b218fec81c1f90036f3890a...@voip.xxx.it 0:05 INVITE 3527@172.20.1.4:5060 2...@voip.xxx.it:5060 20 172.20.1.4:5060 193.xxxxxxx:5060 COMPLETED 7758dace18b36325 I suppose, but maybe i'm wrong, that the problem is the domain part of the RURI that were not correctly matched in dialog profile. Any hint or help kindly appreciated -- Michele Pinassi - Responsabile Cybersecurity Università di Siena Ufficio Esercizio e Tecnologie - CSIRT i...@unisi.it
_______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users