[Freeswitch-svn] [commit] r13754 - freeswitch/trunk/src/mod/applications/mod_nibblebill
FreeSWITCH SVN
dschreiber at freeswitch.org
Wed Jun 10 20:42:01 PDT 2009
Author: dschreiber
Date: Wed Jun 10 22:42:01 2009
New Revision: 13754
Log:
Fix a deadlock in last commit
Modified:
freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c
Modified: freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c Wed Jun 10 22:42:01 2009
@@ -430,10 +430,6 @@
/* Not enough money - reroute call to nobal location */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.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);
}
@@ -503,22 +499,23 @@
/* 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) {
switch_channel_set_private(channel, "_nibble_data_", nibble_data);
- }
- float balance;
+ float balance;
+
+ /* See if this person has enough money left to continue the call */
+ balance = get_balance(billaccount);
+ if (balance <= globals.nobal_amt) {
+ /* Not enough money - reroute call to nobal location */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.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);
+ }
+ }
- /* See if this person has enough money left to continue the call */
- balance = get_balance(billaccount);
- if (balance <= globals.nobal_amt) {
- /* Not enough money - reroute call to nobal location */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.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);
- }
/* Done changing - release lock */
if (globals.mutex) {
@@ -840,7 +837,7 @@
/* on_routing */ process_hangup, /* Need to add a check here for anything in their account before routing */
/* on_execute */ sched_billing, /* Turn on heartbeat for this session and do an initial account check */
/* on_hangup */ process_hangup, /* On hangup - most important place to go bill */
- /* on_exch_media */ NULL,
+ /* on_exch_media */ sched_billing,
/* on_soft_exec */ NULL,
/* on_consume_med */ NULL,
/* on_hibernate */ NULL,
More information about the Freeswitch-svn
mailing list