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

FreeSWITCH SVN anthm at freeswitch.org
Tue Mar 17 08:24:47 PDT 2009


Author: anthm
Date: Tue Mar 17 10:24:47 2009
New Revision: 12641

Log:
MODENDP-198 MODENDP-199

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

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Tue Mar 17 10:24:47 2009
@@ -389,6 +389,7 @@
 			if (!strcasecmp(type, "initiate") || !strcasecmp(type, "accept")) {
 
 				dl_signal = LDL_SIGNAL_INITIATE;
+
 				if (!strcasecmp(type, "accept")) {
 					msg = "accept";
 				}
@@ -1432,10 +1433,10 @@
 
 	ldl_set_flag_locked(handle, LDL_FLAG_QUEUE_RUNNING);
 
-	while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+	while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
 		ldl_flush_queue(handle, 0);
 
-		if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) {
+		if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS || !ldl_test_flag((&globals), LDL_FLAG_READY)) {
 			int fd;
 
 			if ((fd = iks_fd(handle->parser)) > -1) {
@@ -1470,6 +1471,7 @@
 	while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
 		int e;
 		char tmp[512], *sl;
+		int fd;
 
 		handle->parser = iks_stream_new(ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? IKS_NS_COMPONENT : IKS_NS_CLIENT,
 										handle,
@@ -1570,6 +1572,10 @@
 		ldl_clear_flag_locked(handle, LDL_FLAG_CONNECTED);
 		ldl_clear_flag_locked(handle, LDL_FLAG_AUTHORIZED);
 		handle->state = CS_NEW;
+		
+		if ((fd = iks_fd(handle->parser)) > -1) {
+			shutdown(fd, 0x02);
+		}
 
 		while(ldl_test_flag(handle, LDL_FLAG_QUEUE_RUNNING)) {
 			microsleep(100);
@@ -2224,7 +2230,7 @@
 
 int8_t ldl_handle_ready(ldl_handle_t *handle)
 {
-	return (int8_t)ldl_test_flag(handle, LDL_FLAG_READY);
+	return (int8_t) (ldl_test_flag(handle, LDL_FLAG_READY) && ldl_test_flag((&globals), LDL_FLAG_READY));
 }
 
 ldl_status ldl_handle_init(ldl_handle_t **handle,

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	Tue Mar 17 10:24:47 2009
@@ -873,11 +873,16 @@
 					  tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
 
 	flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
+	
 
 	if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
 		flags |= SWITCH_RTP_FLAG_USE_TIMER;
 	}
 
+	if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) {
+		flags &= ~SWITCH_RTP_FLAG_AUTOADJ;
+	}
+
 	if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
 												 tech_pvt->local_port,
 												 tech_pvt->remote_ip,
@@ -1131,7 +1136,9 @@
 		if (!do_candidates(tech_pvt, 0)) {
 			goto out;
 		}
-		switch_channel_answer(channel);
+		if (switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT)) {
+			switch_channel_answer(channel);
+		}
 	}
 	ret = SWITCH_STATUS_SUCCESS;
 
@@ -2549,7 +2556,7 @@
 			status = LDL_STATUS_FALSE;
 			goto done;
 		}
-
+		
 	} else {
 		if (dl_signal != LDL_SIGNAL_INITIATE && !msg) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session is already dead\n");
@@ -2746,6 +2753,7 @@
 			if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 				if (!strcasecmp(msg, "accept")) {
 					switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
+					switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
 					if (!do_candidates(tech_pvt, 0)) {
 						terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 						status = LDL_STATUS_FALSE;
@@ -2909,7 +2917,7 @@
 				}
 
 				if (!strcasecmp(subject, "candidates")) {
-					switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
+					//switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
 					switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
 				}
 



More information about the Freeswitch-svn mailing list