diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 722b1e9aa4..043bbbce44 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -50,7 +50,8 @@ typedef enum { SM_NDLB_ALLOW_NONDUP_SDP = (1 << 1), SM_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 2), SM_NDLB_DISABLE_SRTP_AUTH = (1 << 3), - SM_NDLB_SENDRECV_IN_SESSION = (1 << 4) + SM_NDLB_SENDRECV_IN_SESSION = (1 << 4), + SM_NDLB_NEVER_PATCH_REINVITE = (1 << 5) } switch_core_media_NDLB_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index dbb2bf8c22..ea4ed5544e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4091,6 +4091,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->mndlb |= SM_NDLB_NEVER_PATCH_REINVITE; + } else { + profile->mndlb &= ~SM_NDLB_NEVER_PATCH_REINVITE; + } } else if (!strcasecmp(var, "registration-thread-frequency")) { profile->ireg_seconds = atoi(val); if (profile->ireg_seconds < 0) { @@ -6722,7 +6728,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->mndlb & SM_NDLB_NEVER_PATCH_REINVITE)) { if (switch_core_media_proxy_remote_addr(session, 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/switch_core_media.c b/src/switch_core_media.c index be6caf5247..115a9dbda0 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7148,10 +7148,12 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) len = strlen(smh->mparams->local_sdp_str) * 2; - if (switch_channel_test_flag(session->channel, CF_ANSWERED) && - (switch_stristr("sendonly", smh->mparams->local_sdp_str) || switch_stristr("0.0.0.0", smh->mparams->local_sdp_str))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n"); - return; + if (!(smh->mparams->ndlb & SM_NDLB_NEVER_PATCH_REINVITE)) { + if (switch_channel_test_flag(session->channel, CF_ANSWERED) && + (switch_stristr("sendonly", smh->mparams->local_sdp_str) || switch_stristr("0.0.0.0", smh->mparams->local_sdp_str))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n"); + return; + } } if (zstr(a_engine->local_sdp_ip) || !a_engine->local_sdp_port) {// || switch_channel_test_flag(session->channel, CF_PROXY_MEDIA)) {