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
changes/74/3874/3
Etienne Lessard 9 years ago
parent 224c295292
commit 806d08b675

@ -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.

@ -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
*/

Loading…
Cancel
Save