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

Freeswitch SVN mikej at freeswitch.org
Sun Feb 25 16:37:02 EST 2007


Author: mikej
Date: Sun Feb 25 16:37:02 2007
New Revision: 4391

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

Log:
more properly handle sdp c lines inside of the audio m line.Resolves jira bug MODENDP-2

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	Sun Feb 25 16:37:02 2007
@@ -1176,11 +1176,23 @@
 		sdp_parser_t *parser;
 		sdp_session_t *sdp;
 		sdp_media_t *m;
+		sdp_connection_t *connection;
 
 		if ((parser = sdp_parse(tech_pvt->home, sdp_str, (int)strlen(sdp_str), 0))) {
 			if ((sdp = sdp_session(parser))) {
 				for (m = sdp->sdp_media; m ; m = m->m_next) {
-					tech_pvt->proxy_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, sdp->sdp_connection->c_address);
+					if (m->m_type != sdp_media_audio) {
+						continue;
+					}
+
+					connection = sdp->sdp_connection;
+					if (m->m_connections) {
+						connection = m->m_connections;
+					}
+
+					if (connection) {
+						tech_pvt->proxy_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, connection->c_address);
+					}
 					tech_pvt->proxy_sdp_audio_port = (switch_port_t)m->m_port;
 					if (tech_pvt->proxy_sdp_audio_ip && tech_pvt->proxy_sdp_audio_port) {
 						break;
@@ -2367,17 +2379,6 @@
 	for (m = sdp->sdp_media; m ; m = m->m_next) {
         sdp_connection_t *connection;
 
-        connection = sdp->sdp_connection;
-        if (m->m_connections) {
-            connection = m->m_connections;
-        }
-
-        if (!connection) {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n");
-            match = 0;
-            break;
-        }
-
         ptime = dptime;
         for (a = m->m_attributes; a; a = a->a_next) {
             if (!strcasecmp(a->a_name, "ptime") && a->a_value) {
@@ -2388,6 +2389,17 @@
 		if (m->m_type == sdp_media_audio) {
 			sdp_rtpmap_t *map;
 
+			connection = sdp->sdp_connection;
+			if (m->m_connections) {
+				connection = m->m_connections;
+			}
+
+			if (!connection) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n");
+				match = 0;
+				break;
+			}
+
 			for (map = m->m_rtpmaps; map; map = map->rm_next) {
 				int32_t i;
                 const switch_codec_implementation_t *mimp = NULL, *near_match = NULL;



More information about the Freeswitch-svn mailing list