[Freeswitch-svn] [commit] r4807 - in freeswitch/trunk/src: . include mod/codecs/mod_g729 mod/endpoints/mod_dingaling

Freeswitch SVN anthm at freeswitch.org
Fri Mar 30 12:41:12 EDT 2007


Author: anthm
Date: Fri Mar 30 12:41:12 2007
New Revision: 4807

Modified:
   freeswitch/trunk/src/include/switch_utils.h
   freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/switch_core_io.c

Log:
cleanup

Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h	(original)
+++ freeswitch/trunk/src/include/switch_utils.h	Fri Mar 30 12:41:12 2007
@@ -180,6 +180,60 @@
 */
 #define switch_safe_free(it) if (it) {free(it);it=NULL;}
 
+
+/*!
+  \brief Test if one string is inside another with extra case checking
+  \param s the inner string
+  \param q the big string
+  \return SWITCH_TRUE or SWITCH_FALSE
+*/
+static inline switch_bool_t switch_strstr(char *s, char *q)
+{
+	char *p, *S = NULL, *Q = NULL;
+	switch_bool_t tf = SWITCH_FALSE;
+
+	if (strstr(s, q)) {
+		return SWITCH_TRUE;
+	}
+
+	S = strdup(s);
+	
+	assert(S != NULL);
+
+	for (p = S; p && *p; p++) {
+		*p = (char)toupper(*p);
+	}
+
+	if (strstr(S, q)) {
+		tf = SWITCH_TRUE;
+		goto done;
+	}
+
+	Q = strdup(q);
+	assert(Q != NULL);
+
+	for (p = Q; p && *p; p++) {
+		*p = (char)toupper(*p);
+	}
+	
+	if (strstr(s, Q)) {
+		tf = SWITCH_TRUE;
+		goto done;
+	}
+
+	if (strstr(S, Q)) {
+		tf = SWITCH_TRUE;
+		goto done;
+	}
+	
+ done:
+	switch_safe_free(S);
+	switch_safe_free(Q);
+
+	return tf;
+}
+
+
 /*!
   \brief Test for NULL or zero length string
   \param s the string to test

Modified: freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c	Fri Mar 30 12:41:12 2007
@@ -154,10 +154,9 @@
 
 	}
 
-
 	if (encoded_data_len % 2 == 0) {
-
-		if (encoded_data_len % 12 == 0) {
+		
+		if (encoded_data_len == 2 || encoded_data_len % 12 == 0) {
 			return SWITCH_STATUS_BREAK;
 			//divisor = 12;
 			//plen = 10;

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile	Fri Mar 30 12:41:12 2007
@@ -1,13 +1,20 @@
 BASE=../../../..
 
-DING_DIR=$(BASE)/libs/libdingaling
-DINGLA=$(DING_DIR)/libdingaling.la
+LOCAL_CFLAGS     = `$(BASE)/libs/apr/apr-1-config --cflags --cppflags --includes`
+LOCAL_CFLAGS    += `$(BASE)/libs/apr-util/apu-1-config --includes`
 
-LOCAL_CFLAGS=-I$(DING_DIR)/src
-LOCAL_LIBADD=$(DINGLA)
+IKS_DIR=$(BASE)/libs/iksemel
+IKS_LA=$(IKS_DIR)/src/libiksemel.la
+DING_DIR=$(BASE)/libs/libdingaling
+LOCAL_CFLAGS += -I$(DING_DIR)/src -I$(BASE)/libs/iksemel/include
+LOCAL_OBJS=$(DING_DIR)/src/libdingaling.o $(IKS_LA)
 
 include $(BASE)/build/modmake.rules
 
-$(DINGLA): $(DING_DIR) $(DING_DIR)/.update
-	cd $(DING_DIR) && $(MAKE)
-	$(TOUCH_TARGET)
+$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
+	@cd $(IKS_DIR) && $(MAKE)
+	@$(TOUCH_TARGET)
+
+
+
+

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Fri Mar 30 12:41:12 2007
@@ -2167,28 +2167,31 @@
 				break;
 
 			case LDL_SIGNAL_SUBSCRIBE:
+				if (profile->user_flags & LDL_FLAG_COMPONENT && ldl_jid_domcmp(from, to)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Attempt to add presence from/to our own domain [%s][%s]\n", from, to);
+				} else {
+					if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';\n"
+											  "insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from, to, msg, subject))) {
+						execute_sql(profile->dbname, sql, profile->mutex);
+						switch_core_db_free(sql);
+					}
 
-				if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';\n"
-										  "insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from, to, msg, subject))) {
-					execute_sql(profile->dbname, sql, profile->mutex);
-					switch_core_db_free(sql);
-				}
-
-				if (is_special(to)) {
-					ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call");
-				}
+					if (is_special(to)) {
+						ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call");
+					}
 #if 0
-				if (is_special(to)) {
-					if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
-						//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Click To Call");
-						switch_event_fire(&event);
+					if (is_special(to)) {
+						if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
+							//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Click To Call");
+							switch_event_fire(&event);
+						}
 					}
-				}
 #endif
+				}
 				break;
 			case LDL_SIGNAL_ROSTER:
 				if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Fri Mar 30 12:41:12 2007
@@ -133,6 +133,15 @@
 			case SWITCH_STATUS_NOOP:
 				status = SWITCH_STATUS_SUCCESS;
 				break;
+			case SWITCH_STATUS_BREAK:
+				memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->bytes_per_frame);
+				session->raw_read_frame.datalen = read_frame->codec->implementation->bytes_per_frame;
+				session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t);
+				session->raw_read_frame.timestamp = read_frame->timestamp;
+				session->raw_read_frame.rate = read_frame->rate;
+				read_frame = &session->raw_read_frame;
+				status = SWITCH_STATUS_SUCCESS;
+				break;
 			default:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", session->read_codec->codec_interface->interface_name);
 				goto done;



More information about the Freeswitch-svn mailing list