From 2d97208b492cdc1a0db650484a338de450acf608 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 20 May 2009 20:51:35 +0000 Subject: [PATCH] add proxy-follow-redirect flag (experimental) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13402 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 ++ src/mod/endpoints/mod_sofia/sofia.c | 6 ++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 2df89939c3..5143e0a93d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -191,6 +191,7 @@ typedef enum { PFLAG_AUTOFIX_TIMING, PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE, + PFLAG_PROXY_FOLLOW_REDIRECT, /* No new flags below this line */ PFLAG_MAX } PFLAGS; @@ -559,6 +560,7 @@ struct private_object { char *record_route; char *extrtpip; char *stun_ip; + char *route_uri; switch_port_t stun_port; uint32_t stun_flags; unsigned long rm_rate; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 13e18051a3..035261c644 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2897,6 +2897,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status sip_contact_t * p_contact = sip->sip_contact; int i = 0; char var_name[80]; + + if (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)); + } + while (p_contact) { if (p_contact->m_url) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 38274684b0..8e9b6c7da0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1597,6 +1597,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (route_uri) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Setting proxy route to %s\n", route_uri, switch_channel_get_name(channel)); + tech_pvt->route_uri = switch_core_session_strdup(tech_pvt->session, route_uri); } nua_invite(tech_pvt->nh, @@ -1609,7 +1610,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)), TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), - TAG_IF(route_uri, NUTAG_PROXY(route_uri)), + TAG_IF(tech_pvt->route_uri, NUTAG_PROXY(tech_pvt->route_uri)), TAG_IF(route, SIPTAG_ROUTE_STR(route)), TAG_IF(!switch_strlen_zero(sendto), NUTAG_PROXY(sendto)), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),