diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 1dfe82a62d..30eadc821f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4306,11 +4306,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session *new_session = NULL; - if (sofia_test_pflag(profile, PFLAG_STANDBY)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "System Paused\n"); - goto error; - } - if (!outbound_profile || zstr(outbound_profile->destination_number)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid Empty Destination\n"); goto error; @@ -4412,6 +4407,13 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } 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 error; + } + tech_pvt->gateway_name = switch_core_session_strdup(nsession, gateway_ptr->name); switch_channel_set_variable(nchannel, "sip_gateway_name", gateway_ptr->name); @@ -4490,6 +4492,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session goto error; } + 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 error; + } + if (profile->domain_name && strcmp(profile->domain_name, profile->name)) { profile_name = profile->domain_name; }