Ok, I expanded on that example and got this working; for the most part. What is the best way to get that MAX_NUMBER_OF_CALLS to be a value that is set per subscriber? Or keep my quota table and just pull the value from there?
modparam("dialog", "profiles_with_value", "callquota") . . . if (is_method("INVITE")) { $var(SIZE) = 0; get_profile_size("callquota", "$rU", "$var(SIZE)"); if( $var(SIZE) >= MAX_NUMBER_OF_CALLS ){ sl_send_reply("503", "Simultaneous calls limit reached"); exit; } set_dlg_profile("callquota","$rU"); if (get_profile_size("callquota","$var(SIZE)")) { xlog("DEBUG: there are $var(SIZE) total calls for $rU\n"); } On 9/30/11 8:36 PM, "Graham Wooden" <gra...@g-rock.net> wrote: > I agree - I actually tried to use the dialog module, taken from an mailist > post back from Aug 2009, > > http://www.mail-archive.com/users@lists.kamailio.org/msg04127.html > > But ran into issues implementing it. With that, I will focus back on that. > > Thanks Alex, > > -graham > > > On 9/30/11 8:26 PM, "Alex Balashov" <abalas...@evaristesys.com> wrote: > >> You really, really, really want to use the "dialog" module to simplify and >> automate this. >> >> -- >> This message was painstakingly thumbed out on my mobile, so apologies for >> brevity, errors, and general sloppiness. >> >> Alex Balashov - Principal >> Evariste Systems LLC >> 260 Peachtree Street NW >> Suite 2200 >> Atlanta, GA 30303 >> Tel: +1-678-954-0670 >> Fax: +1-404-961-1892 >> Web: http://www.evaristesys.com/ >> >> On Sep 30, 2011, at 9:08 PM, Graham Wooden <gra...@g-rock.net> wrote: >> >>> Hi there, >>> >>> Finally getting around to introducing some call limits and starting with the >>> inbound calls. However, I ran into an issue about how to get the "in use" >>> count to be updated in my quota table. >>> >>> What is the best way to get s:in_use to update so it can be calculated? >>> Here is my snippet of code: >>> >>> if (is_method("INVITE")) { >>> avp_db_query("select quota, in_use from quota where >>> username='$rU'","$avp(s:quota);$avp(s:in_use)"); >>> >>> if ($avp(s:in_use) >= $avp(s:quota)){ >>> xlog ("DEBUG: Trunk $rU is over quota"); >>> sl_send_reply("503","User over quota"); >>> } >>> . >>> . >>> } >>> >>> >>> This opens up two more questions: How to decrease the call count when a BYE >>> is received - maybe do a subtraction and the do a avp_db_query to update the >>> table? >>> >>> And of course there is the BYE that won't be present (ie. When a call just >>> rings and hangs up before it gets answered). Maybe ACC's missed_calls can >>> somewhat be used to help determine? >>> >>> Thanks for any pointers and guidance. I am running Kamailio 1.5. >>> >>> Thanks, >>> >>> -graham >>> >>> >>> >>> _______________________________________________ >>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list >>> sr-users@lists.sip-router.org >>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users >> >> _______________________________________________ >> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list >> sr-users@lists.sip-router.org >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users