Hi Rahul,
/if($var(client1)!="null") /should be /if($var(client1)!="$null")/
even in the last IF, the double-quotes have to be removed around "$null"
-- just compare with $null, because doublequotes there enforces a static
string.
Cheers,
Daniel
/. /You are doing a string comparison with the string
value "/null/".
Also make sure the dialog matching is correct: append these event
routes to your config file:
/event_route[dialog:start] {/
/Â Â Â Â xlog("Dialog started");/
/}/
/
/
/event_route[dialog:end] {/
/Â Â Â Â xlog("Dialog ended");/
/}/
/
/
/event_route[dialog:failed] {/
/Â Â Â Â xlog("Dialog failed");/
/}/
You should see a "dialog started" and "dialog ended" for every
successful call.
Please do those modifications and see what happens.
Regards,
CarlosÂ
On Mon, Jun 9, 2014 at 6:55 AM, Rahul MathuR <rahul.ultimate(a)gmail.com
<mailto:rahul.ultimate@gmail.com>> wrote:
Hello Carlos,
Â
Were you able to look at my configuration file ?
Â
Â
Thanks !
On Fri, Jun 6, 2014 at 5:04 AM, Carlos Ruiz DÃaz
<carlos.ruizdiaz(a)gmail.com <mailto:carlos.ruizdiaz@gmail.com>> wrote:
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(a)gmail.com <mailto:rahul.ultimate@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(a)gmail.com
<mailto:rahul.ultimate@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(a)gmail.com
<mailto:carlos.ruizdiaz@gmail.com>> wrote:
Can you share your configuration file?
On Wed, Jun 4, 2014 at 1:03 AM, Rahul MathuR
<rahul.ultimate(a)gmail.com
<mailto:rahul.ultimate@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(a)gmail.com
<mailto:carlos.ruizdiaz@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(a)gmail.com
<mailto:rahul.ultimate@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(a)gmail.com
<mailto:carlos.ruizdiaz@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(a)gmail.com
<mailto:rahul.ultimate@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
<mailto:rahul.ultimate@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
<mailto:carlos.ruizdiaz@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
<mailto:rahul.ultimate@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
<mailto:carlos.ruizdiaz@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
<mailto:rahul.ultimate@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
<mailto:sr-dev@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
<tel:%2B52%2055%203048%203303>
_______________________________________________
sr-dev mailing
list
sr-dev(a)lists.sip-router.org
<mailto:sr-dev@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
<mailto:sr-dev@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
<tel:%2B52%2055%203048%203303>
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
<mailto:sr-dev@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
<mailto:sr-dev@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
<tel:%2B52%2055%203048%203303>
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
<mailto:sr-dev@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
<mailto:sr-dev@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
<tel:%2B52%2055%203048%203303>
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
<mailto:sr-dev@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
<mailto:sr-dev@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 <tel:%2B52%2055%203048%203303>
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
<mailto:sr-dev@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
<mailto:sr-dev@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 <tel:%2B52%2055%203048%203303>
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org <mailto:sr-dev@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 <mailto:sr-dev@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