max_chan is equal to zero? You should put a
positive value in here in
order to make sense the function call.
Also, you are using for one call the ID "x.y.z.a", and for the other one
$rd. Both should be the same for calls that suppose to be organized in the
same group.
Please take a look at the docs.
On Fri, May 16, 2014 at 7:52 PM, Rahul MathuR <rahul.ultimate(a)gmail.com>
wrote:
Further, from the logs it seems that
cnxcc_set_max_channels is
returning -1 and I have no idea why it is failing.
On Sat, May 17, 2014 at 5:48 AM, Rahul MathuR <rahul.ultimate(a)gmail.com
> wrote:
> Hello Carlos,
>
> Many thanks for your help.
> I followed the steps you mentioned for CNXCC. But even after making
> the max. calls to 0, I am still able to connect the call. Below is the
> excerpt from kamailio.cfg
>
> request_route {
> setflag(DLG_FLAG);
> # per request initial checks
> route(REQINIT);
> # NAT detection
> route(NATDETECT);
> .
> .
> .
>
> if (is_method("INVITE")) {
> route(CNXCC);
> }
> }
>
> #Below lines added by Rahul for Concurrent Call Restriction
> route[CNXCC]
> {
>
> $var(client1) = "x.y.z.a";
>
> #!ifdef CNXCC_CHANNEL
> xlog("L_INFO", "Setting up channel based credit
control");
>
> $var(max_chan1) = 0;
> $var(retcode) = cnxcc_set_max_channels("$var(client1)",
> "$var(max_chan)");
>
> if ($var(retcode) == -1) {
> xlog("Error setting up credit control");
> return;
> }
>
> $var(count1) = -1;
>
> if (!cnxcc_get_channel_count("$rd", "$var(count1)")) {
> xlog("Error getting customer's channel count");
> }
> xlog("RAHUL : CNXCC ROUTE: $var(client) has $var(count)
> call(s)");
> xlog("L_INFO", "CNXCC ROUTE: $var(client) has $var(count)
> call(s)");
>
> if ($var(count1) == $var(max_chan1)) {
> xlog("Too many channels for customer");
> sl_send_reply(403, "Forbidden");
>
> #if (!cnxcc_terminate_all("$var(client)")) {
> # xlog("Error terminating customer's calls");
> #}
>
> exit;
> }
> #!endif
>
>
> Could you please guide me where am I doing wrong ?
>
>
> On Sat, May 17, 2014 at 3:01 AM, Carlos Ruiz Díaz <
> carlos.ruizdiaz(a)gmail.com> wrote:
>
>> Any pseudo variable should work.
>>
>> I don't exactly know how your business work, but I'd suggest that
>> instead of using from header domain, use the domain part of the
>> request-uri, $rd.
>>
>> Regards,
>> Carlos
>>
>>
>> On Fri, May 16, 2014 at 4:28 PM, Rahul MathuR <
>> rahul.ultimate(a)gmail.com> wrote:
>>
>>> Thank you very much Carlos !
>>>
>>> One last thing, can I use $fd in cnxcc_set_max_channels as below -
>>> cnxcc_set_max_channels("$fd", "$var(max_chan)");
>>> to restrict the simultaneous calls hitting a particular domain ?
>>>
>>>
>>>
>>>
>>> On Sat, May 17, 2014 at 2:03 AM, Carlos Ruiz Díaz <
>>> carlos.ruizdiaz(a)gmail.com> wrote:
>>>
>>>> Create a profile [1], and count the number of calls of that profile
>>>> [2].
>>>>
>>>> Alternatively, you can use cnxcc module [3].
>>>>
>>>> [1]
>>>>
http://kamailio.org/docs/modules/stable/modules/dialog.html#idp1919576
>>>> [2]
>>>>
http://kamailio.org/docs/modules/stable/modules/dialog.html#idp1964064
>>>> [3]
>>>>
http://kamailio.org/docs/modules/stable/modules/cnxcc.html#idp132608
>>>>
>>>>
>>>> On Fri, May 16, 2014 at 3:28 PM, Rahul MathuR <
>>>> rahul.ultimate(a)gmail.com> wrote:
>>>>
>>>>> *Hello,*
>>>>>
>>>>> *Please accept my apologies for asking a simple question - Is there
any example which shows how can I create the dialog profile **value based on the SIP
domain or SIP Server IP (IP like- 112.23.134.5). I** need to control many SIP Server IPs
with limited channels to each with my** Kamailio Proxy.*
>>>>>
>>>>> *I am a newbie to kamailio world.*
>>>>>
>>>>>
>>>>>
>>>>> *-- Warm Regds.MathuRahul*
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> sr-dev mailing list
>>>>> sr-dev(a)lists.sip-router.org
>>>>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Carlos
>>>>
http://caruizdiaz.com
>>>>
http://ngvoice.com
>>>> +52 55 3048 3303
>>>>
>>>> _______________________________________________
>>>> sr-dev mailing list
>>>> sr-dev(a)lists.sip-router.org
>>>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Warm Regds.
>>> MathuRahul
>>>
>>> _______________________________________________
>>> sr-dev mailing list
>>> sr-dev(a)lists.sip-router.org
>>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>
>>>
>>
>>
>> --
>> Carlos
>>
http://caruizdiaz.com
>>
http://ngvoice.com
>> +52 55 3048 3303
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev(a)lists.sip-router.org
>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>
>>
>
>
> --
> Warm Regds.
> MathuRahul
>
--
Warm Regds.
MathuRahul
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
+52 55 3048 3303
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org