From d77317f8f19b3b9546e95d551eb51c236b442f55 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 May 2014 03:31:01 +0500 Subject: [PATCH] FS-6418 FS-6427 add profile param NDLB-proxy-never-patch-reinvites to solve both issues --- src/mod/endpoints/mod_sofia/mod_sofia.h | 3 ++- src/mod/endpoints/mod_sofia/sofia.c | 8 +++++++- src/mod/endpoints/mod_sofia/sofia_glue.c | 10 ++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index a1c220427e..96bba279dc 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -299,7 +299,8 @@ typedef enum { PFLAG_NDLB_ALLOW_BAD_IANANAME = (1 << 3), PFLAG_NDLB_ALLOW_NONDUP_SDP = (1 << 4), PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 5), - PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE = (1 << 6) + PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE = (1 << 6), + PFLAG_NDLB_NEVER_PATCH_REINVITE = (1 << 7) } sofia_NDLB_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8208e03eea..fb862b90d6 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3780,6 +3780,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); } + } else if (!strcasecmp(var, "NDLB-proxy-never-patch-reinvites")) { + if (switch_true(val)) { + profile->ndlb |= PFLAG_NDLB_NEVER_PATCH_REINVITE; + } else { + profile->ndlb &= ~PFLAG_NDLB_NEVER_PATCH_REINVITE; + } } else if (!strcasecmp(var, "registration-thread-frequency")) { profile->ireg_seconds = atoi(val); if (profile->ireg_seconds < 0) { @@ -6322,7 +6328,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } } - if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { + if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !(tech_pvt->profile->ndlb & PFLAG_NDLB_NEVER_PATCH_REINVITE)) { if (sofia_glue_tech_proxy_remote_addr(tech_pvt, r_sdp) == SWITCH_STATUS_SUCCESS && !is_t38) { nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio params changed, NOT proxying re-invite.\n"); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 087c3a2811..55f948ce74 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1751,10 +1751,12 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) len = strlen(tech_pvt->local_sdp_str) * 2; - if (switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && - (switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n"); - return; + if (!(tech_pvt->profile->ndlb & PFLAG_NDLB_NEVER_PATCH_REINVITE)) { + if (switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && + (switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n"); + return; + } } if (zstr(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {