Hi Team,

I have installed and configure Freeswitch. I want to used Mod_nibblebill for realtime billing with freeswitch. I have configure and installed freeswtich with Mod_nibblebill but balance is not deducted still. Any help will be appreciated....

/******************************************************************/
<configuration name="nibblebill.conf" description="Nibble Billing">
  <settings>
    <!-- See http://wiki.freeswitch.org/wiki/Mod_nibblebill for help with these options -->

    <!-- Information for connecting to your database -->
    <param name="db_username" value="root"/>
    <param name="db_password" value="ViR39dra"/>
    <param name="db_dsn" value="newfies"/>
    <variable name="nibble_rate" value="11"/>
    <variable name="nibble_increment" value="33" />

    <!-- The database table where your CASH column is located -->
    <param name="db_table" value="accounts"/>

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

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

    <!--  field nibble_balance is used for balance info -->
    <param name="custom_sql_lookup" value="SELECT cash AS nibble_balance FROM accounts WHERE id='${nibble_account}'"/>
   
    <!-- nibble_increment is the amount to update -->
        
    <param name="custom_sql_save" value="UPDATE accounts SET cash=cash-${nibble_increment} WHERE id='${nibble_account}'"/>
  
    <!-- Default heartbeat interval. Set to 'off' for no heartbeat (i.e. bill only at end of call) -->
    <param name="global_heartbeat" value="30"/>

    <!-- 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"/>

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

  </settings>
</configuration>
/******************************************************************/ 

FS CLI

