[SR-Users] How to limit number of calls in Kamailio proxy

Austin Einter austin.einter at gmail.com
Sun Oct 30 12:08:45 CET 2011


Thanks Andrew
I added profile_with_value module parameter and with that I am able to
overcome this error.

My code looks as below.

        dlg_manage();
        if (is_method("INVITE")) {
                 if (!has_totag()) {
                        #$var(SIZE) = 0;
                        get_profile_size("caller", "$fu", "$var(SIZE)");
                        xlog("Number of calls present now is
$var(SIZE)\n");
                        if( $var(SIZE) > MAX_NUMBER_OF_CALLS ) {
                                sl_send_reply("503", "Simultaneous calls
limit reached");
                                xlog("Rejected calls with 503 Simultaneous
calls limit reached\n");
                                exit;
                        }
                        else {
                                 xlog("Allowed call. Looks max calls limit
not reached. Calls= $var(SIZE)\n");
                        }
                        set_dlg_profile("caller","$fu");
                }
        }
Whole purpose is to limit number of active calls at any point of time.
$var(SIZE) gives the number of calls are being established, but not the
number of calls are already established.

So if I am making multiple calls at  a point of time, it is blocking call
attempts beyond limit. But after all call setup complete, again $var(SIZE)
becomes zero and allows new calls.


Has anybody done this (limiting number of calls at any point of time). If
so can you please share the configuration file changes.


To get $var(SIZE) working properly, do I need to enable MySql, please
advice.

Regards
Austin



On Sun, Oct 30, 2011 at 12:28 PM, Andrew Pogrebennyk <
apogrebennyk at sipwise.com> wrote:

> On 10/30/2011 06:00 AM, Austin Einter wrote:
> > When I run kamailio, I get below error.
> >
> >  0(4925) CRITICAL: dialog [dialog.c:297]: profile <caller> not definited
> > [...]
> > Any idea why this error comes and how to fix it.
>
> You should really define profile caller by putting it into
> profiles_with_value module parameter:
> http://kamailio.org/docs/modules/3.1.x/modules_k/dialog.html#id2523534
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20111030/a5c0d776/attachment.htm>


More information about the sr-users mailing list