[Freeswitch-svn] [commit] r9033 - in freeswitch/trunk/src: . include

Freeswitch SVN brian at freeswitch.org
Tue Jul 15 10:41:09 EDT 2008


Author: brian
Date: Tue Jul 15 10:41:08 2008
New Revision: 9033

Modified:
   freeswitch/trunk/src/include/switch_cpp.h
   freeswitch/trunk/src/switch_cpp.cpp

Log:
tweaks

Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h	(original)
+++ freeswitch/trunk/src/include/switch_cpp.h	Tue Jul 15 10:41:08 2008
@@ -13,7 +13,31 @@
 #define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
 #define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
 #define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
-#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&caller_profile, 0, sizeof(caller_profile)); memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown";  caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = "";  caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
+#define init_vars() allocated = 0;						\
+	session = NULL;										\
+	channel = NULL;										\
+	uuid = NULL;										\
+	tts_name = NULL;									\
+	voice_name = NULL;									\
+	xml_cdr_text = NULL;								\
+	memset(&caller_profile, 0, sizeof(caller_profile)); \
+	memset(&args, 0, sizeof(args));						\
+	ap = NULL;											\
+	caller_profile.source = "mod_unknown";				\
+	caller_profile.dialplan = "";						\
+	caller_profile.context = "";						\
+	caller_profile.caller_id_name = "";					\
+	caller_profile.caller_id_number = "";				\
+	caller_profile.network_addr = "";					\
+	caller_profile.ani = "";							\
+	caller_profile.aniii = "";							\
+	caller_profile.rdnis = "";							\
+	caller_profile.username = "";						\
+	on_hangup = NULL;									\
+	memset(&cb_state, 0, sizeof(cb_state));				\
+	hook_state = CS_NEW;								\
+	fhp = NULL
+
 //// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch at cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
 #if 0
 #ifndef SWITCHTOMEMPOOL

Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp	(original)
+++ freeswitch/trunk/src/switch_cpp.cpp	Tue Jul 15 10:41:08 2008
@@ -1124,8 +1124,6 @@
 SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
 {
 	
-    switch_file_handle_t *fh = NULL;	   
-
 	this_check(SWITCH_STATUS_FALSE);
 	sanity_check(SWITCH_STATUS_FALSE);
 	
@@ -1134,20 +1132,6 @@
     }
 
 	if (fhp) {
-		fh = fhp;
-	}
-
-	if (fh) {
-		if (!fh) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh is null\n");
-			return SWITCH_STATUS_FALSE;	
-		}
-		
-		if (!fh->file_interface) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh->file_interface is null\n");
-			return SWITCH_STATUS_FALSE;	
-		}
-		
 		if (!strncasecmp(result, "speed", 4)) {
 			char *p;
 		
@@ -1158,10 +1142,10 @@
 					if (!(step = atoi(p))) {
 						step = 1;
 					}
-					fh->speed += step;
+					fhp->speed += step;
 				} else {
 					int speed = atoi(p);
-					fh->speed = speed;
+					fhp->speed = speed;
 				}
 				return SWITCH_STATUS_SUCCESS;
 			}
@@ -1169,18 +1153,18 @@
 			return SWITCH_STATUS_FALSE;
 
 		} else if (!strcasecmp(result, "pause")) {
-			if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
-				switch_clear_flag(fh, SWITCH_FILE_PAUSE);
+			if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
+				switch_clear_flag(fhp, SWITCH_FILE_PAUSE);
 			} else {
-				switch_set_flag(fh, SWITCH_FILE_PAUSE);
+				switch_set_flag(fhp, SWITCH_FILE_PAUSE);
 			}
 			return SWITCH_STATUS_SUCCESS;
 		} else if (!strcasecmp(result, "stop")) {
 			return SWITCH_STATUS_FALSE;
 		} else if (!strcasecmp(result, "restart")) {
 			unsigned int pos = 0;
-			fh->speed = 0;
-			switch_core_file_seek(fh, &pos, 0, SEEK_SET);
+			fhp->speed = 0;
+			switch_core_file_seek(fhp, &pos, 0, SEEK_SET);
 			return SWITCH_STATUS_SUCCESS;
 		} else if (!strncasecmp(result, "seek", 4)) {
 			switch_codec_t *codec;
@@ -1199,18 +1183,18 @@
 					if (step > 0) {
 						samps = step * (codec->implementation->samples_per_second / 1000);
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-						switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
+						switch_core_file_seek(fhp, &pos, samps, SEEK_CUR);
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
 					} else {
 						samps = step * (codec->implementation->samples_per_second / 1000);
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-						switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
+						switch_core_file_seek(fhp, &pos, fhp->pos - samps, SEEK_SET);
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
 					}
 				} else {
 					samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-					switch_core_file_seek(fh, &pos, samps, SEEK_SET);
+					switch_core_file_seek(fhp, &pos, samps, SEEK_SET);
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
 				}
 			}
@@ -1218,6 +1202,7 @@
 			return SWITCH_STATUS_SUCCESS;
 		}
 	}
+
     if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "return success\n");
 		return SWITCH_STATUS_SUCCESS;



More information about the Freeswitch-svn mailing list