[asterisk-commits] mmichelson: branch 1.4 r81349 - /branches/1.4/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 29 11:35:29 CDT 2007


Author: mmichelson
Date: Wed Aug 29 11:35:29 2007
New Revision: 81349

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81349
Log:
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


Modified:
    branches/1.4/apps/app_queue.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=81349&r1=81348&r2=81349
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Wed Aug 29 11:35:29 2007
@@ -1122,6 +1122,25 @@
 	ast_mutex_unlock(&q->lock);
 
 	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)
@@ -2963,6 +2982,9 @@
 				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",




More information about the asterisk-commits mailing list