[Freeswitch-svn] [commit] r12693 - freeswitch/trunk/src/mod/endpoints/mod_sofia

FreeSWITCH SVN anthm at freeswitch.org
Fri Mar 20 13:51:19 PDT 2009


Author: anthm
Date: Fri Mar 20 15:51:19 2009
New Revision: 12693

Log:
another regression

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Mar 20 15:51:19 2009
@@ -309,8 +309,6 @@
 		switch_event_header_t *hi;
 		char *bye_headers = NULL;
 
-		sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
-
 		SWITCH_STANDARD_STREAM(stream);
 		if ((hi = switch_channel_variable_first(channel))) {
 			for (; hi; hi = hi->next) {
@@ -342,22 +340,25 @@
 				switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
 			}
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
-			nua_bye(tech_pvt->nh, 
-					SIPTAG_REASON_STR(reason),
-					TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-					TAG_END());
+			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+				nua_bye(tech_pvt->nh, 
+						SIPTAG_REASON_STR(reason),
+						TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+						TAG_END());
+			}
 		} else {
 			if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
 				if (!tech_pvt->got_bye) {
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
 				}
-
-				nua_cancel(tech_pvt->nh, 
-						   SIPTAG_REASON_STR(reason), 
-						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-						   TAG_END());
+				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					nua_cancel(tech_pvt->nh, 
+							   SIPTAG_REASON_STR(reason), 
+							   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+							   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+							   TAG_END());
+				}
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
 				if (!tech_pvt->got_bye) {
@@ -372,7 +373,7 @@
 			}
 		}
 
-
+		sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 		switch_safe_free(stream.data);
 	}
 



More information about the Freeswitch-svn mailing list