From: Naveen Albert Date: Fri, 20 Aug 2021 20:35:35 +0000 (+0000) Subject: app_queue: Don't reset queue stats on reload X-Git-Tag: 16.21.0-rc1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=220ce865dbac937cf77906b401a77e45924b6713;p=thirdparty%2Fasterisk.git app_queue: Don't reset queue stats on reload Prevents reloads of app_queue from also resetting queue statistics. Also preserves individual queue agent statistics if we're just reloading members. ASTERISK-28701 Change-Id: Ib5d4cdec175e44de38ef0f6ede4a7701751766f1 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index f5550bb7d7..4d908a5d58 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -9335,9 +9335,13 @@ static void reload_single_member(const char *memberdata, struct call_queue *q) if ((newm = create_queue_member(interface, membername, penalty, cur ? cur->paused : 0, state_interface, ringinuse, wrapuptime))) { newm->wrapuptime = wrapuptime; if (cur) { - /* Round Robin Queue Position must be copied if this is replacing an existing member */ ao2_lock(q->members); + /* Round Robin Queue Position must be copied if this is replacing an existing member */ newm->queuepos = cur->queuepos; + /* Don't reset agent stats either */ + newm->calls = cur->calls; + newm->lastcall = cur->lastcall; + ao2_link(q->members, newm); ao2_unlink(q->members, cur); ao2_unlock(q->members); @@ -10402,7 +10406,7 @@ static int manager_queue_reload(struct mansession *s, const struct message *m) } if (!header_found) { - ast_set_flag(&mask, AST_FLAGS_ALL); + ast_set_flag(&mask, AST_FLAGS_ALL & ~QUEUE_RESET_STATS); } if (!reload_handler(1, &mask, queuename)) { @@ -11141,7 +11145,7 @@ static char *handle_queue_reload(struct ast_cli_entry *e, int cmd, struct ast_cl } else if (!strcasecmp(a->argv[2], "parameters")) { ast_set_flag(&mask, QUEUE_RELOAD_PARAMETERS); } else if (!strcasecmp(a->argv[2], "all")) { - ast_set_flag(&mask, AST_FLAGS_ALL); + ast_set_flag(&mask, AST_FLAGS_ALL & ~QUEUE_RESET_STATS); } if (a->argc == 3) { diff --git a/doc/CHANGES-staging/app_queue_stats.txt b/doc/CHANGES-staging/app_queue_stats.txt new file mode 100644 index 0000000000..36c0c3da06 --- /dev/null +++ b/doc/CHANGES-staging/app_queue_stats.txt @@ -0,0 +1,7 @@ +Subject: app_queue + +Reload behavior in app_queue has been changed so +queue and agent stats are not reset during full +app_queue module reloads. The queue reset stats +CLI command may still be used to reset stats while +Asterisk is running.