goto error;
}
+ profile = gateway_ptr->profile;
+
if (gateway_ptr->status != SOFIA_GATEWAY_UP) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Gateway \'%s\' is down!\n", gw);
cause = SWITCH_CAUSE_GATEWAY_DOWN;
goto error;
}
- profile = gateway_ptr->profile;
-
if (profile && sofia_test_pflag(profile, PFLAG_STANDBY)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "System Paused\n");
cause = SWITCH_CAUSE_SYSTEM_SHUTDOWN;
goto done;
error:
- if (gateway_ptr) {
+ /* gateway pointer lock is really a readlock of the profile so we let the profile release below free that lock if we have a profile */
+ if (gateway_ptr && !profile) {
sofia_reg_release_gateway(gateway_ptr);
}