[Freeswitch-svn] [commit] r13577 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
brian at freeswitch.org
Wed Jun 3 10:30:50 PDT 2009
Author: brian
Date: Wed Jun 3 12:30:49 2009
New Revision: 13577
Log:
cleanup by mike and bkw
Modified:
freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 12:30:49 2009
@@ -4491,8 +4491,8 @@
if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network &&
!switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) {
- sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
- tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport),
+ tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport",
+ sofia_glue_transport2str(sofia_glue_url2transport(sip->sip_contact->m_url)),
profile->extsipip);
}
@@ -4690,17 +4690,17 @@
if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
tech_pvt->reply_contact = switch_core_session_sprintf(session, "<sip:%s@%s>", user, host);
} else {
- const char *url;
+ const char *url = NULL;
if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network &&
!switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) {
-
- if (sofia_glue_transport_has_tls(transport)) {
- url = profile->tls_public_url;
- } else {
- url = profile->public_url;
- }
+ url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
+ } else {
+ url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
+ }
+
+ if (url) {
if (strchr(url, '>')) {
tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url,
sofia_glue_transport2str(transport));
@@ -4708,42 +4708,30 @@
tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url,
sofia_glue_transport2str(transport));
}
- } else if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) {
- if (strchr(url, '>')) {
- tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
- } else {
- tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
- }
} else {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
}
}
} else {
- const char *url;
-
+ const char *url = NULL;
+
if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network &&
!switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) {
- if (sofia_glue_transport_has_tls(transport)) {
- url = profile->tls_public_url;
- } else {
- url = profile->public_url;
- }
-
+ url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
+ } else {
+ url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
+ }
+
+ if (url) {
if (strchr(url, '>')) {
tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url,
sofia_glue_transport2str(transport));
} else {
- tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url,
+ tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url,
sofia_glue_transport2str(transport));
}
- } else if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) {
- if (strchr(url, '>')) {
- tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
- } else {
- tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
- }
} else {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 12:30:49 2009
@@ -665,28 +665,16 @@
}
}
- if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
- if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network &&
- !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
- tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip);
- } else {
- tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip);
- }
+ if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network &&
+ !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
+ tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip);
+ switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP);
} else {
- if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network &&
- !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
- tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip);
- } 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, ip);
}
-
+
tech_pvt->adv_sdp_audio_port = sdp_port;
- if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
- switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP);
- }
-
switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
More information about the Freeswitch-svn
mailing list