summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2007-08-29 16:39:40 +0000
committerMark Michelson <mmichelson@digium.com>2007-08-29 16:39:40 +0000
commitfaeaff33bb0de3f94c781de2f90afd10c81f22dc (patch)
treeca3029fc646a92ef50394a3021f19cac08a40986 /apps
parente311ae98d1405e2b39f45f78e700999a5842e67b (diff)
Merged revisions 81349 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r81349 | mmichelson | 2007-08-29 11:35:29 -0500 (Wed, 29 Aug 2007) | 12 lines This patch, in essence, will correctly pause a realtime queue member and reflect those changes in the realtime engine. (issue #10424, reported by irroot, patch by me) This patch creates a new function called update_realtime_member_field, which is a generic function which will allow any one field of a realtime queue member to be updated. This patch only uses this function to update the paused status of a queue member, but it lays the foundation for persisting the state of a realtime member the same way that static members' state is maintained when using the persistentmembers setting ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index b57db57da..828a72be5 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1265,6 +1265,25 @@ static struct call_queue *load_realtime_queue(const char *queuename)
return q;
}
+static int update_realtime_member_field(struct member *mem, const char *queue_name, const char *field, const char *value)
+{
+ struct ast_variable *var;
+ int ret = -1;
+
+ if(!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL)))
+ return ret;
+ while (var) {
+ if(!strcmp(var->name, "uniqueid"))
+ break;
+ var = var->next;
+ }
+ if(var && !ast_strlen_zero(var->value)) {
+ if ((ast_update_realtime("queue_members", "uniqueid", var->value, field, value, NULL)) > -1)
+ ret = 0;
+ }
+ return ret;
+}
+
static void update_realtime_members(struct call_queue *q)
{
struct ast_config *member_config = NULL;
@@ -3173,6 +3192,9 @@ static int set_member_paused(const char *queuename, const char *interface, int p
if (queue_persistent_members)
dump_queue_members(q);
+ if(mem->realtime)
+ update_realtime_member_field(mem, queuename, "paused", paused ? "1" : "0");
+
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
manager_event(EVENT_FLAG_AGENT, "QueueMemberPaused",