Hi,
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.
Regards,
Federico
On Wed, Aug 30, 2017 at 7:16 AM, Logeshwaran G <logeshwarangs(a)gmail.com>
wrote:
Hi,
Is this the correct way of using the CNXCC for cost deduction, Guide me
please.
route[CNXCC]
{
$var(customer) = $fU;
$var(cps) = "1.00"; # cost per second
$var(initial_p) = "1"; # intial pulse
$var(final_p) = "1"; #Final_pulse
$var(minbal) = 1;
$var(ret) = avp_db_query("SELECT credits FROM subscriber where
username='$fU'", "$avp(s:credits)");
xlog("L_WARN", "CNXCC: var(ret)=$var(ret)
avp(s:credits)=$avp(s:credits)\n");
cnxcc_set_max_credit("$var(customer)", "$avp(s:credits)",
"$var(cps)", "$var(initial_p)", "$var(final_p)");
if ($avp(s:credits)< $var(minbal)){
xlog("L_ALERT", "ALERT: Credit balance is low, sent
403:Forbidden. required=$var(minbal)\n");
sl_send_reply("403", "Forbidden: Low balance");
drop;
}
}
Thanks & Kind Regards,
Logeshwaran G
On Fri, Aug 25, 2017 at 11:14 AM, Logeshwaran G <logeshwarangs(a)gmail.com
wrote:
Thanks For your Input Federico, Will try it .
Thanks & Kind Regards,
Logeshwaran G
On Wed, Aug 23, 2017 at 5:45 PM, Federico Cabiddu <
federico.cabiddu(a)gmail.com> wrote:
> Hi,
> cnxcc doesn't provide this feature. Is not aware of any backend, it
> just controls subscriber's balance, money or time, as instructed.
> 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.
>
> Cheers,
>
> Federico
>
> On Wed, Aug 23, 2017 at 7:50 AM, Logeshwaran G <
> logeshwarangs(a)gmail.com> wrote:
>
>> Hi,
>>
>> How to deduct the call cost or credits for the subscribers with the
>> cnxcc module?
>>
>> Input Please
>>
>>
>> Thanks & Kind Regards,
>> Logeshwaran G
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users(a)lists.kamailio.org
>>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users(a)lists.kamailio.org
>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org