From 9c3d336223f104037395bb2dd2c3933d8d2cdaf9 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 25 Feb 2007 21:37:02 +0000 Subject: [PATCH] more properly handle sdp c lines inside of the audio m line.Resolves jira bug MODENDP-2 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4391 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 36 ++++++++++++++++--------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5a993a8139..9078afcc31 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1176,11 +1176,23 @@ static void tech_absorb_sdp(private_object_t *tech_pvt) 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 @@ 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") && a->a_value) { @@ -2388,6 +2389,17 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp) 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;