From d13ee2573559f6225c988578d6274f4bd5f94b96 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Wed, 27 Oct 2021 12:41:31 -0400 Subject: [PATCH] [mod_sofia] Provide retry time for failed and waiting registration --- src/mod/endpoints/mod_sofia/mod_sofia.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a3a6cd8e91..1f4d89b11b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2936,9 +2936,9 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls); free(pkey); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->reg_timeout > now) { + if (gp->reg_timeout >= now) { stream->write_function(stream, " (retry: %ds)", gp->reg_timeout - now); } else { stream->write_function(stream, " (retry: NEVER)"); @@ -3186,9 +3186,9 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "%25s\t%s\t %40s\t%s", pkey, "gateway", gp->register_to, sofia_state_names[gp->state]); free(pkey); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { + if (gp->retry >= now) { stream->write_function(stream, " (retry: %ds)", gp->retry - now); } else { stream->write_function(stream, " (retry: NEVER)"); @@ -3240,9 +3240,9 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre stream->write_function(stream, " %u\n", gp->ib_failed_calls); stream->write_function(stream, " %u\n", gp->ob_failed_calls); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { + if (gp->retry >= now) { stream->write_function(stream, " %ds\n", gp->retry - now); } else { stream->write_function(stream, " NEVER\n"); @@ -3503,9 +3503,9 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "\n%s\n%s\n%s\n%s\n\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { + if (gp->retry >= now) { stream->write_function(stream, " (retry: %ds)", gp->retry - now); } else { stream->write_function(stream, " (retry: NEVER)");