2012-07-31 02:30:02.268212 [DEBUG] switch_ivr_originate.c:1947 Parsing global variables
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [plivo_request_uuid]=[28a9ae1a-dad9-11e1-b432-00163e908c9f]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [plivo_answer_url]=[http://46.252.152.160:8008/api/v1/answercall/]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [plivo_hangup_url]=[http://46.252.152.160:8008/api/v1/hangupcall/]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [origination_caller_id_number]=[0498722120]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [bridge_early_media]=[true]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [hangup_after_bridge]=[true]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [hangup_after_bridge]=[true]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [nibble_account]=[97183008]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [plivo_from]=[0498722120]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [plivo_to]=[919718300881]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [plivo_app]=[true]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [absolute_codec_string]=[PCMA]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [originate_timeout]=[60]
2012-07-31 02:30:02.268212 [DEBUG] switch_event.c:1519 Parsing variable [ignore_early_media]=[true]
2012-07-31 02:30:02.268212 [NOTICE] switch_channel.c:926 New Channel sofia/external/919718300881 [28aa5810-dad9-11e1-b60b-1782e99edc0a]
2012-07-31 02:30:02.268212 [DEBUG] mod_sofia.c:4705 (sofia/external/919718300881) State Change CS_NEW -> CS_INIT
2012-07-31 02:30:02.268212 [DEBUG] switch_core_session.c:1224 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:385 (sofia/external/919718300881) Running State Change CS_INIT
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:424 (sofia/external/919718300881) State INIT
2012-07-31 02:30:02.268212 [DEBUG] mod_sofia.c:85 sofia/external/919718300881 SOFIA INIT
2012-07-31 02:30:02.268212 [DEBUG] mod_sofia.c:125 (sofia/external/919718300881) State Change CS_INIT -> CS_ROUTING
2012-07-31 02:30:02.268212 [DEBUG] switch_core_session.c:1224 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:424 (sofia/external/919718300881) State INIT going to sleep
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:385 (sofia/external/919718300881) Running State Change CS_ROUTING
2012-07-31 02:30:02.268212 [DEBUG] switch_channel.c:1919 (sofia/external/919718300881) Callstate Change DOWN -> RINGING
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:433 (sofia/external/919718300881) State ROUTING
2012-07-31 02:30:02.268212 [DEBUG] mod_sofia.c:148 sofia/external/919718300881 SOFIA ROUTING
2012-07-31 02:30:02.268212 [DEBUG] switch_ivr_originate.c:67 (sofia/external/919718300881) State Change CS_ROUTING -> CS_CONSUME_MEDIA
2012-07-31 02:30:02.268212 [DEBUG] switch_core_session.c:1224 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:02.268212 [DEBUG] mod_nibblebill.c:383 Doing lookup query
[SELECT cash AS nibble_balance FROM accounts WHERE id='97183008']
2012-07-31 02:30:02.268212 [DEBUG] switch_core_session.c:919 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:02.268212 [DEBUG] mod_nibblebill.c:393 Retrieved current balance for account 97183008 (balance = 500.500000)
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:433 (sofia/external/919718300881) State ROUTING going to sleep
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:385 (sofia/external/919718300881) Running State Change CS_CONSUME_MEDIA
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:452 (sofia/external/919718300881) State CONSUME_MEDIA
2012-07-31 02:30:02.268212 [DEBUG] mod_nibblebill.c:383 Doing lookup query
[SELECT cash AS nibble_balance FROM accounts WHERE id='97183008']
2012-07-31 02:30:02.268212 [DEBUG] mod_nibblebill.c:393 Retrieved current balance for account 97183008 (balance = 500.500000)
2012-07-31 02:30:02.268212 [DEBUG] switch_core_state_machine.c:452 (sofia/external/919718300881) State CONSUME_MEDIA going to sleep
2012-07-31 02:30:02.268212 [DEBUG] sofia.c:5745 Channel sofia/external/919718300881 entering state [calling][0]
2012-07-31 02:30:02.308197 [DEBUG] switch_core_session.c:919 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:02.308197 [DEBUG] switch_core_session.c:919 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:02.308197 [DEBUG] sofia.c:5745 Channel sofia/external/919718300881 entering state [calling][0]
2012-07-31 02:30:05.488328 [DEBUG] switch_core_session.c:919 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:05.488328 [DEBUG] switch_core_session.c:919 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:30:05.488328 [DEBUG] sofia.c:5745 Channel sofia/external/919718300881 entering state [proceeding][183]
2012-07-31 02:30:05.488328 [DEBUG] sofia.c:5756 Remote SDP:
v=0
o=root 3607 3607 IN IP4 31.216.132.13
s=session
c=IN IP4 31.216.132.13
t=0 0
m=audio 14460 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20

2012-07-31 02:30:05.488328 [DEBUG] sofia_glue.c:4915 Audio Codec Compare [PCMA:8:8000:20:64000]/[PCMA:8:8000:20:64000]
2012-07-31 02:30:05.488328 [DEBUG] sofia_glue.c:2995 Set Codec sofia/external/919718300881 PCMA/8000 20 ms 160 samples 64000 bits
2012-07-31 02:30:05.488328 [DEBUG] switch_core_codec.c:111 sofia/external/919718300881 Original read codec set to PCMA:8
2012-07-31 02:30:05.488328 [DEBUG] sofia_glue.c:5029 Set 2833 dtmf send payload to 101
2012-07-31 02:30:05.488328 [DEBUG] sofia_glue.c:3244 AUDIO RTP [sofia/external/919718300881] 46.252.152.160 port 20512 -> 31.216.132.13 port 14460 codec: 8 ms: 20
2012-07-31 02:30:05.488328 [DEBUG] switch_rtp.c:1676 Starting timer [soft] 160 bytes per 20ms
2012-07-31 02:30:05.508186 [DEBUG] sofia_glue.c:3508 Set 2833 dtmf send payload to 101
2012-07-31 02:30:05.508186 [DEBUG] sofia_glue.c:3514 Set 2833 dtmf receive payload to 101
2012-07-31 02:30:05.508186 [DEBUG] sofia_glue.c:3541 sofia/external/919718300881 Set rtp dtmf delay to 40
2012-07-31 02:30:05.508186 [NOTICE] sofia_glue.c:4052 Pre-Answer sofia/external/919718300881!
2012-07-31 02:30:05.508186 [DEBUG] switch_channel.c:3019 (sofia/external/919718300881) Callstate Change RINGING -> EARLY
2012-07-31 02:31:02.008196 [DEBUG] switch_channel.c:2882 (sofia/external/919718300881) Callstate Change EARLY -> HANGUP
2012-07-31 02:31:02.008196 [NOTICE] switch_ivr_originate.c:3246 Hangup sofia/external/919718300881 [CS_CONSUME_MEDIA] [NO_ANSWER]
2012-07-31 02:31:02.008196 [DEBUG] switch_channel.c:2905 Send signal sofia/external/919718300881 [KILL]
2012-07-31 02:31:02.008196 [DEBUG] switch_core_session.c:1224 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:385 (sofia/external/919718300881) Running State Change CS_HANGUP
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:625 (sofia/external/919718300881) State HANGUP
2012-07-31 02:31:02.008196 [DEBUG] mod_sofia.c:469 Channel sofia/external/919718300881 hanging up, cause: NO_ANSWER
2012-07-31 02:31:02.008196 [DEBUG] mod_sofia.c:527 Sending CANCEL to sofia/external/919718300881
2012-07-31 02:31:02.008196 [DEBUG] mod_nibblebill.c:383 Doing lookup query
[SELECT cash AS nibble_balance FROM accounts WHERE id='97183008']
2012-07-31 02:31:02.008196 [DEBUG] mod_nibblebill.c:393 Retrieved current balance for account 97183008 (balance = 500.500000)
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:47 sofia/external/919718300881 Standard HANGUP, cause: NO_ANSWER
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:625 (sofia/external/919718300881) State HANGUP going to sleep
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:416 (sofia/external/919718300881) State Change CS_HANGUP -> CS_REPORTING
2012-07-31 02:31:02.008196 [DEBUG] switch_core_session.c:1224 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:385 (sofia/external/919718300881) Running State Change CS_REPORTING
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:685 (sofia/external/919718300881) State REPORTING
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:79 sofia/external/919718300881 Standard REPORTING, cause: NO_ANSWER
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:685 (sofia/external/919718300881) State REPORTING going to sleep
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:410 (sofia/external/919718300881) State Change CS_REPORTING -> CS_DESTROY
2012-07-31 02:31:02.008196 [DEBUG] switch_core_session.c:1224 Send signal sofia/external/919718300881 [BREAK]
2012-07-31 02:31:02.008196 [DEBUG] switch_core_session.c:1424 Session 104 (sofia/external/919718300881) Locked, Waiting on external entities
2012-07-31 02:31:02.008196 [NOTICE] switch_core_session.c:1442 Session 104 (sofia/external/919718300881) Ended
2012-07-31 02:31:02.008196 [NOTICE] switch_core_session.c:1444 Close Channel sofia/external/919718300881 [CS_DESTROY]
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:514 (sofia/external/919718300881) Callstate Change HANGUP -> DOWN
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:517 (sofia/external/919718300881) Running State Change CS_DESTROY
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:527 (sofia/external/919718300881) State DESTROY
2012-07-31 02:31:02.008196 [DEBUG] mod_sofia.c:374 sofia/external/919718300881 SOFIA DESTROY
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:86 sofia/external/919718300881 Standard DESTROY
2012-07-31 02:31:02.008196 [DEBUG] switch_core_state_machine.c:527 (sofia/external/919718300881) State DESTROY going to sleep
freeswitch@internal>

--

Thanks and regards

 Virendra Bhati
+91-9718300881
Asterisk Developer
E-mail-: virbhati@gmail.com
Skype id:- virbhati2
New Delhi(India)