<div dir="ltr">Hi Andrzej,<div><br></div><div>are you trying to setup cnxcc to check both credit and maximum simultaneous calls?</div><div><br></div><div>Regards,</div><div><br></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Sat, Apr 26, 2014 at 9:26 AM, Andrzej Ciupek <span dir="ltr"><<a href="mailto:andrzej.ciupek@hotmail.com" target="_blank">andrzej.ciupek@hotmail.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">
<div dir="ltr" style="font-family:'Calibri','Segoe UI','Meiryo','Microsoft YaHei UI','Microsoft JhengHei UI','Malgun Gothic','sans-serif';font-size:12pt"><div>Hello</div>
<div><br></div><div>I’am using default config with options from an example. It looks like event route isn’t execuded after hangup.</div><div><br></div><div>Apr 26 16:26:14 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>
Apr 26 16:26:15 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>Apr 26 16:26:16 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>Apr 26 16:26:17 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>
Apr 26 16:26:18 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>Apr 26 16:26:19 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>Apr 26 16:26:20 kamailio /usr/local/sbin/kamailio[4611]: INFO: <script>: 1000 has 1 call(s)<br>
Apr 26 16:26:20 kamailio /usr/local/sbin/kamailio[4604]: INFO: <script>: Setting up money based credit control<br>Apr 26 16:26:20 kamailio /usr/local/sbin/kamailio[4604]: INFO: <script>: Setting up channel based credit control<br>
Apr 26 16:26:20 kamailio /usr/local/sbin/kamailio[4604]: INFO: <script>: CNXCC ROUTE: 1000 has 2 call(s)<br></div><div><br></div><div>kamailio.cfg</div><div>…</div><div>…</div><div># ----- prepaid call controll -----</div>
<div class=""><div><br></div><div>#!define DLG_FLAG 28<br>#!define CC_FLAG 29</div><div><br></div></div><div>loadmodule "dialog.so"<div class=""><br>modparam("dialog", "hash_size", 2048)<br>modparam("dialog", "default_timeout", 3600)<br>
modparam("dialog", "db_mode", 0)<br>modparam("dialog", "dlg_flag", DLG_FLAG)</div></div><div><br></div><div>modparam("rtimer", "timer", "name=ta;interval=1;mode=1;")<br>
modparam("rtimer", "exec", "timer=ta;route=SHOW_CHANNEL_COUNT")</div><div><br></div><div>loadmodule "cnxcc.so"<div class=""><br>modparam("cnxcc", "dlg_flag", CC_FLAG)<br>
modparam("cnxcc", "credit_check_period", 1) #check every 1 second<br></div></div><div><br></div><div>…</div><div>…</div><div>…</div><div>route {</div><div>…</div><div>…</div><div> if (!allow_source_address("2") and !allow_source_address("1")){<br>
        route(CNXCC);<br>        route(PSTN);<br>        }<br></div><div>…</div><div>}<br></div><div><div><br></div><div>route[CNXCC]<br>{</div><div><br></div><div>        $var(client)            = "1000";</div>
<div class=""><div><br></div><div>        xlog("L_INFO", "Setting up money based credit control");</div><div><br></div><div>        $var(credit)            = "10"; # 10$ of credit<br>        $var(cost_per_sec)      = "1";  # 1$ per sec<br>
        $var(i_pulse)           = "1";  # 1$ to establish the call<br>        $var(f_pulse)           = "1";  # 1$ per second</div><div><br></div><div>        # if only one call is established, that call should last 9 seconds.</div>
<div><br></div><div>        if (!cnxcc_set_max_credit("$var(client)",<br>                                  "$var(credit)",<br>                                  "$var(cost_per_sec)",<br>                                  "$var(i_pulse)",<br>
                                  "$var(f_pulse)")) {<br>                xlog("Error setting up credit control");<br>                return;<br>        }<br></div></div><div>        $var(count)     = -1;</div>
<div><br></div><div>        if (!cnxcc_get_channel_count("$var(client)", "$var(count)")) {<br>                xlog("Error getting customer's channel count");<br>        }</div><div><br></div>
<div>        xlog("L_INFO", "CNXCC ROUTE: $var(client) has $var(count) call(s)");</div><div><br></div><div>        if ($var(retcode) < -1) {<br>                xlog("Too many channels for customer");<br>
                sl_send_reply(403, "Forbidden");</div><div><br></div><div>                if (!cnxcc_terminate_all("$var(client)")) {<br>                        xlog("Error terminating customer's calls");<br>
                } else {<br>                        xlog("Terminating customer's call");<br>                }</div><div><br></div><div>                exit;<br>        }<br>}</div><div><br></div><div>route[SHOW_CHANNEL_COUNT]<br>
{<br>        $var(count) = @cnxcc.channels["1000"].count;<br>        xlog("L_INFO", "1000 has $var(count) call(s)");<br>}</div><div><br></div><div>event_route[dialog:failed]<br>{<br>        xlog("dialog failed");<br>
}</div><div><br></div><div>event_route[cnxcc:call-shutdown]<br>{<br>        xlog("L_INFO", "Shutting down channel by callcontroll");<br>        xlog("L_INFO", "[$ci]: call killed");<br>
        $var(count)     = $var(count)-1;<br>        if (!cnxcc_get_channel_count("$var(client)", "$var(count)")) {<br>                xlog("Error getting customer's channel count");<br>        }<br>
        xlog("L_INFO", "CNXCC ROUTE: $var(client) has $var(count) call(s)");<br>        # perform some kind of notification, database update, email sending, etc<br>}<br></div><div><br></div><div>Greetings</div>
<div>Andrzej Ciupek</div><div><br></div></div><div style="padding-top:5px;border-top-color:rgb(229,229,229);border-top-width:1px;border-top-style:solid"><div><font face=" 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif'" style="line-height:15pt;letter-spacing:0.02em;font-family:"Calibri","Segoe UI","Meiryo","Microsoft YaHei UI","Microsoft JhengHei UI","Malgun Gothic","sans-serif";font-size:12pt"><b>Od:</b> <a href="mailto:carlos.ruizdiaz@gmail.com" target="_blank">Carlos Ruiz Díaz</a><br>
<b>Wysłano:</b> ‎sobota‎, ‎26‎ ‎kwietnia‎ ‎2014 ‎15‎:‎19<br><b>Do:</b> <a href="mailto:sr-users@lists.sip-router.org" target="_blank">Kamailio (SER) - Users Mailing List</a>, <a href="mailto:andrzej.ciupek@hotmail.com" target="_blank">Andrzej Ciupek</a></font></div>
</div><div><div class="h5"><div><br></div><div dir=""><div dir="ltr">Hi,<div><br></div><div>sorry guys, I forgot about this. I will make my own tests and post the results.</div><div><br></div><div>Andrzej, can you post the configuration file you are using?</div>
<div><br></div>
<div>Regards,</div><div>Carlos</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 26, 2014 at 4:15 AM, Kelvin Chua <span dir="ltr"><<a href="mailto:kelchy@gmail.com" target="_blank">kelchy@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><p dir="ltr">No, I have not yet found the solution for this issue on my setup.</p>

<p dir="ltr">Maybe Carlos can help us out</p>
<div class="gmail_quote">On Apr 26, 2014 5:10 PM, "Andrzej Ciupek" <<a href="mailto:andrzej.ciupek@hotmail.com" target="_blank">andrzej.ciupek@hotmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">



<div dir="ltr">
<div dir="ltr">
<div style="font-family:"Calibri";font-size:12pt">
<div>Hello</div>
<div> </div>
<div>Have You solved this issue ?</div>
<div>I’am using Kamailio 4.1.3 and I’am getting the same results. </div>
<div> </div>
<div>Greetings</div>
<div>Andrzej Ciupek</div></div></div></div>
</blockquote></div>
<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</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></div></div>
</div>

</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>