[SR-Users] Handling quota/call limits - kamailio 1.5

Alex Balashov abalashov at evaristesys.com
Sat Oct 1 03:26:00 CEST 2011


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 <graham at 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 at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list