Ok let me try it out!
Will add the sqlops query module in the event route!
Thanks
Thanks & Kind Regards,
Logeshwaran G
On Wed, Aug 30, 2017 at 2:09 PM, Federico Cabiddu <
federico.cabiddu(a)gmail.com> wrote:
Hi,
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.
Cheers,
Federico
On Wed, Aug 30, 2017 at 10:34 AM, Logeshwaran G <
logeshwarangs(a)gmail.com> wrote:
> As per your Input I have changed the Variables to dialog variables,
> But I dont know what to add in event route.
>
> Thanks & Kind Regards,
> Logeshwaran G
>
> On Wed, Aug 30, 2017 at 2:00 PM, Federico Cabiddu <
> federico.cabiddu(a)gmail.com> wrote:
>
>> Hi,
>> did you read this comment in the event_route?
>>
>> # perform some kind of notification, database update, email sending,
>> etc.
>>
>> Have you put any logic to do the accounting there (as I suggested)?
>>
>> Regards,
>>
>> Federico
>>
>> On Wed, Aug 30, 2017 at 9:50 AM, Logeshwaran G <
>> logeshwarangs(a)gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I am using the below scenario : but there is no cost deduction
>>> happening , Correct me if I am wrong.
>>>
>>> route[CNXCC]
>>> {
>>> $dlg_var(subscriber) = $fU;
>>> $dlg_var(customer_id) = "customer-" +
$fU;
>>> $dlg_var(initial_p) = "1";
>>> $dlg_var(final_p) = "1";
>>> $dlg_var(cps) = "1"; ;
>>> $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");
>>> #if(!cnxcc_set_max_credit("$var(customer)",
>>> "$avp(s:credits)", "$var(cps)",
"$var(initial_p)", "$var(final_p)"))
>>> if(!cnxcc_set_max_credit("$dlg_var(subscriber)",
>>> "$avp(s:credits)", "$dlg_var(cps)",
"$dlg_var(initial_p)",
>>> "$dlg_var(final_p)"))
>>> {
>>> xlog("Error setting up credit control");
>>> sl_reply_error();
>>> exit;
>>>
>>> }
>>> 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;
>>>
>>> }
>>> }
>>>
>>> event_route[cnxcc:call-shutdown]
>>> {
>>> xlog("L_ALERT", "event_route:cnxcc: [$ci]: call
killed");
>>>
>>> # perform some kind of notification, database update, email
>>> sending, etc.
>>> }
>>>
>>> Thanks & Kind Regards,
>>> Logeshwaran G
>>>
>>> On Wed, Aug 30, 2017 at 11:40 AM, Aqs Younas <aqsyounas(a)gmail.com>
>>> wrote:
>>>
>>>> This might help you.
>>>>
https://github.com/caruizdiaz/cnxcc-example?files=1
>>>>
>>>> On 30 Aug 2017 11:09 am, "Logeshwaran G"
<logeshwarangs(a)gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks Federico! Will try it out.
>>>>>
>>>>> Thanks & Kind Regards,
>>>>> Logeshwaran G
>>>>>
>>>>> On Wed, Aug 30, 2017 at 11:34 AM, Federico Cabiddu <
>>>>> federico.cabiddu(a)gmail.com> wrote:
>>>>>
>>>>>> 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
>>>>>>
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
>>>
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
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users