From a669f76f786e2a74d3621cf5d4f9b0ad30d7e89a Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 30 Nov 2010 17:38:44 -0600 Subject: [PATCH] Fix issue when fs_path is used so we pick the correct media IP in our outbound invite this was soemthing that wouldn't work correctly over ATT on the iphone. --- src/mod/endpoints/mod_sofia/mod_sofia.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3bb926adf3..74c4c0897e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3900,7 +3900,26 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_channel_set_variable_printf(nchannel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip); switch_channel_set_variable(nchannel, "sip_profile_name", profile_name); - switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip); + if (switch_stristr("fs_path", tech_pvt->dest)) { + char *remote_host = NULL; + const char *s; + + if ((s = switch_stristr("fs_path=", tech_pvt->dest))) { + s += 8; + } + + if (s) { + remote_host = switch_core_session_strdup(nsession, s); + switch_url_decode(remote_host); + } + if (!zstr(remote_host)) { + switch_split_user_domain(remote_host, NULL, &tech_pvt->remote_ip); + } + } + + if (zstr(tech_pvt->remote_ip)) { + switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip); + } if (dest_to) { if (strchr(dest_to, '@')) {