[Freeswitch-svn] [commit] r1600 - in freeswitch/branches/mishehu/src: include mod/applications/mod_rss mod/loggers/mod_cdr

mishehu at freeswitch.org mishehu at freeswitch.org
Sun Jun 11 18:13:21 EDT 2006


Author: mishehu
Date: Sun Jun 11 18:13:20 2006
New Revision: 1600

Modified:
   freeswitch/branches/mishehu/src/include/switch_core.h
   freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h
   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/baseregistry.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/syslogcdr.cpp

Log:
Refactored some more code, cleaned up param passing, created struct switch_mod_cdr_newchannel_t and use that now in all ctors of BaseCDR and derivatives.  Merged up to trunk r1599.

Modified: freeswitch/branches/mishehu/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_core.h	(original)
+++ freeswitch/branches/mishehu/src/include/switch_core.h	Sun Jun 11 18:13:20 2006
@@ -111,7 +111,7 @@
 /*! 
   \brief Initilize the core
   \param console optional FILE stream for output
-  \param a pointer to set any errors to
+  \param err a pointer to set any errors to
   \note to be called at application startup
 */
 SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err);

Modified: freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c	(original)
+++ freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c	Sun Jun 11 18:13:20 2006
@@ -53,7 +53,7 @@
 #define TTS_DEFAULT_ENGINE "cepstral"
 #define TTS_DEFAULT_VOICE "david"
 
