<div dir="ltr">Input Please<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><br><br>Thanks & Kind Regards,<br></div><b>Logeshwaran G</b><br><br></div><div><b>"Be Hungry, Stay Foolish"</b><br></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Sep 5, 2017 at 2:07 PM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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"><div><div>Hi ,<br><br></div>I have tried the Cnxcc to deduct the credit amount and its working fine. Please find the below logs in kamailio -ddd mode.<br><br>10(19003) DEBUG: cnxcc [cnxcc_check.c:85]: check_calls_by_money(): CID [<wbr>4vL4DJsLpRSfwoMaJVbegWBLWy7k7-<wbr>UP], start_timestamp [1504598301], seconds alive [36], consumed credit [20.000000]<br>10(19003) DEBUG: cnxcc [cnxcc_check.c:107]: check_calls_by_money(): Client [8888] | Ended-Calls-Credit-Spent: 0.000000  TotalCredit/MaxCredit: 20.000000/30.000000<br>10(19003) DEBUG: cnxcc [cnxcc_check.c:85]: check_calls_by_money(): CID [<wbr>4vL4DJsLpRSfwoMaJVbegWBLWy7k7-<wbr>UP], start_timestamp [1504598301], seconds alive [37], consumed credit [20.000000]<br>10(19003) DEBUG: cnxcc [cnxcc_check.c:107]: check_calls_by_money(): Client [8888] | Ended-Calls-Credit-Spent: 0.000000  TotalCredit/MaxCredit: 20.000000/30.000000<br><br><br></div>But Through Sql query how can I get the Deducted Value.. For Example in my case, in the above kamailio log, Total Credit Spent is 20.00, Where this values are storing in Database. Please Guide me<br></div><div class="gmail_extra"><span class=""><br clear="all"><div><div class="m_7034930307112552171gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br></span><div><div class="h5"><div class="gmail_quote">On Wed, Aug 30, 2017 at 2:12 PM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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"><div><div>Ok let me try it out!<br><br></div>Will add the sqlops query module in the event route!<br><br></div>Thanks<br></div><div class="gmail_extra"><span><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br></span><div><div class="m_7034930307112552171h5"><div class="gmail_quote">On Wed, Aug 30, 2017 at 2:09 PM, Federico Cabiddu <span dir="ltr"><<a href="mailto:federico.cabiddu@gmail.com" target="_blank">federico.cabiddu@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"><div>Hi,</div>I told you previously hat you have to use sql_ops to actually do the update of the balance after calculating the call cost using the dialog variables.<div><br></div><div>Cheers,</div><div><br></div><div>Federico<br><div><br><div><div> </div></div></div></div></div><div class="m_7034930307112552171m_2124209333776439944HOEnZb"><div class="m_7034930307112552171m_2124209333776439944h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 30, 2017 at 10:34 AM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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">As per your Input I have changed the Variables to dialog variables, But I dont know what to add in event route.<br></div><div class="gmail_extra"><span><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br></span><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139h5"><div class="gmail_quote">On Wed, Aug 30, 2017 at 2:00 PM, Federico Cabiddu <span dir="ltr"><<a href="mailto:federico.cabiddu@gmail.com" target="_blank">federico.cabiddu@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">Hi,<div>did you read this comment in the event_route?</div><span><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px"># perform some kind of notification, database update, email sending, etc.</span><br style="font-size:16px"><br></div></span>Have you put any logic to do the accounting there (as I suggested)?<br><br>Regards,<br><br>Federico</div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353HOEnZb"><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 30, 2017 at 9:50 AM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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"><div>Hi,<br><br></div>I am using the below scenario : but there is no cost deduction happening , Correct me if I am wrong.<br><br>route[CNXCC]<br>{<br>                $dlg_var(subscriber)          <wbr>  = $fU;<br>                $dlg_var(customer_id)         <wbr>  = "customer-" + $fU;<br>                $dlg_var(initial_p)           <wbr>  = "1"; <br>                $dlg_var(final_p)             <wbr>  = "1"; <br>                $dlg_var(cps)   = "1"; ;<span><br>        $var(minbal) = 1;<br>        $var(ret) = avp_db_query("SELECT credits FROM subscriber where username='$fU'", "$avp(s:credits)");<br>        xlog("L_WARN", "CNXCC: var(ret)=$var(ret) avp(s:credits)=$avp(s:credits)<wbr>\n");<br></span>        #if(!cnxcc_set_max_credit("$va<wbr>r(customer)", "$avp(s:credits)", "$var(cps)", "$var(initial_p)", "$var(final_p)"))<br>        if(!cnxcc_set_max_credit("$dlg<wbr>_var(subscriber)", "$avp(s:credits)", "$dlg_var(cps)", "$dlg_var(initial_p)", "$dlg_var(final_p)"))<br>        {<br>                xlog("Error setting up credit control");<br>                sl_reply_error();<br>                exit;<span><br><br>        }<br>        if ($avp(s:credits)<  $var(minbal)){<br>                xlog("L_ALERT", "ALERT: Credit balance is low, sent 403:Forbidden. required=$var(minbal)\n");<br>                sl_send_reply("403", "Forbidden: Low balance");<br>                drop;<br><br>        }<br>}<br><br></span>event_route[cnxcc:call-shutdow<wbr>n]<br>{<br>        xlog("L_ALERT", "event_route:cnxcc: [$ci]: call killed");<br><br>        # perform some kind of notification, database update, email sending, etc.<br>}<br></div><div class="gmail_extra"><span><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br></span><div class="gmail_quote"><span>On Wed, Aug 30, 2017 at 11:40 AM, Aqs Younas <span dir="ltr"><<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>></span> wrote:<br></span><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">This might help you. <div dir="auto"><a href="https://github.com/caruizdiaz/cnxcc-example?files=1" target="_blank">https://github.com/caruizdiaz/<wbr>cnxcc-example?files=1</a><br></div></div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801HOEnZb"><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801h5"><div class="gmail_extra"><br><div class="gmail_quote">On 30 Aug 2017 11:09 am, "Logeshwaran G" <<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks Federico! Will try it out.<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br><div class="gmail_quote">On Wed, Aug 30, 2017 at 11:34 AM, Federico Cabiddu <span dir="ltr"><<a href="mailto:federico.cabiddu@gmail.com" target="_blank">federico.cabiddu@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">Hi,<div>yes it's correct, but if you want to deduct the cost at the end of the call you should use dlg_var to store cps etc.</div><div><br></div><div>Regards,</div><div><br></div><div>Federico</div></div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426HOEnZb"><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 30, 2017 at 7:16 AM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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"><div class="gmail_extra">Hi,<br><br></div><div class="gmail_extra">Is this the correct way of using the CNXCC for cost deduction, Guide me please.<br><br>route[CNXCC]<br>{<br>        $var(customer) = $fU;<br>        $var(cps)   = "1.00";      # cost per second<br>        $var(initial_p)   = "1";   # intial pulse<br>        $var(final_p)   = "1";    #Final_pulse <br>        $var(minbal) = 1;<br>        $var(ret) = avp_db_query("SELECT credits FROM subscriber where username='$fU'", "$avp(s:credits)");<br>        xlog("L_WARN", "CNXCC: var(ret)=$var(ret) avp(s:credits)=$avp(s:credits)<wbr>\n");<br>        cnxcc_set_max_credit("$var(cus<wbr>tomer)", "$avp(s:credits)", "$var(cps)", "$var(initial_p)", "$var(final_p)");     <br>        if ($avp(s:credits)<  $var(minbal)){<br>                xlog("L_ALERT", "ALERT: Credit balance is low, sent 403:Forbidden. required=$var(minbal)\n");<br>                sl_send_reply("403", "Forbidden: Low balance");<br>                drop;<br><br>        }<br>}<br><br><br></div><div class="gmail_extra"><span><br><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717m_3062531995788132436gmail-m_-4332387908445705936m_-6377922617482737643gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br></span><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717h5"><div class="gmail_quote">On Fri, Aug 25, 2017 at 11:14 AM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks For your Input Federico, Will try it .<br></div><div class="gmail_extra"><span><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717m_3062531995788132436gmail-m_-4332387908445705936m_-6377922617482737643m_-3691925917691359640gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
<br></span><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717m_3062531995788132436gmail-m_-4332387908445705936m_-6377922617482737643h5"><div class="gmail_quote">On Wed, Aug 23, 2017 at 5:45 PM, Federico Cabiddu <span dir="ltr"><<a href="mailto:federico.cabiddu@gmail.com" target="_blank">federico.cabiddu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>cnxcc doesn't provide this feature. Is not aware of any backend, it just controls subscriber's balance, money or time, as instructed.</div><div>You can calculate the amount to be deducted after the call ends (if you're doing money based accounting) using dlg variables to store the needed information (start_time, end_time, cost per second) and then updating the balance via sqlops module's functions.</div><div><br></div><div>Cheers,</div><div><br></div><div>Federico</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717m_3062531995788132436gmail-m_-4332387908445705936m_-6377922617482737643m_-3691925917691359640h5">On Wed, Aug 23, 2017 at 7:50 AM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717m_3062531995788132436gmail-m_-4332387908445705936m_-6377922617482737643m_-3691925917691359640h5"><div dir="ltr"><div>Hi,<br></div><div><br>How to deduct the call cost or credits for the subscribers with the cnxcc module?<br><br></div>Input Please  <br><div><div><br><br clear="all"><div><div class="m_7034930307112552171m_2124209333776439944m_1780089271648663139m_-547065233691304353m_-2901990438690352606m_3555119061681577801m_-7049623481098889439m_-1995652932220210426m_4192352102487230717m_3062531995788132436gmail-m_-4332387908445705936m_-6377922617482737643m_-3691925917691359640m_-5222160128226862068m_-699297104756348686gmail_signature"><div dir="ltr"><div>Thanks & Kind Regards,<br></div>Logeshwaran G<br></div></div></div>
</div></div></div>
<br></div></div>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div></div>
</div></div><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div></div></div><br></div>
<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div></div></div>
<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>