if (lookup_rtpip == use_ip) {
/* sofia_glue_ext_address_lookup didn't return any error, but the return IP is the same as the original one,
which means no lookup was necessary. Check if NAT is detected */
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
/* Yes, map the port through switch_nat */
switch_nat_add_mapping(tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE);
} else {
sipip = tech_pvt->profile->sipip;
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
sipip = tech_pvt->profile->extsipip;
}
}
if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) {
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
rpid_domain = tech_pvt->profile->extsipip;
} else {
rpid_domain = tech_pvt->profile->sipip;
}
}
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport);
}
char *ip_addr;
char *ipv6;
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network))
? tech_pvt->profile->sipip : tech_pvt->profile->extsipip;
} else {
if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
tech_pvt->invite_contact = tech_pvt->profile->tls_url;
} else {
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
tech_pvt->invite_contact = tech_pvt->profile->public_url;
} else {
tech_pvt->invite_contact = tech_pvt->profile->url;
switch_mutex_lock(tech_pvt->sofia_mutex);
caller_profile = switch_channel_get_caller_profile(channel);
- if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
sipip = tech_pvt->profile->extsipip;
contact_url = tech_pvt->profile->public_url;
} else {
}
- if (tech_pvt->local_sdp_video_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (tech_pvt->local_sdp_video_port > 0 && !zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP);
}
switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port);
}
- if (tech_pvt->local_sdp_audio_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+ if (tech_pvt->local_sdp_audio_port > 0 && !zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP);
}
char *route_uri = NULL;
contact = sofia_glue_get_url_from_contact((char *) o_contact, 1);
- if (sofia_glue_check_nat(profile, network_ip)) {
+ if (!zstr(network_ip) && sofia_glue_check_nat(profile, network_ip)) {
char *ptr = NULL;
const char *transport_str = NULL;