[Freeswitch-svn] [commit] r10530 - in freeswitch/trunk: libs/libdingaling/src src/mod/endpoints/mod_sofia

FreeSWITCH SVN anthm at freeswitch.org
Mon Nov 24 15:12:38 PST 2008


Author: anthm
Date: Mon Nov 24 18:12:36 2008
New Revision: 10530

Log:
fix LBDING-7

Modified:
   freeswitch/trunk/libs/libdingaling/src/libdingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Mon Nov 24 18:12:36 2008
@@ -1792,39 +1792,44 @@
 void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body)
 {
 	iks *msg;
-	char *t, *e;
+	const char *t;
+	char *e;
 	char *bdup = NULL;
 	int on = 0;
 	int len = 0;
-	char *my_body = strdup(body);
+
 	assert(handle != NULL);
-	assert(body != NULL);
-	
-	if (strchr(my_body, '<')) {
-		len = (int) strlen(my_body);
-		if (!(bdup = malloc(len))) {
-			return;
-		}
 
-		memset(bdup, 0, len);
-		
-		e = bdup;
-		for(t = my_body; *t; t++) {
-			if (*t == '<') {
-				on = 1;
-			} else if (*t == '>') {
-				t++;
-				on = 0;
+	if (body) {	
+		if (strchr(body, '<')) {
+			len = (int) strlen(body);
+			if (!(bdup = malloc(len))) {
+				abort();
 			}
+
+			memset(bdup, 0, len);
+		
+			e = bdup;
+			for(t = body; t && *t; t++) {
+				if (*t == '<') {
+					on = 1;
+				} else if (*t == '>') {
+					t++;
+					on = 0;
+				}
 			
-			if (!on) {
-				*e++ = *t;
+				if (!on) {
+					*e++ = *t;
+				}
 			}
+			body = bdup;
 		}
-		my_body = bdup;
+	} else {
+		body = "";
 	}
+
+	msg = iks_make_msg(IKS_TYPE_NONE, to, body);
 	
-	msg = iks_make_msg(IKS_TYPE_NONE, to, my_body);
 	iks_insert_attrib(msg, "type", "chat");
 
 	if (!from) {
@@ -1840,9 +1845,7 @@
 	if (bdup) {	
 		free(bdup);
 	}
-
-	free(my_body);
-
+	
 	apr_queue_push(handle->queue, msg);
 	msg = NULL;
 	

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Mon Nov 24 18:12:36 2008
@@ -1186,7 +1186,11 @@
 		   or did he just suggest it to make our lives miserable?
 		 */
 		use_from_str = from_str;
-		from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
+		if ((val = switch_channel_get_variable(tech_pvt->channel, "suppress_from_cidname")) && switch_true(val)) {
+			from_str = switch_core_session_sprintf(session, "<%s>", use_from_str);
+		} else {
+			from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
+		}
 		
 		if (!(call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id"))) {
 			if (tech_pvt->profile->pflags & PFLAG_UUID_AS_CALLID) {



More information about the Freeswitch-svn mailing list