提交 12c47bf9 authored 作者: Michael Jerris's avatar Michael Jerris

change switch_console_printf to switch_log_printf in mod_cdr. Patch from MODAPP-6, thanks Marcel.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4920 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a483c238
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the BaseCDR class that all other CDR classes inherit from. * Description: This C++ source file describes the BaseCDR class that all other CDR classes inherit from.
* It handles the bulk of the processing of data from the switch_channel_t objects. * It handles the bulk of the processing of data from the switch_channel_t objects.
...@@ -214,7 +215,7 @@ void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<st ...@@ -214,7 +215,7 @@ void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<st
{ {
if(fixed) if(fixed)
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Wildcards are not allow in the fixed chanvars list. Item removed.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Wildcards are not allow in the fixed chanvars list. Item removed.\n");
iItr = chanvarlist.erase(iItr); iItr = chanvarlist.erase(iItr);
} }
else else
...@@ -271,19 +272,19 @@ void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<st ...@@ -271,19 +272,19 @@ void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<st
sql_type = CDR_TINY; sql_type = CDR_TINY;
break; break;
default: default:
switch_console_printf(SWITCH_CHANNEL_LOG,"Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n",tempstring2.c_str(),tempstring.c_str()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n", tempstring2.c_str(), tempstring.c_str());
sql_type = CDR_STRING; sql_type = CDR_STRING;
} }
} }
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n",tempstring2.c_str(),tempstring.c_str()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n", tempstring2.c_str(), tempstring.c_str());
sql_type = CDR_STRING; sql_type = CDR_STRING;
} }
} }
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"No parameter set, for channel variable %s, using default type of string.\n",iItr->c_str()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No parameter set, for channel variable %s, using default type of string.\n", iItr->c_str());
sql_type = CDR_STRING; sql_type = CDR_STRING;
tempstring = *iItr; tempstring = *iItr;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the CDRContainer singleton object used by mod_cdr to control * Description: This C++ source file describes the CDRContainer singleton object used by mod_cdr to control
* the creation, processing, and destruction of various CDR logger objects. * the creation, processing, and destruction of various CDR logger objects.
...@@ -53,7 +54,7 @@ CDRContainer::CDRContainer(switch_memory_pool_t *module_pool) ...@@ -53,7 +54,7 @@ CDRContainer::CDRContainer(switch_memory_pool_t *module_pool)
newchannel = 0; newchannel = 0;
if (!(xml = switch_xml_open_cfg(configfile, &cfg, NULL))) if (!(xml = switch_xml_open_cfg(configfile, &cfg, NULL)))
switch_console_printf(SWITCH_CHANNEL_LOG,"open of %s failed\n", configfile); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", configfile);
else else
{ {
BaseRegistry& registry(BaseRegistry::get()); BaseRegistry& registry(BaseRegistry::get());
...@@ -89,7 +90,7 @@ CDRContainer::~CDRContainer() ...@@ -89,7 +90,7 @@ CDRContainer::~CDRContainer()
ptr->disconnect(); ptr->disconnect();
} }
switch_console_printf(SWITCH_CHANNEL_LOG,"mod_cdr shutdown gracefully."); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr shutdown gracefully.");
} }
#ifdef SWITCH_QUEUE_ENHANCED #ifdef SWITCH_QUEUE_ENHANCED
...@@ -225,7 +226,7 @@ void CDRContainer::add_cdr(switch_core_session_t *session) ...@@ -225,7 +226,7 @@ void CDRContainer::add_cdr(switch_core_session_t *session)
basecdr_creator func = *it; basecdr_creator func = *it;
BaseCDR* newloggerobject = func(newchannel); BaseCDR* newloggerobject = func(newchannel);
switch_console_printf(SWITCH_CHANNEL_LOG,"Adding a new logger object to the queue.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding a new logger object to the queue.\n");
switch_queue_push(cdrqueue,newloggerobject); switch_queue_push(cdrqueue,newloggerobject);
} }
newchannel->callerprofile = newchannel->callerprofile->next; newchannel->callerprofile = newchannel->callerprofile->next;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the CsvCDR class that handles processing CDRs to a CSV format. * Description: This C++ source file describes the CsvCDR class that handles processing CDRs to a CSV format.
* This is the standard CSV module, and has a list of predefined variables to log out which can be * This is the standard CSV module, and has a list of predefined variables to log out which can be
...@@ -101,7 +102,7 @@ std::string CsvCDR::display_name = "CsvCDR - The simple comma separated values C ...@@ -101,7 +102,7 @@ std::string CsvCDR::display_name = "CsvCDR - The simple comma separated values C
void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param) void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{ {
switch_console_printf(SWITCH_CHANNEL_LOG, "CsvCDR::connect() - Loading configuration file.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CsvCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected. connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
...@@ -170,7 +171,7 @@ void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -170,7 +171,7 @@ void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
} }
} }
...@@ -182,11 +183,11 @@ void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -182,11 +183,11 @@ void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
if(outputfile.good()) if(outputfile.good())
{ {
activated = 1; activated = 1;
switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR activated, log rotation will occur at or after %d MB\n",(int)(filesize_limit >> 20)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CsvCDR activated, log rotation will occur at or after %d MB\n", (int)(filesize_limit >> 20));
} }
} }
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CsvCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
} }
} }
...@@ -228,7 +229,7 @@ void CsvCDR::open_file() ...@@ -228,7 +229,7 @@ void CsvCDR::open_file()
outputfile.open(filename.c_str(),std::ios_base::app|std::ios_base::binary); outputfile.open(filename.c_str(),std::ios_base::app|std::ios_base::binary);
if(outputfile.fail()) if(outputfile.fail())
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Could not open the CSV file %s . CsvCDR logger will not be functional until this is resolved and a reload is issued. Failbit is set to %d.\n",filename.c_str(),outputfile.fail()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open the CSV file %s . CsvCDR logger will not be functional until this is resolved and a reload is issued. Failbit is set to %d.\n", filename.c_str(), outputfile.fail());
activated = 0; activated = 0;
} }
else else
...@@ -332,7 +333,7 @@ void CsvCDR::disconnect() ...@@ -332,7 +333,7 @@ void CsvCDR::disconnect()
chanvars_fixed_list.clear(); chanvars_fixed_list.clear();
chanvars_supp_list.clear(); chanvars_supp_list.clear();
connectionstate = 0; connectionstate = 0;
switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CsvCDR... Done!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down CsvCDR... Done!\n");
} }
AUTO_REGISTER_BASECDR(CsvCDR); AUTO_REGISTER_BASECDR(CsvCDR);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Bret McDanel <trixter AT 0xdecafbad.com> * Bret McDanel <trixter AT 0xdecafbad.com>
* Anthony Minessale II <anthmct@yahoo.com> * Anthony Minessale II <anthmct@yahoo.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the CurlCDR class that handles processing CDRs to HTTP endpoint. * Description: This C++ source file describes the CurlCDR class that handles processing CDRs to HTTP endpoint.
* This is the standard Curl module, and has a list of predefined variables to log out which can be * This is the standard Curl module, and has a list of predefined variables to log out which can be
...@@ -106,14 +107,14 @@ std::string CurlCDR::postdata; ...@@ -106,14 +107,14 @@ std::string CurlCDR::postdata;
void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param) void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{ {
switch_console_printf(SWITCH_CHANNEL_LOG, "CurlCDR::connect() - Loading configuration file.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CurlCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected. connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
switch_console_printf(SWITCH_CHANNEL_LOG,"Checking to see if curlcdr is valid\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking to see if curlcdr is valid\n");
if ((settings = switch_xml_child(cfg, "curlcdr"))) if ((settings = switch_xml_child(cfg, "curlcdr")))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"curlcdr appears to be!!!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "curlcdr appears to be!!!\n");
int count_config_params = 0; // Need to make sure all params are set before we load int count_config_params = 0; // Need to make sure all params are set before we load
for (param = switch_xml_child(settings, "param"); param; param = param->next) for (param = switch_xml_child(settings, "param"); param; param = param->next)
{ {
...@@ -168,7 +169,7 @@ void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin ...@@ -168,7 +169,7 @@ void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
} }
} }
...@@ -179,13 +180,13 @@ void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin ...@@ -179,13 +180,13 @@ void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
if(strlen(gateway_url)) if(strlen(gateway_url))
{ {
activated = 1; activated = 1;
switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR activated"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CurlCDR activated");
} }
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n");
} }
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a gateway_url to have the records logged to.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CurlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a gateway_url to have the records logged to.\n");
} }
} }
...@@ -370,7 +371,7 @@ void CurlCDR::disconnect() ...@@ -370,7 +371,7 @@ void CurlCDR::disconnect()
chanvars_fixed_list.clear(); chanvars_fixed_list.clear();
chanvars_supp_list.clear(); chanvars_supp_list.clear();
connectionstate = 0; connectionstate = 0;
switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CurlCDR... Done!"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down CurlCDR... Done!");
} }
AUTO_REGISTER_BASECDR(CurlCDR); AUTO_REGISTER_BASECDR(CurlCDR);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This source file describes the most basic portions of the CDR module. These are the functions * Description: This source file describes the most basic portions of the CDR module. These are the functions
* and structures that the Freeswitch core looks for when opening up the DSO file to create the load, shutdown * and structures that the Freeswitch core looks for when opening up the DSO file to create the load, shutdown
...@@ -130,7 +131,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod ...@@ -130,7 +131,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS)
{ {
switch_console_printf(SWITCH_CHANNEL_LOG, "OH OH - Can't swim, no pool\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH - Can't swim, no pool\n");
return SWITCH_STATUS_TERM; return SWITCH_STATUS_TERM;
} }
...@@ -144,7 +145,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod ...@@ -144,7 +145,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void) SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
{ {
RUNNING = 1; RUNNING = 1;
switch_console_printf(SWITCH_CHANNEL_LOG, "mod_cdr made it to runtime. Wee!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr made it to runtime. Wee!\n");
newcdrcontainer->process_records(); newcdrcontainer->process_records();
return RUNNING ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_TERM; return RUNNING ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_TERM;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the MysqlCDR class which handles formatting a CDR out to * Description: This C++ source file describes the MysqlCDR class which handles formatting a CDR out to
* a MySQL 4.1.x or greater server using prepared statements. * a MySQL 4.1.x or greater server using prepared statements.
...@@ -183,7 +184,7 @@ void MysqlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setti ...@@ -183,7 +184,7 @@ void MysqlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setti
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
} }
} }
...@@ -192,7 +193,7 @@ void MysqlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setti ...@@ -192,7 +193,7 @@ void MysqlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setti
if (count_config_params==4) if (count_config_params==4)
activated = 1; activated = 1;
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module. You must specify a hostname, username, password, and database to use MysqlCDR. You only supplied %d parameters.\n",count_config_params); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You did not specify the minimum parameters for using this module. You must specify a hostname, username, password, and database to use MysqlCDR. You only supplied %d parameters.\n", count_config_params);
if(activated) if(activated)
{ {
...@@ -241,7 +242,7 @@ void MysqlCDR::connect_to_database() ...@@ -241,7 +242,7 @@ void MysqlCDR::connect_to_database()
if(mysql_real_connect(conn,hostname,username,password,dbname,0,NULL,0) == NULL) if(mysql_real_connect(conn,hostname,username,password,dbname,0,NULL,0) == NULL)
{ {
const char *error1 = mysql_error(conn); const char *error1 = mysql_error(conn);
switch_console_printf(SWITCH_CHANNEL_LOG,"Cannot connect to MySQL Server. The error was: %s\n",error1); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot connect to MySQL Server. The error was: %s\n", error1);
} }
else else
connectionstate = 1; connectionstate = 1;
...@@ -446,7 +447,7 @@ bool MysqlCDR::process_record() ...@@ -446,7 +447,7 @@ bool MysqlCDR::process_record()
break; break;
} }
default: default:
switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
} }
i++; i++;
} }
...@@ -466,13 +467,13 @@ bool MysqlCDR::process_record() ...@@ -466,13 +467,13 @@ bool MysqlCDR::process_record()
case CR_SERVER_GONE_ERROR: case CR_SERVER_GONE_ERROR:
case CR_SERVER_LOST: case CR_SERVER_LOST:
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"We lost connection to the MySQL server. Trying to reconnect.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We lost connection to the MySQL server. Trying to reconnect.\n");
connect_to_database(); connect_to_database();
break; break;
} }
default: default:
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"We have encountered an unknown error when pinging the MySQL server. Attempting to reconnect anyways.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We have encountered an unknown error when pinging the MySQL server. Attempting to reconnect anyways.\n");
connect_to_database(); connect_to_database();
} }
} }
...@@ -485,10 +486,10 @@ bool MysqlCDR::process_record() ...@@ -485,10 +486,10 @@ bool MysqlCDR::process_record()
if(mysql_stmt_error_code != 0) if(mysql_stmt_error_code != 0)
{ {
errorstate = 1; errorstate = 1;
switch_console_printf(SWITCH_CHANNEL_LOG,"MysqlCDR::process_record() - Statement executed? Error: %d\n",mysql_stmt_error_code); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MysqlCDR::process_record() - Statement executed? Error: %d\n", mysql_stmt_error_code);
const char* mysql_stmt_error_string = mysql_stmt_error(stmt); const char* mysql_stmt_error_string = mysql_stmt_error(stmt);
switch_console_printf(SWITCH_CHANNEL_LOG,"MySQL encountered error: %s\n",mysql_stmt_error_string); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MySQL encountered error: %s\n", mysql_stmt_error_string);
} }
else else
errorstate = 0; errorstate = 0;
...@@ -585,7 +586,7 @@ bool MysqlCDR::process_record() ...@@ -585,7 +586,7 @@ bool MysqlCDR::process_record()
break; break;
} }
default: default:
switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
} }
bool* tempbool = (bool*) temp_chanvars_holder.front(); bool* tempbool = (bool*) temp_chanvars_holder.front();
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the OdbcCDR class which handles formatting a CDR out to * Description: This C++ source file describes the OdbcCDR class which handles formatting a CDR out to
* an ODBC backend using prepared statements. * an ODBC backend using prepared statements.
...@@ -201,7 +202,7 @@ void OdbcCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin ...@@ -201,7 +202,7 @@ void OdbcCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
} }
} }
...@@ -216,7 +217,7 @@ void OdbcCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin ...@@ -216,7 +217,7 @@ void OdbcCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
if (count_config_params==4) if (count_config_params==4)
activated = 1; activated = 1;
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module. You must specify a DSN,hostname, username, password, and database to use OdbcCDR. You only supplied %d parameters.\n",count_config_params); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You did not specify the minimum parameters for using this module. You must specify a DSN,hostname, username, password, and database to use OdbcCDR. You only supplied %d parameters.\n", count_config_params);
if(activated) if(activated)
{ {
...@@ -275,7 +276,7 @@ void OdbcCDR::connect_to_database() ...@@ -275,7 +276,7 @@ void OdbcCDR::connect_to_database()
ODBC_res = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &ODBC_env); ODBC_res = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &ODBC_env);
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error allocating a new ODBC handle.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating a new ODBC handle.\n");
connectionstate = 0; connectionstate = 0;
} }
} }
...@@ -284,7 +285,7 @@ void OdbcCDR::connect_to_database() ...@@ -284,7 +285,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error with ODBCSetEnv\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error with ODBCSetEnv\n");
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env); SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
connectionstate = 0; connectionstate = 0;
} }
...@@ -293,7 +294,7 @@ void OdbcCDR::connect_to_database() ...@@ -293,7 +294,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error AllocHDB %d\n",ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHDB %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env); SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
connectionstate = 0; connectionstate = 0;
} }
...@@ -306,14 +307,14 @@ void OdbcCDR::connect_to_database() ...@@ -306,14 +307,14 @@ void OdbcCDR::connect_to_database()
ODBC_res = SQLConnect(ODBC_con, (SQLCHAR*)dsn, SQL_NTS, (SQLCHAR*)username, SQL_NTS, (SQLCHAR*)password, SQL_NTS); ODBC_res = SQLConnect(ODBC_con, (SQLCHAR*)dsn, SQL_NTS, (SQLCHAR*)username, SQL_NTS, (SQLCHAR*)password, SQL_NTS);
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error connecting to the ODBC database on %d\n",ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to the ODBC database on %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_DBC, ODBC_con); SQLFreeHandle(SQL_HANDLE_DBC, ODBC_con);
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env); SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
connectionstate = 0; connectionstate = 0;
} }
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Connected to %s\n", dsn); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to %s\n", dsn);
connectionstate = 1; connectionstate = 1;
} }
...@@ -325,7 +326,7 @@ void OdbcCDR::connect_to_database() ...@@ -325,7 +326,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
} }
...@@ -333,7 +334,7 @@ void OdbcCDR::connect_to_database() ...@@ -333,7 +334,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
} }
...@@ -343,7 +344,7 @@ void OdbcCDR::connect_to_database() ...@@ -343,7 +344,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_chanvars); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_chanvars);
} }
...@@ -351,7 +352,7 @@ void OdbcCDR::connect_to_database() ...@@ -351,7 +352,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
} }
} }
...@@ -360,7 +361,7 @@ void OdbcCDR::connect_to_database() ...@@ -360,7 +361,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping);
} }
...@@ -368,7 +369,7 @@ void OdbcCDR::connect_to_database() ...@@ -368,7 +369,7 @@ void OdbcCDR::connect_to_database()
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping);
} }
...@@ -400,7 +401,7 @@ bool OdbcCDR::process_record() ...@@ -400,7 +401,7 @@ bool OdbcCDR::process_record()
if(ODBC_res != SQL_SUCCESS && ODBC_res != SQL_SUCCESS_WITH_INFO) if(ODBC_res != SQL_SUCCESS && ODBC_res != SQL_SUCCESS_WITH_INFO)
{ {
// Try to reconnect and reprepare // Try to reconnect and reprepare
switch_console_printf(SWITCH_CHANNEL_LOG,"Error pinging the ODBC backend. Attempt #%d to reconnect.\n",count+1); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error pinging the ODBC backend. Attempt #%d to reconnect.\n", count+1);
connect_to_database(); connect_to_database();
} }
} }
...@@ -502,7 +503,7 @@ bool OdbcCDR::process_record() ...@@ -502,7 +503,7 @@ bool OdbcCDR::process_record()
break; break;
} }
default: default:
switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
} }
i++; i++;
} }
...@@ -585,7 +586,7 @@ bool OdbcCDR::process_record() ...@@ -585,7 +586,7 @@ bool OdbcCDR::process_record()
break; break;
} }
default: default:
switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
} }
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* Contributor(s): * Contributor(s):
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the PddCDR class which handles formatting a CDR out to * Description: This C++ source file describes the PddCDR class which handles formatting a CDR out to
* individual text files in a Perl Data Dumper format. * individual text files in a Perl Data Dumper format.
...@@ -101,7 +102,7 @@ std::string PddCDR::display_name = "PddCDR - Perl Data Dumper CDR logger"; ...@@ -101,7 +102,7 @@ std::string PddCDR::display_name = "PddCDR - Perl Data Dumper CDR logger";
void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param) void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{ {
switch_console_printf(SWITCH_CHANNEL_LOG, "PddCDR::connect() - Loading configuration file.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PddCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected. connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
...@@ -135,11 +136,11 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -135,11 +136,11 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
} }
else if (!strcmp(var, "chanvars_fixed")) else if (!strcmp(var, "chanvars_fixed"))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
} }
else if (!strcmp(var, "chanvars_supp")) else if (!strcmp(var, "chanvars_supp"))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
} }
else if(!strcmp(var,"timezone")) else if(!strcmp(var,"timezone"))
{ {
...@@ -149,7 +150,7 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -149,7 +150,7 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
} }
} }
...@@ -158,7 +159,7 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -158,7 +159,7 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
if(count_config_params > 0) if(count_config_params > 0)
activated = 1; activated = 1;
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PddCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
} }
} }
...@@ -168,7 +169,7 @@ bool PddCDR::process_record() ...@@ -168,7 +169,7 @@ bool PddCDR::process_record()
bool retval = 0; bool retval = 0;
if(!outputfile) if(!outputfile)
switch_console_printf(SWITCH_CHANNEL_LOG, "PddCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PddCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
else else
{ {
// Format the call record and proceed from here... // Format the call record and proceed from here...
...@@ -247,7 +248,7 @@ void PddCDR::disconnect() ...@@ -247,7 +248,7 @@ void PddCDR::disconnect()
logchanvars = 0; logchanvars = 0;
outputfile_path.clear(); outputfile_path.clear();
chanvars_supp_list.clear(); chanvars_supp_list.clear();
switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down PddCDR... Done!"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down PddCDR... Done!");
} }
AUTO_REGISTER_BASECDR(PddCDR); AUTO_REGISTER_BASECDR(PddCDR);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
* *
* Yossi Neiman <freeswitch AT cartissolutions.com> * Yossi Neiman <freeswitch AT cartissolutions.com>
* Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com> * Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* *
* Description: This C++ source file describes the XmlCDR class which handles formatting a CDR out to * Description: This C++ source file describes the XmlCDR class which handles formatting a CDR out to
* individual text files in a XML format. * individual text files in a XML format.
...@@ -103,7 +104,7 @@ std::string XmlCDR::display_name = "XmlCDR - The rough implementation of XML CDR ...@@ -103,7 +104,7 @@ std::string XmlCDR::display_name = "XmlCDR - The rough implementation of XML CDR
void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param) void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{ {
switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::connect() - Loading configuration file.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected. connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
...@@ -137,11 +138,11 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -137,11 +138,11 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
} }
else if (!strcmp(var, "chanvars_fixed")) else if (!strcmp(var, "chanvars_fixed"))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
} }
else if (!strcmp(var, "chanvars_supp")) else if (!strcmp(var, "chanvars_supp"))
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
} }
else if(!strcmp(var,"timezone")) else if(!strcmp(var,"timezone"))
{ {
...@@ -151,7 +152,7 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -151,7 +152,7 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
else else
{ {
switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt; convert_time = switch_time_exp_lt;
} }
} }
...@@ -160,7 +161,7 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting ...@@ -160,7 +161,7 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
if(count_config_params > 0) if(count_config_params > 0)
activated = 1; activated = 1;
else else
switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XmlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
} }
} }
...@@ -170,10 +171,10 @@ bool XmlCDR::process_record() ...@@ -170,10 +171,10 @@ bool XmlCDR::process_record()
outputfile.open(outputfile_name.c_str()); outputfile.open(outputfile_name.c_str());
if(!outputfile) if(!outputfile)
switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XmlCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n", outputfile_name.c_str());
else else
{ {
//switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Preping the CDR to %s.\n",outputfile_name.c_str()); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::process_record(): Preping the CDR to %s.\n", outputfile_name.c_str());
// Format the call record and proceed from here... // Format the call record and proceed from here...
outputfile << "<?xml version=\"1.0\"?>" << std::endl; outputfile << "<?xml version=\"1.0\"?>" << std::endl;
outputfile << "<document type=\"freeswitch-cdr/xml\">" << std::endl; outputfile << "<document type=\"freeswitch-cdr/xml\">" << std::endl;
...@@ -215,7 +216,7 @@ bool XmlCDR::process_record() ...@@ -215,7 +216,7 @@ bool XmlCDR::process_record()
} }
outputfile << "\t</chanvars>" << std::endl << "</document>" << std::endl << std::endl; outputfile << "\t</chanvars>" << std::endl << "</document>" << std::endl << std::endl;
//switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Dumping the CDR to %s.\n",outputfile_name.c_str()); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::process_record(): Dumping the CDR to %s.\n", outputfile_name.c_str());
retval = 1; retval = 1;
} }
...@@ -249,7 +250,7 @@ void XmlCDR::disconnect() ...@@ -249,7 +250,7 @@ void XmlCDR::disconnect()
logchanvars = 0; logchanvars = 0;
outputfile_path.clear(); outputfile_path.clear();
chanvars_supp_list.clear(); chanvars_supp_list.clear();
switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down XmlCDR... Done!"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down XmlCDR... Done!");
} }
AUTO_REGISTER_BASECDR(XmlCDR); AUTO_REGISTER_BASECDR(XmlCDR);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论