Author: mishehu Date: Tue Jul 11 20:12:18 2006 New Revision: 1836 Modified: freeswitch/branches/mishehu/src/mod/applications/mod_conference/mod_conference.c freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp freeswitch/branches/mishehu/src/mod/loggers/mod_syslog/mod_syslog.c freeswitch/branches/mishehu/src/switch_core.c freeswitch/branches/mishehu/src/switch_loadable_module.c Log: Discovered a bug on non-varchar null commits to MySQL in MysqlCDR. Need to debug. Modified: freeswitch/branches/mishehu/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/branches/mishehu/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/branches/mishehu/src/mod/applications/mod_conference/mod_conference.c Tue Jul 11 20:12:18 2006 @@ -557,7 +557,7 @@ for (x = 0; x < imember->read / 2; x++) { int32_t z = muxed[x] + bptr[x]; normalize_to_16bit(z); - muxed[x] = z; + muxed[x] = (int16_t)z; } ready++; Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp ============================================================================== --- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp (original) +++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp Tue Jul 11 20:12:18 2006 @@ -64,7 +64,7 @@ char callenddate_forfile[25]; switch_strftime(callenddate_forfile,&retsizeceff,sizeof(callenddate_forfile),format_forfile,&tempcallend); outputfile_name = outputfile_path; - outputfile_name.append("/"); + outputfile_name.append(SWITCH_PATH_SEPARATOR); outputfile_name.append(callenddate_forfile); // Make sorting a bit easier, kinda like Maildir does outputfile_name.append("."); outputfile_name.append(myuuid); // The goal is to have a resulting filename of "/path/to/myuuid" Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp ============================================================================== --- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp (original) +++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp Tue Jul 11 20:12:18 2006 @@ -217,7 +217,7 @@ } } -void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarlist,std::vector<switch_mod_cdr_sql_types>& chanvars_fixed_types) +void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarlist,std::vector<switch_mod_cdr_sql_types_t>& chanvars_fixed_types) { bool fixed = 1; std::string tempstring, tempstring2; @@ -297,13 +297,14 @@ char *tempvariable; tempvariable = switch_channel_get_variable(channel,tempstring); + + std::pair<std::string,std::string> temppair; + temppair.first = *iItr; + if(tempvariable != 0) - { - std::pair<std::string,std::string> temppair; - temppair.first = *iItr; temppair.second = tempvariable; - chanvars_fixed.push_back(temppair); - } + + chanvars_fixed.push_back(temppair); } } Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h ============================================================================== --- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h (original) +++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h Tue Jul 11 20:12:18 2006 @@ -67,7 +67,7 @@ virtual void reread_tempdumped_records() = 0; protected: void parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarslist,bool fixed); - void parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarslist,std::vector<switch_mod_cdr_sql_types>& chanvars_fixed_types); // Typically used for SQL types + void parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarslist,std::vector<switch_mod_cdr_sql_types_t>& chanvars_fixed_types); // Typically used for SQL types void process_channel_variables(const std::list<std::string>& stringlist,const std::list<std::string>& fixedlist,switch_channel_t *channel,bool repeat = 1); //This is used for supplemental chanvars void process_channel_variables(const std::list<std::string>& stringlist,switch_channel_t *channel); // This is used for fixed chanvars switch_time_t callstartdate; Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp ============================================================================== --- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp (original) +++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp Tue Jul 11 20:12:18 2006 @@ -190,7 +190,7 @@ switch_strftime(formatteddate,&retsize,100,format,&now_converted); std::string filename = outputfile_path; - filename.append("/"); + filename.append(SWITCH_PATH_SEPARATOR); filename.append(formatteddate); filename.append(".csv"); outputfile.clear(); @@ -208,50 +208,48 @@ { check_file_size_and_open(); bool retval = 0; - if(active) + + // Format the call record and proceed from here... + outputfile << "\"" << callstartdate << "\",\""; + outputfile << callanswerdate << "\",\""; + outputfile << callenddate << "\",\""; + outputfile << hangupcause_text << "\",\""; + outputfile << hangupcause << "\",\""; + outputfile << clid << "\",\""; + outputfile << originated << "\",\""; + outputfile << dialplan << "\",\""; + outputfile << myuuid << "\",\""; + outputfile << destuuid << "\",\""; + outputfile << src << "\",\""; + outputfile << dst << "\",\""; + outputfile << srcchannel << "\",\""; + outputfile << dstchannel << "\",\""; + outputfile << ani << "\",\""; + outputfile << ani2 << "\",\""; + outputfile << network_addr << "\",\""; + outputfile << lastapp << "\",\""; + outputfile << lastdata << "\",\""; + outputfile << billusec << "\",\""; + outputfile << disposition << "\",\""; + outputfile << amaflags << "\""; + + // Now to process chanvars, fixed ones first + if(chanvars_fixed.size() > 0 ) { - // Format the call record and proceed from here... - outputfile << "\"" << callstartdate << "\",\""; - outputfile << callanswerdate << "\",\""; - outputfile << callenddate << "\",\""; - outputfile << hangupcause_text << "\",\""; - outputfile << hangupcause << "\",\""; - outputfile << clid << "\",\""; - outputfile << originated << "\",\""; - outputfile << dialplan << "\",\""; - outputfile << myuuid << "\",\""; - outputfile << destuuid << "\",\""; - outputfile << src << "\",\""; - outputfile << dst << "\",\""; - outputfile << srcchannel << "\",\""; - outputfile << dstchannel << "\",\""; - outputfile << ani << "\",\""; - outputfile << ani2 << "\",\""; - outputfile << network_addr << "\",\""; - outputfile << lastapp << "\",\""; - outputfile << lastdata << "\",\""; - outputfile << billusec << "\",\""; - outputfile << disposition << "\",\""; - outputfile << amaflags << "\""; + std::list<std::pair<std::string,std::string> >::iterator iItr, iEnd; + for(iItr = chanvars_fixed.begin(), iEnd = chanvars_fixed.end(); iItr != iEnd; iItr++) + outputfile << ",\"" << iItr->second << "\""; + } - // Now to process chanvars, fixed ones first - if(chanvars_fixed.size() > 0 ) - { - std::list<std::pair<std::string,std::string> >::iterator iItr, iEnd; - for(iItr = chanvars_fixed.begin(), iEnd = chanvars_fixed.end(); iItr != iEnd; iItr++) - outputfile << ",\"" << iItr->second << "\""; - } - - if(chanvars_supp.size() > 0 ) - { - std::map<std::string,std::string>::iterator iItr,iEnd; - for(iItr = chanvars_supp.begin(), iEnd = chanvars_supp.end() ; iItr != iEnd; iItr++) - outputfile << ",\"" << iItr->first << "=" << iItr->second << "\""; - } - outputfile << std::endl; - retval = 1; + if(chanvars_supp.size() > 0 ) + { + std::map<std::string,std::string>::iterator iItr,iEnd; + for(iItr = chanvars_supp.begin(), iEnd = chanvars_supp.end() ; iItr != iEnd; iItr++) + outputfile << ",\"" << iItr->first << "=" << iItr->second << "\""; } - + outputfile << std::endl; + retval = 1; + return retval; } Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp ============================================================================== --- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp (original) +++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp Tue Jul 11 20:12:18 2006 @@ -249,7 +249,7 @@ if(is_null) temp_bind.is_null = (my_bool*)1; - temp_bind.buffer = ¶m; + temp_bind.buffer = ¶m; bindme.push_back(temp_bind); } @@ -263,9 +263,9 @@ temp_bind.buffer_type = type; if(is_null) temp_bind.is_null = (my_bool*)1; + else + temp_bind.buffer = ¶m; - temp_bind.buffer = ¶m; - bindme.push_back(temp_bind); } @@ -364,8 +364,10 @@ short* x = new short; *x = 0; bool is_null = 0; + std::cout << "CDR_TINY: " << iItr->second << " and its size is " << iItr->second.size() << " bytes." << std::endl << std::endl; if(iItr->second.size() > 0) { + std::cout << "Converting iItr->second to type short." << std::endl; std::istringstream istring(iItr->second); istring >> *x; } Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_syslog/mod_syslog.c ============================================================================== --- freeswitch/branches/mishehu/src/mod/loggers/mod_syslog/mod_syslog.c (original) +++ freeswitch/branches/mishehu/src/mod/loggers/mod_syslog/mod_syslog.c Tue Jul 11 20:12:18 2006 @@ -106,12 +106,15 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename) { *interface = &console_module_interface; + switch_status_t status; - switch_log_bind_logger(mod_syslog_logger, SWITCH_LOG_DEBUG); + if ((status=load_config()) != SWITCH_STATUS_SUCCESS) { + return status; + } - load_config(); - openlog(globals.ident, LOG_PID, LOG_USER); + + switch_log_bind_logger(mod_syslog_logger, SWITCH_LOG_DEBUG); return SWITCH_STATUS_SUCCESS; } @@ -129,27 +132,28 @@ char *var, *val; char *cf = "syslog.conf"; - if (!switch_config_open_file(&cfg, cf)) { + memset(&globals, 0, sizeof(globals)); + + if (switch_config_open_file(&cfg, cf)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf); - return SWITCH_STATUS_TERM; - } - while (switch_config_next_pair(&cfg, &var, &val)) { - if (!strcasecmp(cfg.category, "settings")) { - if (!strcmp(var, "ident")) { - set_global_ident(val); - } else if (!strcmp(var, "facility")) { - set_global_facility(val); - } else if (!strcmp(var, "format")) { - set_global_format(val); - } else if (!strcmp(var, "level")) { - set_global_level(val);; + while (switch_config_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(cfg.category, "settings")) { + if (!strcmp(var, "ident")) { + set_global_ident(val); + } else if (!strcmp(var, "facility")) { + set_global_facility(val); + } else if (!strcmp(var, "format")) { + set_global_format(val); + } else if (!strcmp(var, "level")) { + set_global_level(val);; + } } } + + switch_config_close_file(&cfg); } - switch_config_close_file(&cfg); - if (switch_strlen_zero(globals.ident)) { set_global_ident(DEFAULT_IDENT); } Modified: freeswitch/branches/mishehu/src/switch_core.c ============================================================================== --- freeswitch/branches/mishehu/src/switch_core.c (original) +++ freeswitch/branches/mishehu/src/switch_core.c Tue Jul 11 20:12:18 2006 @@ -2870,9 +2870,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err) { + switch_xml_t xml = NULL, cfg = NULL; memset(&runtime, 0, sizeof(runtime)); runtime.session_limit = 1000; - switch_xml_t xml = NULL, cfg = NULL; switch_core_set_globals(); Modified: freeswitch/branches/mishehu/src/switch_loadable_module.c ============================================================================== --- freeswitch/branches/mishehu/src/switch_loadable_module.c (original) +++ freeswitch/branches/mishehu/src/switch_loadable_module.c Tue Jul 11 20:12:18 2006 @@ -668,7 +668,7 @@ name = prefs[x]; if ((p = strchr(name, '@'))) { p++; - len = p-name; + len = (uint32_t)(p-name); if (len > sizeof(buf)) { len = sizeof(buf); @@ -683,7 +683,7 @@ for (imp = codec_interface->implementations; imp; imp = imp->next) { if (!interval) { array[i++] = imp; - } else if ((imp->microseconds_per_frame / 1000) == interval) { + } else if ((uint32_t)(imp->microseconds_per_frame / 1000) == interval) { array[i++] = imp; } }