diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 035261c644..359d7236f1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1565,6 +1565,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE); } + } else if (!strcasecmp(var, "proxy-follow-redirect")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PROXY_FOLLOW_REDIRECT); + } else { + sofia_clear_pflag(profile, PFLAG_PROXY_FOLLOW_REDIRECT); + } } else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID); @@ -2075,6 +2081,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE); } + } else if (!strcasecmp(var, "proxy-follow-redirect")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PROXY_FOLLOW_REDIRECT); + } else { + sofia_clear_pflag(profile, PFLAG_PROXY_FOLLOW_REDIRECT); + } } else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) { sofia_set_flag(profile, TFLAG_PROXY_MEDIA); } else if (!strcasecmp(var, "force-subscription-expires")) { @@ -2898,12 +2910,11 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status int i = 0; char var_name[80]; - if (tech_pvt->route_uri && p_contact && p_contact->m_url) { + if (sofia_test_pflag(profile, PFLAG_PROXY_FOLLOW_REDIRECT) && tech_pvt->route_uri && p_contact && p_contact->m_url) { tech_pvt->route_uri = switch_core_session_strdup(tech_pvt->session, (const char *) p_contact->m_url); - nua_set_hparams(tech_pvt->nh, NUTAG_PROXY(tech_pvt->route_uri)); + nua_set_hparams(tech_pvt->nh, NUTAG_PROXY(tech_pvt->route_uri), TAG_END()); } - while (p_contact) { if (p_contact->m_url) { if (p_contact->m_url->url_user) {