From 9e89f607c8a92ee6af26b7af4c6c9cfc2bcd9f41 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 00:18:06 -0600 Subject: [PATCH] FS-3140 --comment-only please try this patch --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 12 ++++++++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c3b60da317..156a69d5a7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -231,6 +231,7 @@ typedef enum { PFLAG_PRESENCE_ON_FIRST_REGISTER, PFLAG_NO_CONNECTION_REUSE, PFLAG_RENEG_ON_HOLD, + PFLAG_RENEG_ON_REINVITE, PFLAG_RTP_NOTIMER_DURING_BRIDGE, /* No new flags below this line */ PFLAG_MAX diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8e38393efb..761a03ce62 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2442,6 +2442,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_RENEG_ON_HOLD); } + } else if (!strcasecmp(var, "renegotiate-codec-on-reinvite")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } else { + sofia_clear_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } } else if (!strcasecmp(var, "presence-probe-on-register")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); @@ -3137,6 +3143,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_RENEG_ON_HOLD); } + } else if (!strcasecmp(var, "renegotiate-codec-on-reinvite")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } else { + sofia_clear_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } } else if (!strcasecmp(var, "presence-probe-on-register")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 91cf5b6fba..1e42afc269 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4290,7 +4290,15 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } - if (!reneg) { + if (reneg) { + reneg = sofia_test_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE); + + if ((val = switch_channel_get_variable(tech_pvt->channel, "sip_renegotiate_codec_on_reinvite"))) { + reneg = switch_true(val); + } + } + + if (!reneg && tech_pvt->num_negotiated_codecs) { codec_array = tech_pvt->negotiated_codecs; total_codecs = tech_pvt->num_negotiated_codecs; } @@ -4688,6 +4696,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s 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; + tech_pvt->num_negotiated_codecs = 0; tech_pvt->negotiated_codecs[tech_pvt->num_negotiated_codecs++] = mimp; switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);