From: Brian West Date: Tue, 30 Nov 2010 23:38:44 +0000 (-0600) Subject: Fix issue when fs_path is used so we pick the correct media IP in our outbound invit... X-Git-Tag: v1.2-rc1~243^2^2~7^2~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a669f76f786e2a74d3621cf5d4f9b0ad30d7e89a;p=thirdparty%2Ffreeswitch.git 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. --- 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, '@')) {