From 8231cb9f01093a04176f3ed212252faf79c6cb57 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Dec 2013 23:46:29 +0500 Subject: [PATCH] fix codec renegotiation on hold/reinvite issue --- src/switch_core_media.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index cc960c886d..7ffd10eed4 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2844,6 +2844,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s } } + if (session->bugs) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Session is connected to a media bug. " + "Re-Negotiation implicitly disabled.\n"); + reneg = 0; + } + if (!reneg && smh->num_negotiated_codecs) { codec_array = smh->negotiated_codecs; total_codecs = smh->num_negotiated_codecs; @@ -3278,7 +3285,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s match = 1; a_engine->codec_negotiated = 1; - + smh->num_negotiated_codecs = 0; + for(j = 0; j < m_idx; j++) { payload_map_t *pmap = switch_core_media_add_payload_map(session, SWITCH_MEDIA_TYPE_AUDIO, @@ -3329,7 +3337,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s pmap->rm_fmtp = switch_core_session_strdup(session, (char *) mmap->rm_fmtp); pmap->agreed_pt = (switch_payload_t) mmap->rm_pt; - smh->num_negotiated_codecs = 0; smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp; pmap->recv_pt = (switch_payload_t)mmap->rm_pt;