]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't depend on a session c= line in the sdp and use the one from the media if it...
authorMichael Jerris <mike@jerris.com>
Sun, 4 Feb 2007 23:04:16 +0000 (23:04 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 4 Feb 2007 23:04:16 +0000 (23:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4121 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c

index cedeab7d4fb2bca739fade44119a04bd0f0458ed..bbdf3f21385036c536e976f72a508cda2a33b73e 100644 (file)
@@ -2267,11 +2267,6 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
 
        channel = switch_core_session_get_channel(session);
        
-    if (!sdp->sdp_connection) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp!\n");
-        return 0;
-    }
-
        if ((tech_pvt->origin = switch_core_session_strdup(session, (char *) sdp->sdp_origin->o_username))) {
                if (strstr(tech_pvt->origin, "CiscoSystemsSIP-GW-UserAgent")) {
                        switch_set_flag_locked(tech_pvt, TFLAG_BUGGY_2833);
@@ -2290,6 +2285,19 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
        }
 
        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")) {
@@ -2362,7 +2370,7 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
                         tech_pvt->pt = (switch_payload_t)map->rm_pt;
                         tech_pvt->rm_rate = map->rm_rate;
                         tech_pvt->codec_ms = mimp->microseconds_per_frame / 1000;
-                        tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *)sdp->sdp_connection->c_address);
+                        tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *)connection->c_address);
                         tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *)map->rm_fmtp);
                         tech_pvt->remote_sdp_audio_port = (switch_port_t)m->m_port;
                         tech_pvt->agreed_pt = (switch_payload_t)map->rm_pt;