]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] Gateways DOWN state introduced a regression: REG gateways in DOWN state...
authorAndrey Volk <andywolk@gmail.com>
Wed, 17 Mar 2021 21:53:38 +0000 (00:53 +0300)
committerAndrey Volk <andywolk@gmail.com>
Thu, 18 Mar 2021 00:07:49 +0000 (03:07 +0300)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 3143fffa42a1671d6589736d918b093fbd7b9645..ecc925cf78a20737ac787aa8534301e468f4627f 100644 (file)
@@ -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");
index 5eee1c17e35d8e4363511783da362ec50c8851d2..22997cecae4e27202b9f0a6f05a119c8e3e08bad 100644 (file)
@@ -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";
                }