]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSMOD-40 - handle CS_REPORTING like CS_HANGUP
authorRupa Schomaker <rupa@rupa.com>
Tue, 9 Mar 2010 17:46:00 +0000 (17:46 +0000)
committerRupa Schomaker <rupa@rupa.com>
Tue, 9 Mar 2010 17:46:00 +0000 (17:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16954 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_nibblebill/mod_nibblebill.c

index c5ca8bf03810584e2d12114f23933384d2b2c7b0..7c7c7bb670824e5586166fc49418e2236d3b6fe5 100644 (file)
@@ -484,22 +484,25 @@ static switch_status_t do_billing(switch_core_session_t *session)
        /* Update the last time we billed */
        nibble_data->lastts = ts;
 
-       /* Save this location, but only if the channel/session are not hungup (otherwise, we're done) */
-       if (channel && switch_channel_get_state(channel) != CS_HANGUP) {
+       /* Save this location */
+       if (channel) {
                switch_channel_set_private(channel, "_nibble_data_", nibble_data);
 
-               /* See if this person has enough money left to continue the call */
-               balance = get_balance(billaccount);
-               if (balance <= nobal_amt) {
-                       /* Not enough money - reroute call to nobal location */
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n",
-                                                         balance, nobal_amt, billaccount);
-
-                       /* IMPORTANT: Billing must be paused before the transfer occurs! This prevents infinite loops, since the transfer will result */
-                       /* in nibblebill checking the call again in the routing process for an allowed balance! */
-                       /* If you intend to give the user the option to re-up their balance, you must clear & resume billing once the balance is updated! */
-                       nibblebill_pause(session);
-                       transfer_call(session, globals.nobal_action);
+               /* don't verify ballance and transfer to nobal if we're done with call */
+               if (switch_channel_get_state(channel) != CS_REPORTING && switch_channel_get_state(channel) != CS_HANGUP) {
+                       /* See if this person has enough money left to continue the call */
+                       balance = get_balance(billaccount);
+                       if (balance <= nobal_amt) {
+                               /* Not enough money - reroute call to nobal location */
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Balance of %f fell below allowed amount of %f! (Account %s)\n",
+                                                                 balance, nobal_amt, billaccount);
+
+                               /* IMPORTANT: Billing must be paused before the transfer occurs! This prevents infinite loops, since the transfer will result */
+                               /* in nibblebill checking the call again in the routing process for an allowed balance! */
+                               /* If you intend to give the user the option to re-up their balance, you must clear & resume billing once the balance is updated! */
+                               nibblebill_pause(session);
+                               transfer_call(session, globals.nobal_action);
+                       }
                }
        }