-struct shashdot_entry {
+struct rss_entry {
 	uint8_t inuse;
 	char *title_txt;
 	char *description_txt;
@@ -82,7 +82,7 @@
 
 /*
   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
-   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
 */
 static switch_status_t on_dtmf(switch_core_session_t *session, char *dtmf, void *buf, unsigned int buflen)
 {
@@ -154,7 +154,7 @@
 	const char *err = NULL;
 	struct dtmf_buffer dtb = {0};
 	switch_xml_t xml = NULL, item, xchannel = NULL;
-	struct shashdot_entry entries[TTS_MAX_ENTRIES] = {{0}};
+	struct rss_entry entries[TTS_MAX_ENTRIES] = {{0}};
 	uint32_t i = 0;
 	char *title_txt = "", *description_txt = "", *rights_txt = "";
 	switch_codec_t speech_codec, *codec = switch_core_session_get_read_codec(session);
@@ -287,6 +287,7 @@
 		filename = NULL;
 		len = idx = 0;
 		*cmd = '\0';
+		title_txt = description_txt = rights_txt = "";
 
 		if (jumpto > -1) {
 			snprintf(cmd, sizeof(cmd), "%d", jumpto);
@@ -333,7 +334,7 @@
 				/* Hmmm... I know there are no more matches so I don't *need* them to press pound but 
 				   I already told them to press it.  Will this confuse people or not?  Let's make em press 
 				   pound unless this define is enabled for now.
-				 */
+				*/
 			} else if (match_count(cmd, feed_index) > 1) {
 #else
 			} else {
@@ -407,6 +408,8 @@
 				item = switch_xml_child(xchannel, "item");
 			}
 		}
+
+		memset(entries, 0, sizeof(entries));
 
 		for (i = 0; item; item = item->next) {
 			switch_xml_t title, description, subject, dept;

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	Sun Jun 11 18:13:20 2006
@@ -10,7 +10,7 @@
 	memset(formattedcallendate,0,100);
 }
 
-AnthmCDR::AnthmCDR(switch_channel *channel) : BaseCDR(channel)
+AnthmCDR::AnthmCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel)
 {
 	memset(formattedcallstartdate,0,100);
 	memset(formattedcallanswerdate,0,100);

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h	Sun Jun 11 18:13:20 2006
@@ -12,8 +12,8 @@
 class AnthmCDR : public BaseCDR {
 	public:
 		AnthmCDR();
-		AnthmCDR(switch_channel_t *channel);
-		AnthmCDR(const AnthmCDR& copyFrom);
+		AnthmCDR(switch_mod_cdr_newchannel_t *newchannel);
+		//AnthmCDR(const AnthmCDR& copyFrom);
 		virtual ~AnthmCDR();
 		virtual bool process_record();
 		virtual void connect(switch_xml_t *cfg, switch_xml_t *xml, switch_xml_t *settings, switch_xml_t *param); // connect and disconnect need to be static because we're persisting connections until shutdown

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	Sun Jun 11 18:13:20 2006
@@ -20,7 +20,7 @@
 	errorstate = 0;
 }
 
-BaseCDR::BaseCDR(switch_channel *channel,switch_channel_timetable_t *temptimes,switch_caller_extension_t *tempcallerextension,switch_caller_profile_t *tempcallerprofile, switch_caller_profile_t *temporiginateprofile,bool& temporiginate)
+BaseCDR::BaseCDR(switch_mod_cdr_newchannel_t *newchannel)
 {
 	if(channel != 0)
 	{
@@ -30,6 +30,7 @@
 		memset(destuuid,0,37);
 		memset(dialplan,0,80);
 		memset(&hangupcause,0,sizeof(hangupcause));
+		memset(hangupcause_text,0,80);
 		memset(src,0,80);
 		memset(dst,0,80);
 		memset(srcchannel,0,80);
@@ -46,42 +47,64 @@
 		*/
 	}
 
-	callstartdate= temptimes->created;
-	callanswerdate = temptimes->answered;
-	callenddate = temptimes->hungup;
+	callstartdate= newchannel->timetable->created;
+	callanswerdate = newchannel->timetable->answered;
+	callenddate = newchannel->timetable->hungup;
+	
+	if(newchannel->callerprofile->caller_id_name != 0)
+	{
+		strncpy(clid,newchannel->callerprofile->caller_id_name,strlen(newchannel->callerprofile->caller_id_name));
+		strncat(clid," ",1);
+		if(newchannel->callerprofile->caller_id_number != 0 )
+			strncat(clid,newchannel->callerprofile->caller_id_number,strlen(clid)+strlen(newchannel->callerprofile->caller_id_number));
+	}
 		
-	strncpy(clid,tempcallerprofile->caller_id_name,strlen(tempcallerprofile->caller_id_name));
-	strncat(clid," ",1);
-	strncat(clid,tempcallerprofile->caller_id_number,strlen(clid)+strlen(tempcallerprofile->caller_id_number));
-		
 		// Get the ANI information if it's set
-	if(tempcallerprofile->ani != 0)
-		strncpy(ani,tempcallerprofile->ani,strlen(tempcallerprofile->ani));
-	if(tempcallerprofile->ani2 != 0)
-		strncpy(ani2,tempcallerprofile->ani2,strlen(tempcallerprofile->ani2));
+	if(newchannel->callerprofile->ani != 0)
+		strncpy(ani,newchannel->callerprofile->ani,strlen(newchannel->callerprofile->ani));
+	if(newchannel->callerprofile->ani2 != 0)
+		strncpy(ani2,tempcallerprofile->ani2,strlen(newchannel->callerprofile->ani2));
 	
-	if(tempcallerprofile->dialplan != 0)
-		strncpy(dialplan,tempcallerprofile->dialplan,strlen(tempcallerprofile->dialplan));
+	if(newchannel->callerprofile->dialplan != 0)
+		strncpy(dialplan,tempcallerprofile->dialplan,strlen(newchannel->callerprofile->dialplan));
 	
-	if(tempcallerprofile->network_addr != 0)
-		strncpy(network_addr,tempcallerprofile->network_addr,strlen(tempcallerprofile->network_addr));
+	if(newchannel->callerprofile->network_addr != 0)
+		strncpy(network_addr,newchannel->callerprofile->network_addr,strlen(newchannel->callerprofile->network_addr));
 		
-	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BaseCDR::BaseCDR(switch_channel*) - Channel caller_profile loaded.\n");
+	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Channel caller_profile loaded.\n");
 		
-	originated = temporiginate;
+	originated = newchannel->originate;
 	
-	strncpy(destuuid,temporiginateprofile->uuid,strlen(temporiginateprofile->uuid));
-	strncpy(dst,tempcallerprofile->caller_id_number,strlen(tempcallerprofile->caller_id_number));
-	strncpy(src,tempcallerprofile->caller_id_number,strlen(tempcallerprofile->caller_id_number));
-	strncpy(dstchannel,temporiginateprofile->chan_name,strlen(temporiginateprofile->chan_name));
+	if(newchannel->originateprofile->uuid != 0)
+		strncpy(destuuid,newchannel->originateprofile->uuid,strlen(newchannel->originateprofile->uuid));
+	
+	// We still need to check if this is originated or not
+	if(originated == 0)
+	{
+		if(newchannel->callerprofile->destination_number != 0)
+			strncpy(src,newchannel->callerprofile->destination_number,strlen(newchannel->callerprofile->destination_number));
+		if(newchannel->callerprofile->caller_id_number != 0)
+			strncpy(dst,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
+		if(newchannel->originateprofile->chan_name != 0)
+			strncpy(dstchannel,newchannel->originateprofile->chan_name,strlen(newchannel->originateprofile->chan_name));
+	}
+	else
+	{
+		if(newchannel->callerprofile->caller_id_number != 0)
+			strncpy(src,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
+		if(newchannel->callerprofile->destination_number != 0)
+			strncpy(dst,newchannel->callerprofile->destination_number,strlen(newchannel->callerprofile->destination_number));
+		if(newchannel->originateprofile->chan_name != 0)
+			strncpy(dstchannel,newchannel->originateprofile->chan_name,strlen(newchannel->originateprofile->chan_name));
+	}
 		
-	strncpy(myuuid,tempcallerprofile->uuid,strlen(tempcallerprofile->uuid));
-	strncpy(srcchannel,tempcallerprofile->chan_name,strlen(tempcallerprofile->chan_name));
+	strncpy(myuuid,newchannel->callerprofile->uuid,strlen(newchannel->callerprofile->uuid));
+	strncpy(srcchannel,newchannel->callerprofile->chan_name,strlen(newchannel->callerprofile->chan_name));
 		
-	if(switch_channel_test_flag(channel,CF_ANSWERED))
+	if(switch_channel_test_flag(newchannel->channel,CF_ANSWERED))
 	{
 		disposition=1;
-		billusec = temptimes->hungup - temptimes->answered;
+		billusec = newchannel->timetable->hungup - newchannel->timetable->answered;
 	}
 	else
 	{
@@ -90,19 +113,19 @@
 	}
 		
 	// What was the hangup cause?
-	hangupcause = switch_channel_get_cause(channel);
+	hangupcause = switch_channel_get_cause(newchannel->channel);
 	hangupcause_text = switch_channel_cause2str(hangupcause);
 	
-	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BaseCDR::BaseCDR(switch_channel*) - Call state & length calculated.\n");
+	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Call state & length calculated.\n");
 		
-	if(tempcallerextension != 0)
-		if(tempcallerextension->last_application != 0)
-	{
-		if(tempcallerextension->last_application->application_name != 0)
-			strncpy(lastapp,tempcallerextension->last_application->application_name,strlen(tempcallerextension->last_application->application_name));
-		if(tempcallerextension->last_application->application_data != 0)
-			strncpy(lastdata,tempcallerextension->last_application->application_data,strlen(tempcallerextension->last_application->application_data));
-	}
+	if(newchannel->callerextension != 0)
+		if(newchannel->callerextension->last_application != 0)
+		{
+			if(newchannel->callerextension->last_application->application_name != 0)
+				strncpy(lastapp,newchannel->callerextension->last_application->application_name,strlen(newchannel->callerextension->last_application->application_name));
+			if(newchannel->callerextension->last_application->application_data != 0)
+				strncpy(lastdata,newchannel->callerextension->last_application->application_data,strlen(newchannel->callerextension->last_application->application_data));
+		}
 		
 	amaflags=0; // For future use I guess?  I don't see anything in the docs about this
 	/*
@@ -110,7 +133,7 @@
 	strncpy(uniqueid," ",1);  // I don't see any of the user stuff in the docs yet
 	strncpy(userfield," ",1); // So we can't add these yet
 	*/
-	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BaseCDR::BaseCDR(switch_channel*) - Processing completed.\n");
+	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Processing completed.\n");
 
 }
 

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	Sun Jun 11 18:13:20 2006
@@ -20,11 +20,22 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+struct switch_mod_cdr_newchannel_t 
+{
+	switch_channel_t *channel;
+	switch_channel_timetable_t *timetable;
+	switch_caller_extension_t *callerextension;
+	switch_caller_profile_t *callerprofile;
+	switch_caller_profile_t *originateprofile;
+	bool originate;
+};
+
+
 class BaseCDR {
 	public:
 		BaseCDR();
 		virtual ~BaseCDR();
-		BaseCDR(switch_channel_t *channel,switch_channel_timetable_t *temptimes,switch_caller_extension_t *tempcallerextension,switch_caller_profile_t *tempcallerprofile, switch_caller_profile_t *temporiginateprofile,bool& temporiginate);
+		BaseCDR(switch_mod_cdr_newchannel_t *newchannel);
 		//BaseCDR(const BaseCDR& copyFrom);
 		virtual void connect(switch_xml_t *cfg, switch_xml_t *xml, switch_xml_t *settings, switch_xml_t *param) = 0;
 		virtual void disconnect() = 0;
@@ -65,8 +76,6 @@
 		*/
 		bool errorstate; // True if there is an error writing the log
 };
-
-
 
 #endif
 #endif

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h	Sun Jun 11 18:13:20 2006
@@ -6,12 +6,12 @@
 #ifdef __cplusplus
 #include <vector>
 
-template<class T> BaseCDR* basecdr_factory(channel,temptimes,tempcallerextension,tempcallerprofile, temporiginateprofile,temporiginate)
+template<class T> BaseCDR* basecdr_factory(newchannel)
 {
-	return new T(channel,temptimes,tempcallerextension,tempcallerprofile,temporiginateprofile,temporiginate);
+	return new T(newchannel);
 }
 
-typedef BaseCDR* (*basecdr_creator)(switch_channel_t *channel,switch_channel_timetable_t *temptimes,switch_caller_extension_t *tempcallerextension,switch_caller_profile_t *tempcallerprofile, switch_caller_profile_t *temporiginateprofile,bool& temporiginate);
+typedef BaseCDR* (*basecdr_creator)(switch_mod_cdr_newchannel_t *newchannel);
 
 class BaseRegistry
 {

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp	Sun Jun 11 18:13:20 2006
@@ -17,19 +17,10 @@
 	char *configfile = "mod_cdr.conf";
 	switch_xml_t cfg, xml, settings, param;
 	
-	switch_channel_timetable_t *temptimetable = new switch_channel_timetable_t;
-	memset(0,temptimetable,sizeof(*temptimetable));
+	switch_mod_cdr_newchannel_t *newchannel = new switch_mod_cdr_newchannel_t;
+	memset(0,newchannel,sizeof(newchannel));
 	
-	switch_channel_caller_extension_t *tempcallerextension = new switch_channel_caller_extension_t;
-	memset(0,tempcallerextension,sizeof(*tempcallerextension));
 	
-	switch_channel_caller_profile_t *tempcallerprofile, *temporiginateprofile;
-	tempcallerprofile = new switch_channel_caller_profile;
-	temporiginateprofile = new switch_channel_caller_profile;
-	memset(0,tempcallerprofile,sizeof(*tempcallerprofile));
-	memset(0,temporiginateprofile,sizeof(*temporiginateprofile));
-	bool temporiginate = 0;
-	
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 	else
@@ -46,10 +37,7 @@
 
 	switch_xml_free(xml);
 	
-	delete temptimetable;
-	delete tempcallerextension;
-	delete tempcallerprofile;
-	delete temporiginateprofile;
+	delete newchannel;
 }
 
 CDRContainer::~CDRContainer()
@@ -73,59 +61,60 @@
 
 void CDRContainer::add_cdr(switch_channel_t *channel)
 {
+	switch_mod_cdr_newchannel_t *newchannel = new switch_mod_cdr_newchannel_t;
+	memset(0,newchannel,sizeof(*newchannel));
+	
+	newchannel->timetable = switch_channel_get_timetables(channel);
+	newchannel->callerextension = switch_channel_get_caller_extension(channel);
+	newchannel->callerprofile = switch_channel_get_caller_profile(channel);
+	newchannel->originateprofile = switch_channel_get_originator_caller_profile(channel);	
+	
 	BaseRegistry& registry(BaseRegistry::get());
 	for(BaseRegistry::iterator it = registry.begin(); it != registry.end(); ++it)
 	{
-		// Since we are now tracking transfers, etc, a call may have additional records in it
-		// Get out the channel stuff that is a linked list
-		switch_channel_timetable_t *temptimes;
-		temptimes = switch_channel_get_timetable(channel);
-			
-		switch_caller_extension *tempcallerextension;
-		tempcallerextension = switch_channel_get_caller_extension(channel);
-		
-		switch_caller_profile *tempcallerprofile = switch_channel_get_caller_profile(channel);
-
-		switch_caller_profile *temporiginateprofile; // This is a temp pointer for either originator_caller_profile or originatee_caller_profile
-		temporiginateprofile = switch_channel_get_originator_caller_profile(channel);
-
 		/* 
 		   First time it might be originator profile, or originatee.  Second and 
 		   after is always going to be originatee profile.
 		*/
-
-		bool temporiginate = 0;
-		if(temporiginateprofile != 0)
+		
+		basecdr_creator func = *it;
+		
+		if(newchannel->originateprofile != 0 )
 		{
-			add_to_queue(channel,temptimes,tempcallerextension,tempcallerprofile,temporiginateprofile,temporiginate);
-			if(timetables->next != 0)
+			BaseCDR* newloggerobject = func(newchannel);
+			switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding a new logger object to the queue.\n");
+			switch_queue_push(cdrqueue,newloggerobject);
+			
+			if(newchannel->timetable->next != 0)
 			{
-				temporiginateprofile = switch_channel_get_originatee_profile(channel);
-				temporiginate = 1;
-			};	
+				newchannel->originateprofile = switch_channel_get_originatee_profile(channel);
+				newchannel->originate = 1;
+			}	
 		}
 		else
 		{
-			temporiginateprofile = switch_channel_get_originatee_profile(channel);
-			temporiginate = 1;
-			add_to_queue(channel,temptimes,tempcallerextension,tempcallerprofile,temporiginateprofile,temporiginate);
+			newchannel->originateprofile = switch_channel_get_originatee_profile(channel);
+			newchannel->originate = 1;
+			
+			BaseCDR* newloggerobject = func(newchannel);
+			switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding a new logger object to the queue.\n");
+			switch_queue_push(cdrqueue,newloggerobject);
 		}
 		
-		while (temptimes->next != 0 && tempcallerextension->next != 0 && tempcallerprofile->next != 0 && temporiginateprofile->next != 0 ) 
+		while (newchannel->timetable->next != 0 && newchannel->callerextension->next != 0 && newchannel->callerprofile->next != 0 && newchannel->originateprofile->next != 0 ) 
 		{			
-			temptimes = temptimes->next;
-			tempcallerprofile = tempcallerprofile->next;
+			newchannel->timetable = newchannel->timetable->next;
+			newchannel->callerprofile = newchannel->callerprofile->next;
+			newchannel->callerextension = newchannel->callerextension->next;
+			newchannel->originateprofile = newchannel->originateprofile->next;
 			
+			BaseCDR* newloggerobject = func(newchannel);
+			switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding a new logger object to the queue.\n");
+			switch_queue_push(cdrqueue,newloggerobject);
 		}
-	}		
-}
-
-void CDRContainer::add_to_queue(switch_channel_t *channel,switch_channel_timetable_t *temptimes,switch_caller_extension_t *tempcallerextension,switch_caller_profile_t *tempcallerprofile, switch_caller_profile_t *temporiginateprofile,bool& temporiginate);
-{
-	basecdr_creator func = *it;
-	BaseCDR* newloggerobject = func(channel,temptimes,tempcallerextension,tempcallerprofile,temporiginateprofile,temporiginate);
-	switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding a new logger object to the queue.\n");
-	switch_queue_push(cdrqueue,newloggerobject);
+	}
+	
+	delete newchannel;
 }
 
 void CDRContainer::process_records()

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h	Sun Jun 11 18:13:20 2006
@@ -18,8 +18,8 @@
 #include <iostream>
 #endif
 #include <switch.h>
+#include "basecdr.h"
 
-
 /*
 The CDRContainer Class will serve as a central receptacle for all CDR methods.  CDRContainer::CDRContainer() will initialize the system, and CDRContainer::add_cdr() will add a new object of each CDR type to a queue for "later processing" by the other thread.
 CDRContainer::process_records() will iterate thru the queue and commit the records to the respective backends.
@@ -36,20 +36,12 @@
 		CDRContainer();
 		CDRContainer(switch_memory_pool *module_pool);
 		~CDRContainer();
-		void add_cdr(switch_channel *channel);
+		void add_cdr(switch_channel_t *channel);
 		void process_records();
 	protected:
 	private:
 		switch_queue_t *cdrqueue;
-		//list<std::string> cdrformats; // What formats are we going to use?
 		std::string tempfilepath;
-		void add_to_queue(switch_channel_t *channel,switch_channel_timetable_t *temptimes,switch_caller_extension_t *tempcallerextension,switch_caller_profile_t *tempcallerprofile, switch_caller_profile_t *temporiginateprofile,bool& temporiginate);
-		/*  Old factory method, dirty and icky
-		list<std::string>::iterator cdrformatsBeg, cdrformatsEnd, cdrformatsItr; // Iterators for cdrformats
-		map<std::string,BaseCDR* (*)(switch_channel*) > logging_factory; // This is the factory for creation of objects
-		map<std::string,BaseCDR* (*)()> logging_connectors; // This map will associate each logging method with its connect() method
-		map<std::string,BaseCDR* (*)()> logging_disconnectors; // This will do the opposite of above, close up connections and cleanup
-		*/
 };
 
 #ifdef __cplusplus

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	Sun Jun 11 18:13:20 2006
@@ -9,7 +9,7 @@
 
 }
 
