Author: anthm Date: Wed May 20 15:51:35 2009 New Revision: 13402 Log: add proxy-follow-redirect flag (experimental) Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed May 20 15:51:35 2009 @@ -191,6 +191,7 @@ 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 @@ char *record_route; char *extrtpip; char *stun_ip; + char *route_uri; switch_port_t stun_port; uint32_t stun_flags; unsigned long rm_rate; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed May 20 15:51:35 2009 @@ -2897,6 +2897,12 @@ 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) { Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed May 20 15:51:35 2009 @@ -1597,6 +1597,7 @@ 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 @@ 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),