[mod_sofia] Gateways DOWN state introduced a regression: REG gateways in DOWN state could not be killed. NOREG gateways could change state in some conditions. Register and Unregister commands will now error if a gateway is NOREG.
This commit is contained in:
parent
9e49a4176b
commit
0059f0cc1b
|
@ -3666,6 +3666,8 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
|||
gateway_ptr->state = REG_STATE_UNREGED;
|
||||
stream->write_function(stream, "+OK\n");
|
||||
sofia_reg_release_gateway(gateway_ptr);
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR NOREG gateway [%s] can't be registered!\n", gname);
|
||||
}
|
||||
} else {
|
||||
stream->write_function(stream, "Invalid gateway!\n");
|
||||
|
@ -3697,6 +3699,8 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
|||
gateway_ptr->state = REG_STATE_UNREGISTER;
|
||||
stream->write_function(stream, "+OK\n");
|
||||
sofia_reg_release_gateway(gateway_ptr);
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR NOREG gateway [%s] can't be unregistered!\n", gname);
|
||||
}
|
||||
} else {
|
||||
stream->write_function(stream, "Invalid gateway!\n");
|
||||
|
|
|
@ -323,7 +323,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||
free(pkey);
|
||||
}
|
||||
|
||||
if (gateway_ptr->state == REG_STATE_NOREG) {
|
||||
if (gateway_ptr->state == REG_STATE_NOREG || gateway_ptr->state == REG_STATE_DOWN) {
|
||||
|
||||
if (last) {
|
||||
last->next = gateway_ptr->next;
|
||||
|
@ -356,7 +356,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||
char *user_via = NULL;
|
||||
char *register_host = NULL;
|
||||
|
||||
if (!now) {
|
||||
if (!now && ostate != REG_STATE_NOREG) {
|
||||
gateway_ptr->state = ostate = REG_STATE_UNREGED;
|
||||
gateway_ptr->expires_str = "0";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue