Merge pull request #1178 from azzbcc/mod_sofia_nat_mapping
[mod_sofia] release nat mapping when nua create failed
This commit is contained in:
commit
2243d34d94
|
@ -3188,7 +3188,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
if (!sofia_glue_init_sql(profile)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database [%s]!\n", profile->name);
|
||||
sofia_profile_start_failure(profile, profile->name);
|
||||
goto end;
|
||||
goto db_fail;
|
||||
}
|
||||
|
||||
supported = switch_core_sprintf(profile->pool, "%s%s%spath, replaces", use_100rel ? "100rel, " : "", use_timer ? "timer, " : "", use_rfc_5626 ? "outbound, " : "");
|
||||
|
@ -3339,7 +3339,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
}
|
||||
|
||||
sofia_profile_start_failure(profile, profile->name);
|
||||
goto end;
|
||||
goto nua_fail;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created agent for %s\n", profile->name);
|
||||
|
@ -3570,6 +3570,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
switch_event_fire(&s_event);
|
||||
}
|
||||
|
||||
nua_fail:
|
||||
if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_nat_get_type()) {
|
||||
if (switch_nat_del_mapping(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);
|
||||
|
@ -3582,7 +3583,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
}
|
||||
}
|
||||
|
||||
end:
|
||||
db_fail:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name);
|
||||
switch_thread_rwlock_wrlock(profile->rwlock);
|
||||
|
||||
|
|
Loading…
Reference in New Issue