-MysqlCDR::MysqlCDR(switch_channel *channel) : BaseCDR(channel)
+MysqlCDR::MysqlCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel)
 {
 	clid_length = strlen(clid);
 	src_length = strlen(src);

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h	Sun Jun 11 18:13:20 2006
@@ -7,8 +7,8 @@
 class MysqlCDR : public BaseCDR {
 	public:
 		MysqlCDR();
-		MysqlCDR(switch_channel_t *channel);
-		MysqlCDR(const MysqlCDR& copyFrom);
+		MysqlCDR(switch_mod_cdr_newchannel_t *newchannel);
+		//MysqlCDR(const MysqlCDR& copyFrom);
 		virtual ~MysqlCDR();
 		virtual bool process_record();
 		virtual void connect(switch_xml_t *cfg, switch_xml_t *xml, switch_xml_t *settings, switch_xml_t *param);

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/syslogcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/syslogcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/syslogcdr.cpp	Sun Jun 11 18:13:20 2006
@@ -7,7 +7,7 @@
 {
 }
 
-SyslogCDR::SyslogCDR(switch_channel *channel) : BaseCDR(channel)
+SyslogCDR::SyslogCDR(switch_mod_cdr_newchannel *newchannel) : BaseCDR(newchannel)
 {
 	if(channel != 0)
 	{



More information about the Freeswitch-svn mailing list