[asterisk-commits] alecdavis: branch 11 r373804 - /branches/11/apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 26 03:30:00 CDT 2012
Author: alecdavis
Date: Wed Sep 26 03:29:53 2012
New Revision: 373804
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373804
Log:
app_queue: 'agent available' hint, cleanup restart, and initial state
Fix previously untested senarios;
1). On queue initialisation set queue_avail devstate to INUSE.
Previously was unavailable, which indicated an agent was available.
2). When removing members, if there are no other members available, set queue_avail to INUSE.
Previously, if a member interface had become 'unavailable', they were never going to be removed, particularly when persistant queues is enabled.
3). When adding a member, check that they are available, if they are set queue_avail to NOT_INUSE.
Previously on reloaded, members may have been 'unavailable'.
4). When pausing or unpausing a member, set appropriate queue availability.
alecdavis (license 585)
Reported by: Alec Davis
Tested by: alecdavis
Review: https://reviewboard.asterisk.org/r/2129/
Modified:
branches/11/apps/app_queue.c
Modified: branches/11/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_queue.c?view=diff&rev=373804&r1=373803&r2=373804
==============================================================================
--- branches/11/apps/app_queue.c (original)
+++ branches/11/apps/app_queue.c Wed Sep 26 03:29:53 2012
@@ -2018,6 +2018,15 @@
while ((pr_iter = AST_LIST_REMOVE_HEAD(&q->rules,list))) {
ast_free(pr_iter);
}
+
+ /* On restart assume no members are available.
+ * The queue_avail hint is a boolean state to indicate whether a member is available or not.
+ *
+ * This seems counter intuitive, but is required to light a BLF
+ * AST_DEVICE_INUSE indicates no members are available.
+ * AST_DEVICE_NOT_INUSE indicates a member is available.
+ */
+ ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
}
static void clear_queue(struct call_queue *q)
@@ -5899,7 +5908,7 @@
dump_queue_members(q);
}
- if (!ao2_container_count(q->members)) {
+ if (!num_available_members(q)) {
ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
}
@@ -5976,15 +5985,15 @@
new_member->penalty, new_member->calls, (int) new_member->lastcall,
new_member->status, new_member->paused);
+ if (is_member_available(new_member)) {
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);
+ }
+
ao2_ref(new_member, -1);
new_member = NULL;
if (dump) {
dump_queue_members(q);
- }
-
- if (ao2_container_count(q->members) == 1) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);
}
res = RES_OKAY;
@@ -6040,6 +6049,12 @@
if (queue_persistent_members) {
dump_queue_members(q);
+ }
+
+ if (is_member_available(mem)) {
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);
+ } else if (!num_available_members(q)) {
+ ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
}
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
More information about the asterisk-commits
mailing list