[Freeswitch-svn] [commit] r13560 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
brian at freeswitch.org
Tue Jun 2 16:56:06 PDT 2009
Author: brian
Date: Tue Jun 2 18:56:06 2009
New Revision: 13560
Log:
adding map and unmap of profile ports when AUTO_NAT is on
Modified:
freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.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 Tue Jun 2 18:56:06 2009
@@ -762,6 +762,15 @@
use_timer ? "timer, " : ""
);
+ if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+ if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s\n", profile->name);
+ }
+ if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s\n", profile->name);
+ }
+ }
+
profile->nua = nua_create(profile->s_root, /* Event loop */
sofia_event_callback, /* Callback for processing events */
profile, /* Additional data to pass to callback */
@@ -903,6 +912,16 @@
su_root_run(profile->s_root);
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
+
+ if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+ if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s\n", profile->name);
+ }
+ if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s\n", profile->name);
+ }
+ }
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
switch_thread_join(&st, worker_thread);
More information about the Freeswitch-svn
mailing list