summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorEtienne Lessard <elessard@proformatique.com>2016-09-09 13:38:39 -0400
committerEtienne Lessard <elessard@proformatique.com>2016-09-30 07:56:27 -0400
commit806d08b6751e450e10e18ca799b5bd8b55c9448a (patch)
tree823a8a963a8471158ee28e1556422beefea7ffeb /apps/app_queue.c
parent224c2952922d769af2d0e77da5612b8b7a649b42 (diff)
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
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 873ab0ce6..a023b88ed 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -7154,7 +7154,6 @@ static int add_to_queue(const char *queuename, const char *interface, const char
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 @@ static void reload_single_queue(struct ast_config *cfg, struct ast_flags *mask,
{
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 @@ static void reload_single_queue(struct ast_config *cfg, struct ast_flags *mask,
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 @@ static void reload_single_queue(struct ast_config *cfg, struct ast_flags *mask,
}
}
+ /* 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
*/