Author: brian Date: Wed Jun 3 14:12:29 2009 New Revision: 13583 Log: move this down to after the profile has stopped 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 Wed Jun 3 14:12:29 2009 @@ -912,15 +912,6 @@ 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 port %d\n", profile->name, profile->sip_port); - } - 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 port %d\n", profile->name, profile->sip_port); - } - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); switch_thread_join(&st, worker_thread); @@ -958,6 +949,15 @@ switch_event_fire(&s_event); } + 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 port %d\n", profile->name, profile->sip_port); + } + 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 port %d\n", profile->name, profile->sip_port); + } + } + sofia_glue_sql_close(profile); su_home_unref(profile->home); su_root_destroy(profile->s_root);