[Freeswitch-svn] [commit] r3526 - freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr

Freeswitch SVN mishehu at freeswitch.org
Sun Dec 3 23:06:04 EST 2006


Author: mishehu
Date: Sun Dec  3 23:06:03 2006
New Revision: 3526

Modified:
   freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp
   freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp
   freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp
   freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp

Log:
Pausing and resuming pop on the queue works fine, made changes in all current loggers to support reloading.  Also fixed it so that files are not created on pddcdr.cpp and xmlcdr.cpp until ::process_record() occurs.

Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp	Sun Dec  3 23:06:03 2006
@@ -179,14 +179,9 @@
 	newchannel->channel = switch_core_session_get_channel(session);
 	assert(newchannel->channel != 0);
 
-	// Need to fix this up a bit so that it reflects a change to switch_caller_profile_t
-	// switch_channel_t will contain caller_profile, and caller_profile will contain
-	// the originator and originatee profile
 	newchannel->session = session;
-	//newchannel->timetable = switch_channel_get_timetable(newchannel->channel);
 	newchannel->callerextension = switch_channel_get_caller_extension(newchannel->channel);
 	newchannel->callerprofile = switch_channel_get_caller_profile(newchannel->channel);
-	//newchannel->originateprofile = switch_channel_get_originator_caller_profile(newchannel->channel);	
 	
 	BaseRegistry& registry(BaseRegistry::get());
 	for(BaseRegistry::iterator it = registry.active_begin(); it != registry.active_end(); ++it)
@@ -199,8 +194,9 @@
 			switch_console_printf(SWITCH_CHANNEL_LOG,"Adding a new logger object to the queue.\n");
 			switch_queue_push(cdrqueue,newloggerobject);
 			newchannel->callerprofile = newchannel->callerprofile->next;
-			newchannel->callerextension = newchannel->callerextension->next;
-		} while (newchannel->callerprofile && newchannel->callerextension);
+			if(newchannel->callerextension)
+				newchannel->callerextension = newchannel->callerextension->next;
+		} while (newchannel->callerprofile);
 		
 	}
 		

Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp	Sun Dec  3 23:06:03 2006
@@ -280,6 +280,13 @@
 void CsvCDR::disconnect()
 {
 	outputfile.close();
+	activated = 0;
+	logchanvars = 0;
+	repeat_fixed_in_supp = 0;
+	outfile_path.clear();
+	chanvars_fixed_list.clear();
+	chanvars_supp_list.clear();
+	connectionstate = 0;
 	switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CsvCDR...  Done!");	
 }
 

Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp	Sun Dec  3 23:06:03 2006
@@ -74,10 +74,7 @@
 		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"
-		outputfile_name.append(".pdd");  // .pdd - "perl data dumper"
-	
-		outputfile.open(outputfile_name.c_str());
-	
+		outputfile_name.append(".pdd");  // .pdd - "perl data dumper"	
 		bool repeat = 1;
 		process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat);
 	}
@@ -148,6 +145,8 @@
 
 bool PddCDR::process_record()
 {
+	outputfile.open(outputfile_name.c_str());
+	
 	bool retval = 0;
 	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());

Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp	Sun Dec  3 23:06:03 2006
@@ -76,9 +76,7 @@
 		outputfile_name.append(".");
 		outputfile_name.append(myuuid);  // The goal is to have a resulting filename of "/path/to/myuuid"
 		outputfile_name.append(".xml");  // .xml - "XML Data Dumper"
-	
-		outputfile.open(outputfile_name.c_str());
-	
+		
 		bool repeat = 1;
 		process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat);
 	}
@@ -150,6 +148,8 @@
 bool XmlCDR::process_record()
 {
 	bool retval = 0;
+	outputfile.open(outputfile_name.c_str());
+	
 	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());
 	else
@@ -215,6 +215,11 @@
 
 void XmlCDR::disconnect()
 {
+	activated = 0;
+	connectionstate = 0;
+	logchanvars = 0;
+	outputfile_path.clear();
+	chanvars_supp_list.clear();
 	switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down XmlCDR...  Done!");	
 }
 



More information about the Freeswitch-svn mailing list