[sr-dev] Fwd: Create multiple profiles using dialog module

Carlos Ruiz Díaz carlos.ruizdiaz at gmail.com
Fri Jun 6 06:04:18 CEST 2014


Hi Rahul,

sorry, I couldn't find time to do it. I will take a look tomorrow, or most
possibly during the weekend.

Regards,
Carlos


On Thu, Jun 5, 2014 at 8:28 PM, Rahul MathuR <rahul.ultimate at gmail.com>
wrote:

> Hello Carlos,
>
> Did you get a chance to look at the attached configuration file ?
>
>
> Warm Regds,
> Rahul Mathur
>
>
> On Thu, Jun 5, 2014 at 2:46 PM, Rahul MathuR <rahul.ultimate at gmail.com>
> wrote:
>
>> Hi Carlos,
>>
>> Please find attached the configuration file which I am using.
>> Kindly refer route[CNXCC] where I have tried to put the channel
>> limitation per SIP Server.
>>
>>
>> Thanks !
>>
>>
>> On Wed, Jun 4, 2014 at 3:07 PM, Carlos Ruiz Díaz <
>> carlos.ruizdiaz at gmail.com> wrote:
>>
>>> Can you share your configuration file?
>>>
>>>
>>> On Wed, Jun 4, 2014 at 1:03 AM, Rahul MathuR <rahul.ultimate at gmail.com>
>>> wrote:
>>>
>>>> HI Carlos,
>>>>
>>>> Thanks for reply.
>>>>
>>>> In my case the key is SIP Server IP. My kamailio Proxy is connected to
>>>> many sip server IPs say 5. I want to limit maximum channels per sip server
>>>> ip. So I set max channels per sip server ip as
>>>> cnxcc_set_max_channels("$var(client1)", "$var(max_chan)"); and my
>>>> $var(client1) = "10.97.116.36"; is one of 5 sip servers connected to
>>>> Kamalio.
>>>>
>>>> Now I use your cnxcc_get_channel_count("$rd", "$var(count1)"))
>>>> value(count1) to compare to the max_limit of the channels allowed for this
>>>> sip server. Psuedo Variable $rd is coming correctly that is same as sips
>>>> erver IP[$var(client1)].
>>>> But the problem is that cnxcc_get_channel_count("$rd",
>>>> "$var(count1)"))  is always setting the value 1 in $var(count1) variable
>>>> even though there are more calls runnning than what was set to be max_chan
>>>> (which was 100 in my case).
>>>>
>>>> Any pointers to achieve this matter ?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Jun 3, 2014 at 2:18 PM, Carlos Ruiz Díaz <
>>>> carlos.ruizdiaz at gmail.com> wrote:
>>>>
>>>>> Hi Rahul,
>>>>>
>>>>> I don't understand your example. In that case, you are always using "10.97.116.36"
>>>>> as key, meaning that all calls will be hanging from same root.
>>>>>
>>>>> If you want to use the request-uri domain part, use $rd, not the full
>>>>> $ru. This will of course lead to 1 call being reported always, since
>>>>> request-URIs tend to be different from each other.
>>>>>
>>>>> Regards,
>>>>> Carlos
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jun 3, 2014 at 7:01 AM, Rahul MathuR <rahul.ultimate at gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Hi Carlos,
>>>>>>
>>>>>> Sorry for coming late on this one.
>>>>>>
>>>>>> the ruri value in my example is '10.97.116.36'
>>>>>> and i have tried to configure kamailio to only cater 100 simultaneous
>>>>>> calls on this SIP Server (10.97.116.36), after that it is to send 403.
>>>>>>
>>>>>> Below is the sample logic from kamailio.cfg
>>>>>>
>>>>>> ***********************************************************************************************************************
>>>>>>   #Below lines to show an example of how I am maintaining the
>>>>>> business for Concurrent Call Restriction
>>>>>>   route[CNXCC]
>>>>>>   {
>>>>>>
>>>>>>           $var(client1)           = "10.97.116.36";
>>>>>>    $var(max_chan)   = 100;
>>>>>>   #!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(client1) has $var(count1)
>>>>>> call(s)");
>>>>>>           xlog("L_INFO", "CNXCC ROUTE: $var(client1) has
>>>>>> $var(count1)  call(s)");
>>>>>>
>>>>>>
>>>>>>           if ($var(count1) == $var(max_chan1)) {
>>>>>>                   xlog("Too many channels for customer");
>>>>>>                   sl_send_reply(403, "Forbidden");
>>>>>>
>>>>>>                    exit;
>>>>>>           }
>>>>>>   #!endif
>>>>>>
>>>>>> ******************************************************************************************************************************************************
>>>>>>
>>>>>> Now the problem that I am facing is that with multiple UACs (all with
>>>>>> same ruri - 10.97.116.36) dialing some pstn numbers, the value of "count1"
>>>>>> remains 1 for all cases. Hence, my purpose is defeated because the
>>>>>> restriction is not being laid and more than 'max_chan' no. of callers are
>>>>>> able to make the call.
>>>>>>
>>>>>> Could you please help me achieve this goal.
>>>>>>
>>>>>> Thanks !
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sat, May 17, 2014 at 2:22 AM, Carlos Ruiz Díaz <
>>>>>> carlos.ruizdiaz at gmail.com> wrote:
>>>>>>
>>>>>>> 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at lists.sip-router.org
>>>>>>>>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Warm Regds.
>>>>>>>>>>> MathuRahul
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> sr-dev mailing list
>>>>>>>>>>> sr-dev at 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 at 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 at 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 at lists.sip-router.org
>>>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Warm Regds.
>>>>>> MathuRahul
>>>>>>
>>>>>> _______________________________________________
>>>>>> sr-dev mailing list
>>>>>> sr-dev at 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 at lists.sip-router.org
>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Warm Regds.
>>>> MathuRahul
>>>>
>>>> _______________________________________________
>>>> sr-dev mailing list
>>>> sr-dev at 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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20140605/d784ec85/attachment-0001.html>


More information about the sr-dev mailing list