cleanup, fix leak
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13463 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7a90f26eb2
commit
66c0d19f12
|
@ -42,7 +42,9 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
|
EnablePREfast="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
@ -167,7 +169,9 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
|
EnablePREfast="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
|
|
@ -257,14 +257,13 @@ done:
|
||||||
|
|
||||||
void debug_event_handler(switch_event_t *event)
|
void debug_event_handler(switch_event_t *event)
|
||||||
{
|
{
|
||||||
switch_event_header_t *event_header = NULL;
|
|
||||||
|
|
||||||
if (!event) {
|
if (!event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print out all event headers, for fun */
|
/* Print out all event headers, for fun */
|
||||||
if (event->headers) {
|
if (event->headers) {
|
||||||
|
switch_event_header_t *event_header = NULL;
|
||||||
for (event_header = event->headers; event_header; event_header = event_header->next) {
|
for (event_header = event->headers; event_header; event_header = event_header->next) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Header info: %s => %s\n", event_header->name, event_header->value);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Header info: %s => %s\n", event_header->name, event_header->value);
|
||||||
}
|
}
|
||||||
|
@ -277,9 +276,15 @@ static void transfer_call(switch_core_session_t *session, char *destination)
|
||||||
char *argv[4] = { 0 };
|
char *argv[4] = { 0 };
|
||||||
const char *uuid;
|
const char *uuid;
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
char *mydup;
|
||||||
|
|
||||||
/* TODO: dup dest first */
|
if (!destination) {
|
||||||
switch_separate_string(destination, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mydup = strdup(destination);
|
||||||
|
switch_assert(mydup);
|
||||||
|
switch_separate_string(mydup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
|
|
||||||
/* Find the uuid of our B leg. If it exists, transfer it first */
|
/* Find the uuid of our B leg. If it exists, transfer it first */
|
||||||
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
|
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
|
||||||
|
@ -302,6 +307,7 @@ static void transfer_call(switch_core_session_t *session, char *destination)
|
||||||
|
|
||||||
/* Transfer the A leg */
|
/* Transfer the A leg */
|
||||||
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
|
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
|
||||||
|
free(mydup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -312,7 +318,7 @@ static switch_status_t bill_event(float billamount, const char *billaccount)
|
||||||
char sql[1024] = "";
|
char sql[1024] = "";
|
||||||
SQLHSTMT stmt;
|
SQLHSTMT stmt;
|
||||||
|
|
||||||
snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
|
switch_snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql);
|
||||||
|
|
||||||
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
|
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
|
||||||
|
@ -339,7 +345,7 @@ static float get_balance(const char *billaccount)
|
||||||
#ifdef SWITCH_HAVE_ODBC
|
#ifdef SWITCH_HAVE_ODBC
|
||||||
char sql[1024] = "";
|
char sql[1024] = "";
|
||||||
nibblebill_results_t pdata;
|
nibblebill_results_t pdata;
|
||||||
float balance = 0.00;
|
float balance = 0.00f;
|
||||||
|
|
||||||
memset(&pdata, 0, sizeof(pdata));
|
memset(&pdata, 0, sizeof(pdata));
|
||||||
snprintf(sql, 1024, SQL_LOOKUP, globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
|
snprintf(sql, 1024, SQL_LOOKUP, globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
|
||||||
|
@ -375,7 +381,6 @@ static switch_status_t do_billing(switch_core_session_t *session)
|
||||||
switch_time_t ts = switch_micro_time_now();
|
switch_time_t ts = switch_micro_time_now();
|
||||||
float billamount;
|
float billamount;
|
||||||
char date[80] = "";
|
char date[80] = "";
|
||||||
char *tmp;
|
|
||||||
char *uuid;
|
char *uuid;
|
||||||
switch_size_t retsize;
|
switch_size_t retsize;
|
||||||
switch_time_exp_t tm;
|
switch_time_exp_t tm;
|
||||||
|
@ -438,9 +443,6 @@ static switch_status_t do_billing(switch_core_session_t *session)
|
||||||
/* Have we done any billing on this channel yet? If no, set up vars for doing so */
|
/* Have we done any billing on this channel yet? If no, set up vars for doing so */
|
||||||
if (!nibble_data) {
|
if (!nibble_data) {
|
||||||
nibble_data = switch_core_session_alloc(session, sizeof(*nibble_data));
|
nibble_data = switch_core_session_alloc(session, sizeof(*nibble_data));
|
||||||
if (!nibble_data) {
|
|
||||||
switch_assert(nibble_data);
|
|
||||||
}
|
|
||||||
memset(nibble_data, 0, sizeof(*nibble_data));
|
memset(nibble_data, 0, sizeof(*nibble_data));
|
||||||
|
|
||||||
/* Setup new billing data (based on call answer time, in case this module started late with active calls) */
|
/* Setup new billing data (based on call answer time, in case this module started late with active calls) */
|
||||||
|
@ -470,9 +472,7 @@ static switch_status_t do_billing(switch_core_session_t *session)
|
||||||
nibble_data->bill_adjustments = 0;
|
nibble_data->bill_adjustments = 0;
|
||||||
|
|
||||||
/* Update channel variable with current billing */
|
/* Update channel variable with current billing */
|
||||||
tmp = switch_mprintf("%f", nibble_data->total);
|
switch_channel_set_variable_printf(channel, "nibble_total_billed", "%f", nibble_data->total);
|
||||||
switch_channel_set_variable(channel, "nibble_total_billed", tmp);
|
|
||||||
switch_safe_free(tmp);
|
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to log to database!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to log to database!\n");
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ SWITCH_STANDARD_APP(nibblebill_app_function)
|
||||||
char *lbuf = NULL;
|
char *lbuf = NULL;
|
||||||
char *argv[3] = { 0 };
|
char *argv[3] = { 0 };
|
||||||
|
|
||||||
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
|
if (!switch_strlen_zero(data) && (lbuf = strdup(data))
|
||||||
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
|
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
|
||||||
if (!strcasecmp(argv[0], "adjust") && argc == 2) {
|
if (!strcasecmp(argv[0], "adjust") && argc == 2) {
|
||||||
nibblebill_adjust(session, (float)atof(argv[1]));
|
nibblebill_adjust(session, (float)atof(argv[1]));
|
||||||
|
@ -744,6 +744,7 @@ SWITCH_STANDARD_APP(nibblebill_app_function)
|
||||||
switch_core_session_enable_heartbeat(session, atoi(argv[1]));
|
switch_core_session_enable_heartbeat(session, atoi(argv[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch_safe_free(lbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We get here from the API only (theoretically) */
|
/* We get here from the API only (theoretically) */
|
||||||
|
@ -786,7 +787,7 @@ SWITCH_STANDARD_API(nibblebill_api_function)
|
||||||
stream->write_function(stream, "-USAGE: %s\n", API_SYNTAX);
|
stream->write_function(stream, "-USAGE: %s\n", API_SYNTAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch_safe_free(mycmd);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue