[Freeswitch-users] Mod_nibblebill doesn't terminate call

Aqs Younas aqsyounas at gmail.com
Fri Sep 19 19:56:54 MSD 2014


After some considertation i foung, Its heartbeat fire does not fire after 1
second as i have specified in my nibblebill.conf.xml file. After call is
completed nibblebill update the database balance column according to given
formula.

[time call ended] - [time call answered] x [rate per minute] = $total bill
rate

Though this formula is used when  global_heartbeat is off.
Here is my nibblebill.conf.xml

<configuration name="nibblebill.conf" description="Nibble Billing">
  <settings>


        <param name="odbc-dsn" value="odbc://freeswitch"/>
<param name="db_table" value="users"/>

    <!-- The column name where we store the value of the account -->
    <param name="db_column_cash" value="balance"/>

    <!-- The column name for the unique ID identifying the account -->
    <param name="db_column_account" value="accountcode"/>

    <!-- Custom SQL for loading current balance - overrides column names
         channel vars are interpreted.
         field nibble_balance is used for balance info

    <param name="custom_sql_lookup" value="SELECT cash AS nibble_balance
FROM accounts WHERE account_code='${nibble_
account}'"/>
    -->

    <!-- Custom SQL for loading current balance - overrides column names
         channel vars are interpreted.
         nibble_increment is the amount to update

    <param name="custom_sql_save" value="UPDATE accounts SET
cash=cash-${nibble_increment} WHERE account_code='${nibble_account}'"/>
    -->
<!-- Default heartbeat interval. Set to 'off' for no heartbeat (i.e. bill
only at end of call) -->
    <param name="global_heartbeat" value="1"/>

    <!-- By default, warn a caller when their balance is at $5.00. You can
set this to a negative number. -->
    <param name="lowbal_amt" value="5"/>
    <param name="lowbal_action" value="play ding"/>

    <!-- By default, terminate a caller when their balance hits $0.00. You
can set this to a negative number. -->
    <param name="nobal_amt" value="0"/>
    <param name="nobal_action" value="hangup XML default"/>

    <!-- If a call goes beyond a certain dollar amount, flag or terminate
it -->
    <param name="percall_max_amt" value="0"/>
    <param name="percall_action" value="hangup"/>

  </settings>
</configuration>

When i apply this on Freeswitch cli for channel uuid i get this..



freeswitch at internal> nibblebill 3f3f3b4a-fe4e-47d0-a43a-e1d8a54c6dfe check
-ERR no reply

2014-09-19 04:30:38.704124 [INFO] mod_nibblebill.c:793 Can't check -
channel is not initialized for billing!
2014-09-19 04:30:38.704124 [INFO] mod_nibblebill.c:888 Current billing is
at $-99999.000000

Why freeswitch does not fire heartbeat after one second and set the channel
for billing.?

On 19 September 2014 02:29, Aqs Younas <aqsyounas at gmail.com> wrote:

> Sorry Still i am unable to terminate calls.Here are both files.
>
> Here is my nibblebill.conf.xml file.
>
> <configuration name="nibblebill.conf" description="Nibble Billing">
>   <settings>
>
>     <param name="odbc-dsn" value="odbc://freeswitch"/>
>     <param name="db_table" value="users"/>
>     <param name="db_column_cash" value="balance"/>
>     <param name="db_column_account" value="accountcode"/>
>     <param name="lowbal_amt" value="5"/>
>     <param name="lowbal_action" value="play ding"/>
>
>
>     <param name="nobal_amt" value="0"/>
>     <param name="nobal_action" value="hangup XML default"/>
>
>     <param name="percall_max_amt" value="0"/>
>     <param name="percall_action" value="hangup"/>
>
>   </settings>
> </configuration>
>
>
>
> Here is my default.xml
>
> <include>
>   <context name="default">
>    <extension name="unloop">
>
>    <condition field="destination_number"
> expression="^(1[2-9][0-9]{2}[0-9]{7})$">
>            <variable name="nibble_rate" value="0.03"/>
>           <variable name="nibble_account" value="45893148"/>
>           <action application="bridge"
> data="sofia/external/1$@168.183.648"/>
>         </condition>
>   </extension>
>
>
> <extension name="hangup">
>   <condition field="destination_number" expression="^(hangup)$">
>     <action application="hangup"/>
>   </condition>
> </extension>
>
> </context>
> </include>
>
>
> Any Suggestion :(
>
>
> On 19 September 2014 01:33, Aqs Younas <aqsyounas at gmail.com> wrote:
>
>> Thanks for your reply..i try it and get back to you.
>> Many thanks
>>
>> On 19 September 2014 01:14, Steven Ayre <steveayre at gmail.com> wrote:
>>
>>> <param name="nobal_action" value="hangup XML default"/>
>>>
>>> It's a dialplan transfer, you need the XML and context name, and an
>>> extension to handle it.
>>>
>>> On 18 September 2014 19:39, Aqs Younas <aqsyounas at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am new to freeswitch, i am using mod_nibblebill for billing of
>>>> realtime calls.It works perfectly, detects correct balance after the
>>>> completion of call and performs update query on database.What difficulty I
>>>> am facing now is that mod_nibblebill does not terminate call even when user
>>>> balance is below zero(0) or is zero(0), which I have specified in my xml
>>>> file.
>>>>
>>>> Here is my nibblebill.conf.xml file.
>>>>
>>>> <configuration name="nibblebill.conf" description="Nibble Billing">
>>>>   <settings>
>>>>
>>>>     <param name="odbc-dsn" value="odbc://freeswitch"/>
>>>>     <param name="db_table" value="users"/>
>>>>     <param name="db_column_cash" value="balance"/>
>>>>     <param name="db_column_account" value="accountcode"/>
>>>>     <param name="lowbal_amt" value="5"/>
>>>>     <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="0"/>
>>>>     <param name="percall_action" value="hangup"/>
>>>>
>>>>   </settings>
>>>> </configuration>
>>>>
>>>> Here is my default.xml
>>>>
>>>> include>
>>>>   <context name="default">
>>>>    <extension name="unloop">
>>>>
>>>>    <condition field="destination_number"
>>>> expression="^(1[2-9][0-9]{2}[0-9]{7})$">
>>>>           <variable name="nibble_rate" value="0.03"/>
>>>>           <variable name="nibble_account" value="45893148"/>
>>>>           <action application="bridge"
>>>> data="sofia/external/1$@168.183.648"/>
>>>>     </condition>
>>>>   </extension>
>>>>   </context>
>>>> </include>
>>>>
>>>> Could Someone please tell me why mod_nibblebill is not terminating call
>>>> but accounts call perfectly.
>>>>
>>>> (if a user balance is below or at zero(0) mob_nibblebill let them call
>>>> and after call sets balance to negative value)
>>>>
>>>> Thanks In Advance.
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://confluence.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://confluence.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
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140919/c847f54a/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list