From 9bc1a08636e1078fa61eee7cb6dcf93ad6ea2953 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 29 Jul 2009 19:39:28 +0000 Subject: [PATCH] reuse of vars, using differnet vars for each now so that ip isn't always defined git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14419 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 76af7f10a9..b5de963bae 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -635,7 +635,8 @@ const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name) switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force) { - char *ip = tech_pvt->profile->rtpip; + char *rtpip = tech_pvt->profile->rtpip; + char *lookup_rtpip = NULL; switch_port_t sdp_port; char tmp[50]; const char *use_ip = NULL; @@ -653,7 +654,7 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int forc } - tech_pvt->local_sdp_audio_ip = ip; + tech_pvt->local_sdp_audio_ip = rtpip; if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(tech_pvt->profile->rtpip))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP ports available!\n"); @@ -669,17 +670,17 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int forc if (use_ip) { tech_pvt->extrtpip = switch_core_session_strdup(tech_pvt->session, use_ip); - if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, + if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, tech_pvt->extrtpip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } } - if (!use_ip && tech_pvt->profile->extrtpip && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip ? ip : tech_pvt->profile->extrtpip); + if (tech_pvt->profile->extrtpip && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, lookup_rtpip ? lookup_rtpip : tech_pvt->profile->extrtpip); switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); } else { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, rtpip); } tech_pvt->adv_sdp_audio_port = external_port != 0 ? external_port : sdp_port;