[asterisk-commits] mmichelson: trunk r77853 - in /trunk: ./ apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 1 09:02:20 CDT 2007
Author: mmichelson
Date: Wed Aug 1 09:02:19 2007
New Revision: 77853
URL: http://svn.digium.com/view/asterisk?view=rev&rev=77853
Log:
Merged revisions 77852 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r77852 | mmichelson | 2007-08-01 08:59:59 -0500 (Wed, 01 Aug 2007) | 7 lines
If a queue uses dynamic realtime members, then the member list should be updated after each attempt to call the queue.
This fixes an issue where if a caller calls into a queue where no one is logged in, they would wait forever even if a member
logged in at some point.
(closes issue #10346, reported by and tested by blitzrage, patched by me)
........
Modified:
trunk/ (props changed)
trunk/apps/app_queue.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=77853&r1=77852&r2=77853
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Aug 1 09:02:19 2007
@@ -1256,6 +1256,56 @@
AST_LIST_UNLOCK(&queues);
}
return q;
+}
+
+static void update_realtime_members(struct call_queue *q)
+{
+ struct ast_config *member_config = NULL;
+ struct member *m, *prev_m, *next_m;
+ char *interface = NULL;
+
+ member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
+ if (!member_config) {
+ /*This queue doesn't have realtime members*/
+ ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
+ return;
+ }
+
+ ast_mutex_lock(&q->lock);
+
+ /* Temporarily set non-dynamic members dead so we can detect deleted ones.*/
+ for (m = q->members; m; m = m->next) {
+ if (!m->dynamic)
+ m->dead = 1;
+ }
+
+ while ((interface = ast_category_browse(member_config, interface))) {
+ rt_handle_member_record(q, interface,
+ S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
+ ast_variable_retrieve(member_config, interface, "penalty"),
+ ast_variable_retrieve(member_config, interface, "paused"));
+ }
+
+ /* Delete all realtime members that have been deleted in DB. */
+ m = q->members;
+ prev_m = NULL;
+ while (m) {
+ next_m = m->next;
+ if (m->dead) {
+ if (prev_m) {
+ prev_m->next = next_m;
+ } else {
+ q->members = next_m;
+ }
+ remove_from_interfaces(m->interface);
+ q->membercount--;
+ free(m);
+ } else {
+ prev_m = m;
+ }
+ m = next_m;
+ }
+ ast_mutex_unlock(&q->lock);
}
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
@@ -3624,6 +3674,9 @@
break;
}
+ /* If using dynamic realtime members, we should regenerate the member list for this queue */
+ update_realtime_members(qe.parent);
+
/* OK, we didn't get anybody; wait for 'retry' seconds; may get a digit to exit with */
res = wait_a_bit(&qe);
if (res)
More information about the asterisk-commits
mailing list