[asterisk-commits] app queue: Update dynamic members ringinuse on reload. (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 4 12:45:55 CDT 2016
Joshua Colp has submitted this change and it was merged.
Change subject: app_queue: Update dynamic members ringinuse on reload.
......................................................................
app_queue: Update dynamic members ringinuse on reload.
Previously, when reloading the members of a queue, the members added statically
(i.e. defined in queues.conf) would see their "ringinuse" value updated but not
the members added dynamically.
This change makes dynamic members ringuse value to be updated on reload.
Note that it's impossible to add a dynamic member with a specific ringinuse
value. For both static and dynamic members, the ringinuse value can always be
changed later on with command like "queue set ringinuse" or with the AMI action
"QueueMemberRingInUse". So it's possible this commit could break a user workflow
if he was changing the ringinuse value of dynamic members via such commands and
was also relying on the fact that a queue reload would not update the dynamic
members ringinuse value.
ASTERISK-26330
Change-Id: I3745cc9a06ba7e02c399636f1ee9e58c04081f3f
---
M UPGRADE.txt
M apps/app_queue.c
2 files changed, 23 insertions(+), 1 deletion(-)
Approvals:
George Joseph: Looks good to me, approved
Joshua Colp: Looks good to me, but someone else must approve; Verified
diff --git a/UPGRADE.txt b/UPGRADE.txt
index 7acc7a8..5f6cc3e 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -26,3 +26,9 @@
Build System:
- The LOW_MEMORY compile option no longer disables inline API. To disable
inline API you must use the DISABLE_INLINE option.
+
+Queue:
+ - When reloading the members of a queue, the members added dynamically (i.e.
+ added via the CLI command "queue add" or the AMI action "QueueAdd") now have
+ their ringinuse value updated to the value of the queue. Previously, the
+ ringinuse value for dynamic members was not updated on reload.
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 873ab0c..a023b88 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -7154,7 +7154,6 @@
ao2_lock(q);
if ((old_member = interface_exists(q, interface)) == NULL) {
if ((new_member = create_queue_member(interface, membername, penalty, paused, state_interface, q->ringinuse))) {
- new_member->ringinuse = q->ringinuse;
new_member->dynamic = 1;
if (reason_paused) {
ast_copy_string(new_member->reason_paused, reason_paused, sizeof(new_member->reason_paused));
@@ -9041,6 +9040,7 @@
{
int new;
struct call_queue *q = NULL;
+ struct member *member;
/*We're defining a queue*/
struct call_queue tmpq = {
.name = queuename,
@@ -9050,6 +9050,8 @@
const int member_reload = ast_test_flag(mask, QUEUE_RELOAD_MEMBER);
int prev_weight = 0;
struct ast_variable *var;
+ struct ao2_iterator mem_iter;
+
if (!(q = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Find queue for reload"))) {
if (queue_reload) {
/* Make one then */
@@ -9118,6 +9120,20 @@
}
}
+ /* Update ringinuse for dynamic members */
+ if (member_reload) {
+ ao2_lock(q->members);
+ mem_iter = ao2_iterator_init(q->members, AO2_ITERATOR_DONTLOCK);
+ while ((member = ao2_iterator_next(&mem_iter))) {
+ if (member->dynamic) {
+ member->ringinuse = q->ringinuse;
+ }
+ ao2_ref(member, -1);
+ }
+ ao2_iterator_destroy(&mem_iter);
+ ao2_unlock(q->members);
+ }
+
/* At this point, we've determined if the queue has a weight, so update use_weight
* as appropriate
*/
--
To view, visit https://gerrit.asterisk.org/3874
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3745cc9a06ba7e02c399636f1ee9e58c04081f3f
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Etienne Lessard <elessard at proformatique.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Etienne Lessard <elessard at proformatique.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list