[Freeswitch-users] nibblebill custom_sql_save

Muhammad Shahzad shaheryarkh at gmail.com
Thu Feb 21 18:49:47 MSK 2013


Usually you do VOIP billing in so called "Units", Each unit equals 0.01
cent, meaning 1 USD (or whatever currency you are using in multi-currency
billing system) equal to 10,000 VOIP units. Therefore, if you want to bill
a call at rate of 10 cents per minute then you should set increment 1,000
units and call interval to 60 seconds. If you shorten the interval to say 6
seconds, then you will charge 100 units per 6 seconds, resulting in same
billing as per minute, i.e.

60 / 6 x 100 = 1,000 units = 10 cents

Thank you.


On Thu, Feb 21, 2013 at 4:43 PM, Muhammad Shahzad <shaheryarkh at gmail.com>wrote:

> Not sure what you mean below. You want to charge every 10 seconds (billing
> interval) or you want to charge 10 cents per minute (billing rate)?
>
> Thank you.
>
>
> On Thu, Feb 21, 2013 at 1:49 PM, David Villasmil <
> david.villasmil.work at gmail.com> wrote:
>
>> Hello,
>>
>> Thanks for replying!
>>
>> It was not set, but i understood from the wiki that if you don't want any
>> rounding, you dont't set it.
>>
>> I set it to "10", i want the user to be charged tvery 10 seconds, you
>> nibblebil is charging 10 DOLLARS!
>> I must be getting something wrong...
>>
>>
>> Here's my nibblebill.conf.xml.
>>
>> (BTW, the two highlighted lines, is it possible to do that? I want the
>> custom SQLs to use channel variables, is it possible?)
>>
>>
>>     <section name="configuration">
>>         <configuration name="nibblebill.conf" description="Nibble
>> Billing">
>>             <settings>
>>                 <param name="db_username" value="myroot" />
>>                 <param name="db_password" value="mypass" />
>>                 <param name="odbc-dsn" value="odbc://viking" />
>>                 <param name="db_table" value="sip_users" />
>>                 <param name="db_column_cash" value="balance" />
>>                 <param name="db_column_account" value="id" />
>>                 *<param name="custom_sql_lookup" value="SELECT
>> ${variable_card_db_column_cash} AS nibble_balance FROM
>> ${variable_card_db_table} WHERE
>> ${variable_card_db_column_account}=${nibble_account};" />*
>> *                <param name="custom_sql_save" value="UPDATE
>> ${variable_card_db_table} SET
>> ${variable_card_db_column_cash}=${variable_card_db_column_cash}-${nibble_increment}
>> WHERE ${variable_card_db_column_account}=${nibble_account};" />*
>>                 <param name="global_heartbeat" value="10" />
>>                 <param name="lowbal_amt" value="0" />
>>                 <param name="lowbal_action" value="play ding" />
>>                 <param name="nobal_amt" value="0" />
>>                 <param name="nobal_action" value="hangup" />
>>                 <param name="percall_max_amt" value="100" />
>>                 <param name="percall_action" value="hangup" />
>>             </settings>
>>         </configuration>
>>     </section>
>>
>> Here's the dialplan:
>>
>>     <section name="dialplan">
>>         <context name="route_call">
>>             <extension name="routeCall">
>>                 <condition field="destination_number" expression="^.*">
>>                     <action application="set"
>> data="continue_on_fail=NO_ROUTE_DESTINATION,UNALLOCATED_NUMBER,407" />
>>                     <action application="set" data="sip_from_user=1002" />
>>                     <action application="set"
>> data="sip_auth_username=1002" />
>>                     <action application="set" data="sip_req_user=1002" />
>>                     <action application="set"
>> data="hangup_after_bridge=true" />
>>                     <action application="set" data="nibble_rate=0.0500" />
>>                     <action application="nibblebill" data="heartbeat 10"
>> />
>>                     <action application="set"
>> data="card_db_table=cards_table" />
>>                     <action application="set"
>> data="card_db_column_cash=balance" />
>>                     <action application="set"
>> data="card_db_column_account=pin" />
>>                     <action application="set" data="nibble_account=12345"
>> />
>>                     <action application="set"
>> data="gw=${distributor(TEST_ROUTE)}" />
>>                     <action application="limit" data="hash $${domain}
>> $${domain} ${sip_auth_username} 1 !NORMAL_TEMPORARY_FAILURE" />
>>                     <action application="export"
>> data="execute_on_answer=nibblebill adjust -0.1000" />
>>                     <action application="bridge"
>> data="{enable_heartbeat_events=10,nibble_rate=0.0500,nibble_account=12345}sofia/gateway/${gw}/0013058883456"
>> />
>>                 </condition>
>>             </extension>
>>         </context>
>>     </section>
>>
>>
>> Thanks for your help!
>>
>>
>> David
>>
>>
>>
>> On Wed, Feb 20, 2013 at 2:23 PM, Muhammad Shahzad <shaheryarkh at gmail.com>wrote:
>>
>>> Did you set nibble_increment variable? e.g.
>>>
>>> <variable name="nibble_increment" value="30" />
>>>
>>> Here is its details,
>>>
>>>
>>> http://wiki.freeswitch.org/wiki/Mod_nibblebill#Nibble_Method_.28Default.29
>>>
>>> Thank you.
>>>
>>>
>>> On Wed, Feb 20, 2013 at 2:10 PM, David Villasmil <
>>> david.villasmil.work at gmail.com> wrote:
>>>
>>>> Anyone about this?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> On Mon, Feb 18, 2013 at 2:07 PM, David Villasmil <
>>>> david.villasmil.work at gmail.com> wrote:
>>>>
>>>>> Hello guys,
>>>>>
>>>>> I have the following config for nibbebill:
>>>>>
>>>>>                 <param name="custom_sql_lookup" value="SELECT
>>>>> ${card_db_column_cash} AS nibble_balance FROM ${card_db_table} WHERE
>>>>> ${card_db_column_account}=${nibble_account};" />
>>>>>                 <param name="custom_sql_save" value="UPDATE
>>>>> ${card_db_table} SET
>>>>> ${card_db_column_cash}=${card_db_column_cash}-${nibble_increment} WHERE
>>>>> ${card_db_column_account}=${nibble_account};" />
>>>>>
>>>>> I see this on the log, which is obviously failing:
>>>>>
>>>>>
>>>>>  [UPDATE cards_table SET balance=balance- WHERE pin=12345;]
>>>>>
>>>>> is ${nibble_increment} not the correct variable to use? It looks like
>>>>> it is empty!
>>>>>
>>>>> Thanks!
>>>>>
>>>>> David
>>>>>
>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> 
>>>> 
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Muhammad Shahzad
>>> -----------------------------------
>>> CISCO Rich Media Communication Specialist (CRMCS)
>>> CISCO Certified Network Associate (CCNA)
>>> Cell: +49 176 99 83 10 85
>>> MSN: shari_786pk at hotmail.com
>>> Email: shaheryarkh at googlemail.com
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
> --
> Muhammad Shahzad
> -----------------------------------
> CISCO Rich Media Communication Specialist (CRMCS)
> CISCO Certified Network Associate (CCNA)
> Cell: +49 176 99 83 10 85
> MSN: shari_786pk at hotmail.com
> Email: shaheryarkh at googlemail.com
>



-- 
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +49 176 99 83 10 85
MSN: shari_786pk at hotmail.com
Email: shaheryarkh at googlemail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130221/3b571231/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list