summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-08-01 19:11:46 +0000
committerMatthew Jordan <mjordan@digium.com>2013-08-01 19:11:46 +0000
commitc8a91b5b013c568f3f99e8fb7abc662775c60520 (patch)
tree8957626a04440e492287497655f3a545b52e7f81
parent525df998831a773c51bc1696fbdcaf3b542f6974 (diff)
Add queue member paused hints
This patch adds the ability in Queue to raise a hint when a member's paused state changes. The hint uses the form 'Queue:{queue_name}_pause_{member_name}', where {queue_name} and {member_name} are the name of the queue and the name of the member to subscribe to, respectively. For example: exten => 8501,hint,Queue:sales_pause_mark. Members will show as In Use when paused. Note that the format of the queue pause hint was changed slightly from what is on the issue to accomodate suggestion on the code review. Review: https://reviewboard.asterisk.org/r/2254 (closes issue ASTERISK-20842) Reported by: Philippe Lindheimer patches: qpause-10-378206.diff uploaded by Philippe Lindheimer (license 5519) qpause-11-378206.diff uploaded by Philippe Lindheimer (license 5519) qpause-trunk-378206.diff uploaded by Philippe Lindheimer (license 5519) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--CHANGES6
-rw-r--r--apps/app_queue.c17
2 files changed, 21 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 7e9cc9813..952ad3b55 100644
--- a/CHANGES
+++ b/CHANGES
@@ -98,6 +98,12 @@ Queue
AgentConnect, AgentComplete, AgentDump, and AgentRingNoAnswer will always be
sent. The "Variable" fields will also no longer exist on the Agent* events.
+ * Queues now support a hint for member paused state. The hint uses the form
+ 'Queue:{queue_name}_pause_{member_name}', where {queue_name} and {member_name}
+ are the name of the queue and the name of the member to subscribe to,
+ respectively. For example: exten => 8501,hint,Queue:sales_pause_mark.
+ Members will show as In Use when paused.
+
ResetCDR
------------------
* The 'e' option has been deprecated. Use the CDR_PROP function to re-enable
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 732a55865..737de9df8 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2781,6 +2781,11 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
}
}
+
+#define QUEUE_PAUSED_DEVSTATE AST_DEVICE_INUSE
+#define QUEUE_UNPAUSED_DEVSTATE AST_DEVICE_NOT_INUSE
+#define QUEUE_UNKNOWN_PAUSED_DEVSTATE AST_DEVICE_NOT_INUSE
+
/*! \internal
* \brief If adding a single new member to a queue, use this function instead of ao2_linking.
* This adds round robin queue position data for a fresh member as well as links it.
@@ -2792,6 +2797,8 @@ static void member_add_to_queue(struct call_queue *queue, struct member *mem)
ao2_lock(queue->members);
mem->queuepos = ao2_container_count(queue->members);
ao2_link(queue->members, mem);
+ ast_devstate_changed(mem->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", queue->name, mem->interface);
ao2_unlock(queue->members);
}
@@ -2804,6 +2811,7 @@ static void member_add_to_queue(struct call_queue *queue, struct member *mem)
static void member_remove_from_queue(struct call_queue *queue, struct member *mem)
{
ao2_lock(queue->members);
+ ast_devstate_changed(QUEUE_UNKNOWN_PAUSED_DEVSTATE, AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", queue->name, mem->interface);
queue_member_follower_removal(queue, mem);
ao2_unlink(queue->members, mem);
ao2_unlock(queue->members);
@@ -2870,6 +2878,8 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, struc
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
if (paused_str) {
m->paused = paused;
+ ast_devstate_changed(m->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, m->interface);
}
if (strcasecmp(state_interface, m->state_interface)) {
ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
@@ -6286,7 +6296,8 @@ static int set_member_paused(const char *queuename, const char *interface, const
}
mem->paused = paused;
-
+ ast_devstate_changed(mem->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, mem->interface);
found++;
/* Before we do the PAUSE/UNPAUSE log, if this was a PAUSEALL/UNPAUSEALL, log that here, but only on the first found entry. */
@@ -7425,8 +7436,10 @@ static int queue_function_mem_write(struct ast_channel *chan, const char *cmd, c
if (m->realtime) {
update_realtime_member_field(m, q->name, args.option, rtvalue);
}
-
m->paused = (memvalue <= 0) ? 0 : 1;
+ ast_devstate_changed(m->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, args.interface);
+
} else if ((!strcasecmp(args.option, "ignorebusy")) || (!strcasecmp(args.option, "ringinuse"))) {
if (m->realtime) {
update_realtime_member_field(m, q->name, args.option, rtvalue);