[Asterisk-code-review] apps/app_queue: Preserve reason for realtime queues (asterisk[18])

Niklas Larsson asteriskteam at digium.com
Wed Dec 21 06:36:37 CST 2022


Niklas Larsson has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19741 )


Change subject: apps/app_queue: Preserve reason for realtime queues
......................................................................

apps/app_queue: Preserve reason for realtime queues

When the Asterisk is restared it does not preserve paused reason for
members of realtime queues. This was fixed for non-realtime queues in
https://gerrit.asterisk.org/c/asterisk/+/2131/

ASTERISK-30366

Change-Id: Ica08baa5cab6b18105b5d719a183f9fd582fcf09
---
M apps/app_queue.c
1 file changed, 26 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/41/19741/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 288c0ff..7b99d12 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -3587,6 +3587,7 @@
 	const char *penalty_str = ast_variable_retrieve(member_config, category, "penalty");
 	const char *paused_str = ast_variable_retrieve(member_config, category, "paused");
 	const char *wrapuptime_str = ast_variable_retrieve(member_config, category, "wrapuptime");
+	const char *reason_paused = ast_variable_retrieve(member_config, category, "reason_paused");
 
 	if (ast_strlen_zero(rt_uniqueid)) {
 		ast_log(LOG_WARNING, "Realtime field 'uniqueid' is empty for member %s\n",
@@ -3653,6 +3654,7 @@
 			m->penalty = penalty;
 			m->ringinuse = ringinuse;
 			m->wrapuptime = wrapuptime;
+			ast_copy_string(m->reason_paused, (reason_paused ? reason_paused : "\0"), sizeof(m->reason_paused));
 			found = 1;
 			ao2_ref(m, -1);
 			break;
@@ -3667,6 +3669,9 @@
 			m->dead = 0;
 			m->realtime = 1;
 			ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
+			if(!ast_strlen_zero(reason_paused)){
+				ast_copy_string(m->reason_paused, reason_paused, sizeof(m->reason_paused));
+			}
 			if (!log_membername_as_agent) {
 				ast_queue_log(q->name, "REALTIME", m->interface, "ADDMEMBER", "%s", paused ? "PAUSED" : "");
 			} else {
@@ -7745,6 +7750,12 @@
 			ast_log(LOG_WARNING, "Failed %spause update of realtime queue member %s:%s\n",
 				(paused ? "" : "un"), q->name, mem->interface);
 		}
+		if(strcmp(mem->reason_paused, reason ? reason : "\0")){
+			if (update_realtime_member_field(mem, q->name, "reason_paused", reason ? reason : "")) {
+				ast_log(LOG_WARNING, "Failed reason '%s' update of realtime queue member %s:%s\n",
+					reason ? reason : "", q->name, mem->interface);
+			}
+		}
 	}
 
 	mem->paused = paused;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19741
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ica08baa5cab6b18105b5d719a183f9fd582fcf09
Gerrit-Change-Number: 19741
Gerrit-PatchSet: 1
Gerrit-Owner: Niklas Larsson <niklas at tese.se>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221221/43c08396/attachment-0001.html>


More information about the asterisk-code-review mailing list