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

Jason Penton jason.penton at smilecoms.com
Thu Nov 3 06:15:35 CET 2011


Hi Austin,

Have a look at the TM module docs. You will find the appropriate commands
there.

HTH
On Nov 3, 2011 3:01 AM, "Austin Einter" <austin.einter at gmail.com> wrote:

> Dear Andrew, Henning
> Thanks for sharing very useful information.
> I am bit new to kamailio, probably askingvery easy questions, please bear
> with me.
>
> I am not sure if I am forwording the INVITE statelessly or not.
> How do I check if INVITE is forwarded statelessly.
> Andrew you have mentioned 'So make sure that a transaction exists or
> create it
> explicitly using the tm module".
>
> Not sure, how do I check if transaction exists or not. And how can I
> create it.
>
> Please give me some pointers or a sample config file.
>
> Regards,
> Austin
>
>
> On Mon, Oct 31, 2011 at 4:37 PM, Andrew Pogrebennyk <
> apogrebennyk at sipwise.com> wrote:
>
>> Austin,
>> That is strange, because I am using similar setup successfully. Actually
>> I don't know if it counts the calls that are being established, I didn't
>> care for it.
>>
>> While looking through the docs:
>> http://kamailio.org/docs/modules/3.1.x/modules_k/dialog.html#id2524304
>>  the following note caught my eye:
>>
>> IMPORTANT: Users of this function should make sure that the dialog
>> created is further processed statefully. Specifically, if a stateless
>> response is sent out after dlg_manage() is called, the dialog cannot be
>> handled properly. So make sure that a transaction exists or create it
>> explicitly using the tm module. This is a shortcoming of the current
>> implementation that may be resolved in a future version hopefully.
>>
>> Could it be that you are forwarding the INVITE statelessly?
>> Regards,
>> Andrew
>>
>> On 10/30/2011 01:08 PM, Austin Einter wrote:
>> > 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
>> >
>>
>>
>>  _______________________________________________
>> 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
>>
>
>
> _______________________________________________
> 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/20111103/d8a52130/attachment-0001.htm>


More information about the sr-users mailing list