<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">max_chan is equal to zero? You should put a positive value in here in order to make sense the function call. </span><br><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
</span></div><div><font face="arial, sans-serif">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.</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Please take a look at the docs.</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 16, 2014 at 7:52 PM, Rahul MathuR <span dir="ltr"><<a href="mailto:rahul.ultimate@gmail.com" target="_blank">rahul.ultimate@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Further, from the logs it seems that cnxcc_set_max_channels is returning -1 and I have no idea why it is failing.</div>
<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Sat, May 17, 2014 at 5:48 AM, Rahul MathuR <span dir="ltr"><<a href="mailto:rahul.ultimate@gmail.com" target="_blank">rahul.ultimate@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Carlos,<div><br></div><div>Many thanks for your help.</div><div>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</div>


<div><br></div><div>request_route {        </div><div>setflag(DLG_FLAG);        </div><div># per request initial checks        </div><div>route(REQINIT);        </div><div># NAT detection        </div><div>route(NATDETECT);<br>


</div><div>.</div><div>.</div><div>.</div><div><br></div><div><div>        if (is_method("INVITE")) {</div><div>                route(CNXCC);</div><div>        }</div></div><div>}</div><div><br></div><div><div>

#Below lines added by Rahul for Concurrent Call Restriction</div>
<div>route[CNXCC]</div><div>{</div><div><br></div><div>        $var(client1)           = "x.y.z.a";</div><div><br></div><div>#!ifdef CNXCC_CHANNEL  </div><div>        xlog("L_INFO", "Setting up channel based credit control");</div>


<div><br></div><div>        $var(max_chan1) = 0;</div><div>        $var(retcode)   = cnxcc_set_max_channels("$var(client1)", "$var(max_chan)");</div><div><br></div><div>        if ($var(retcode) == -1) {</div>


<div>                xlog("Error setting up credit control");</div><div>                return;</div><div>        }</div><div><br></div><div>        $var(count1)     = -1;</div><div><br></div><div>        if (!cnxcc_get_channel_count("$rd", "$var(count1)")) {</div>


<div>                xlog("Error getting customer's channel count");</div><div>        }</div><div>        xlog("RAHUL : CNXCC ROUTE: $var(client) has $var(count) call(s)");</div><div>        xlog("L_INFO", "CNXCC ROUTE: $var(client) has $var(count) call(s)");</div>


<div><br></div><div>        if ($var(count1) == $var(max_chan1)) {</div><div>                xlog("Too many channels for customer");</div><div>                sl_send_reply(403, "Forbidden");</div><div>


<br></div><div>                #if (!cnxcc_terminate_all("$var(client)")) {</div><div>                #       xlog("Error terminating customer's calls");</div><div>                #}</div><div><br>


</div><div>                exit;</div><div>        }</div><div>#!endif</div></div><div><br></div><div><br></div><div>Could you please guide me where am I doing wrong ?</div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">
On Sat, May 17, 2014 at 3:01 AM, Carlos Ruiz Díaz <span dir="ltr"><<a href="mailto:carlos.ruizdiaz@gmail.com" target="_blank">carlos.ruizdiaz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">Any pseudo variable should work. <div><br></div><div>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.</div>



<div><br></div><div>Regards,</div><div>Carlos</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 16, 2014 at 4:28 PM, Rahul MathuR <span dir="ltr"><<a href="mailto:rahul.ultimate@gmail.com" target="_blank">rahul.ultimate@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you very much Carlos !<div><br></div><div>One last thing, can I use $fd in <span style="background-color:rgb(254,254,238);color:rgb(0,0,0)">cnxcc_set_max_channels as below - </span></div>



<div><span style="background-color:rgb(254,254,238);color:rgb(0,0,0)">cnxcc_set_max_channels("$fd", "$var(max_chan)");</span></div>
<div><span style="background-color:rgb(254,254,238);color:rgb(0,0,0)">to restrict the simultaneous calls hitting a particular domain ?</span></div><div><span style="background-color:rgb(254,254,238);color:rgb(0,0,0)"><br>




</span></div><div><span style="background-color:rgb(254,254,238);color:rgb(0,0,0)"><br></span></div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Sat, May 17, 2014 at 2:03 AM, Carlos Ruiz Díaz <span dir="ltr"><<a href="mailto:carlos.ruizdiaz@gmail.com" target="_blank">carlos.ruizdiaz@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Create a profile [1], and count the number of calls of that profile [2].<div><br></div><div>Alternatively, you can use cnxcc module [3].<br>




<div><br></div><div>[1] <a href="http://kamailio.org/docs/modules/stable/modules/dialog.html#idp1919576" target="_blank">http://kamailio.org/docs/modules/stable/modules/dialog.html#idp1919576</a><div>
[2] <a href="http://kamailio.org/docs/modules/stable/modules/dialog.html#idp1964064" target="_blank">http://kamailio.org/docs/modules/stable/modules/dialog.html#idp1964064</a><br></div></div></div><div>[3] <a href="http://kamailio.org/docs/modules/stable/modules/cnxcc.html#idp132608" target="_blank">http://kamailio.org/docs/modules/stable/modules/cnxcc.html#idp132608</a></div>





</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Fri, May 16, 2014 at 3:28 PM, Rahul MathuR <span dir="ltr"><<a href="mailto:rahul.ultimate@gmail.com" target="_blank">rahul.ultimate@gmail.com</a>></span> wrote:<br>





</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">
<i><font face="georgia, serif">Hello,</font></i></pre>
<pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="georgia, serif"><i>Please accept my apologies for asking a simple question - Is there any example which shows how can I create the dialog profile </i><i>value based on the SIP domain or SIP Server IP (IP like- 112.23.134.5). I</i><i> need to control many SIP Server IPs with limited channels to each with my</i><i> Kamailio Proxy.</i></font></pre>







<div><font face="georgia, serif"><i>I am a newbie to kamailio world.</i></font></div><span><font color="#888888"><span><font color="#888888"><div><font face="georgia, serif"><i><br></i></font></div><font face="georgia, serif"><i>-- <br>






Warm Regds.<br>MathuRahul</i></font><br>
</font></span></font></span></div>
</div><br><br>
</div>
<br></div></div>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Carlos<div><a href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div><div><a href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>





<div><a href="tel:%2B52%2055%203048%203303" value="+525530483303" target="_blank">+52 55 3048 3303</a></div></div>
</font></span></div>
<br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br></div></div>Warm Regds.<br>MathuRahul<br>
</div>
<br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Carlos<div><a href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div><div><a href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>



<div><a href="tel:%2B52%2055%203048%203303" value="+525530483303" target="_blank">+52 55 3048 3303</a></div></div>
</div>
</div></div><br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Warm Regds.<br>MathuRahul<br>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Warm Regds.<br>MathuRahul<br>
</font></span></div>
<br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Carlos<div><a href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div><div><a href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>
<div>+52 55 3048 3303</div></div>
</div>