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

Freeswitch SVN mikej at freeswitch.org
Sat Jun 23 23:17:22 EDT 2007


Author: mikej
Date: Sat Jun 23 23:17:21 2007
New Revision: 5449

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

Log:
fix hold on ua's that send sendonly in the m instead of the a line and unhold without a sendrecv.

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	Sat Jun 23 23:17:21 2007
@@ -1055,6 +1055,7 @@
 	sdp_attribute_t *a;
 	int first = 0, last = 0;
 	int ptime = 0, dptime = 0;
+	int sendonly = 0;
 	int greedy = 0, x = 0, skip = 0, mine = 0;
 	switch_channel_t *channel = NULL;
 	char *val;
@@ -1080,33 +1081,44 @@
 		}
 	}
 
+	if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) {
+		sendonly = 1;
+	}
+
 	for (a = sdp->sdp_attributes; a; a = a->a_next) {
 		if (switch_strlen_zero(a->a_name)) {
 			continue;
 		}
 
 		if (!strcasecmp(a->a_name, "sendonly")) {
-			if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
-				char *stream;
-				switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-				if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
-					stream = tech_pvt->profile->hold_music;
-				}
-				if (stream) {
-					switch_ivr_broadcast(switch_core_session_get_uuid(tech_pvt->session), stream, SMF_ECHO_BLEG | SMF_LOOP);
-				}
-			}
-		} else if (!strcasecmp(a->a_name, "sendrecv")) {
-			if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
-				switch_channel_clear_flag_partner(tech_pvt->channel, CF_BROADCAST);
-				switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK);
-				switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-			}
+			sendonly = 1;
+		} else if (!strcasecmp(a->a_name, "sendrecv")) {
+			sendonly = 0;
 		} else if (!strcasecmp(a->a_name, "ptime")) {
 			dptime = atoi(a->a_value);
 		}
 	}
 
+	if (sendonly) {
+		if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+			char *stream;
+			switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+				stream = tech_pvt->profile->hold_music;
+			}
+			if (stream) {
+				switch_ivr_broadcast(switch_core_session_get_uuid(tech_pvt->session), stream, SMF_ECHO_BLEG | SMF_LOOP);
+			}
+		}
+	} else {
+		if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+			switch_channel_clear_flag_partner(tech_pvt->channel, CF_BROADCAST);
+			switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK);
+			switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+		}
+	}
+
+
 	for (m = sdp->sdp_media; m; m = m->m_next) {
 		sdp_connection_t *connection;
 



More information about the Freeswitch-svn mailing list