[svn-commits] eliel: branch group/per_member_wrapuptime r194210 - in /team/group/per_member...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 13 08:40:13 CDT 2009


Author: eliel
Date: Wed May 13 08:40:10 2009
New Revision: 194210

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=194210
Log:
- Rename the QueueWrapuptime action to QueueMemberWrapuptime.
- New AMI action QueueMemberNextWrapuptime to specify the wrapuptime only for
  the next call.
- Make the CLI command 'queue set member wrapuptime' to modify only the static configuration
  and no the next wrapuptime value.

Modified:
    team/group/per_member_wrapuptime/CHANGES
    team/group/per_member_wrapuptime/apps/app_queue.c
    team/group/per_member_wrapuptime/doc/manager_1_1.txt

Modified: team/group/per_member_wrapuptime/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/per_member_wrapuptime/CHANGES?view=diff&rev=194210&r1=194209&r2=194210
==============================================================================
--- team/group/per_member_wrapuptime/CHANGES (original)
+++ team/group/per_member_wrapuptime/CHANGES Wed May 13 08:40:10 2009
@@ -495,6 +495,9 @@
 
 AMI - The manager (TCP/TLS/HTTP)
 --------------------------------
+  * New AMI action 'QueueMemberWrapuptime to specify a members wrapuptime.
+  * New AMI action 'QueueMemberNextWrapuptime' to specify a members wrapuptime for
+    the next call.
   * The Status command now takes an optional list of variables to display
     along with channel status.
   * The QueueEntry event now also includes the channel's uniqueid

Modified: team/group/per_member_wrapuptime/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/per_member_wrapuptime/apps/app_queue.c?view=diff&rev=194210&r1=194209&r2=194210
==============================================================================
--- team/group/per_member_wrapuptime/apps/app_queue.c (original)
+++ team/group/per_member_wrapuptime/apps/app_queue.c Wed May 13 08:40:10 2009
@@ -4498,6 +4498,12 @@
 		if (ast_strlen_zero(queuename) || !strcasecmp(q->name, queuename)) {
 			if ((mem = interface_exists(q, interface))) {
 				foundinterface++;
+				/* this wrapuptime will be used only for the next call to this agent. */
+				if (absolute_value) {
+					mem->current_wrapuptime = offset;
+				} else {
+					mem->current_wrapuptime += offset;
+				}
 				/* modify static configuration. */
 				if (modify_defaults) {
 					if (absolute_value) {
@@ -4515,12 +4521,14 @@
 							"Interface: %s\r\n"
 							"Wrapuptime: %d\r\n",
 							q->name, mem->interface, mem->wrapuptime);
-				}
-				/* this wrapuptime will be used only for the next call to this agent. */
-				if (absolute_value) {
-					mem->current_wrapuptime = offset;
 				} else {
-					mem->current_wrapuptime += offset;
+					ast_queue_log(q->name, "NONE", interface, "NEXTWRAPUPTIME", "%d", mem->current_wrapuptime);
+					manager_event(EVENT_FLAG_AGENT, "QueueMemberNextWrapuptime",
+							"Queue: %s\r\n"
+							"Interface: %s\r\n"
+							"Wrapuptime: %d\r\n",
+							q->name, mem->interface, mem->current_wrapuptime);
+
 				}
 				ao2_ref(mem, -1);
 			}
@@ -6367,7 +6375,7 @@
 					mem->paused ? " (paused)" : "",
 					ast_devstate2str(mem->status));
 				if (mem->wrapuptime >= 0) {
-					ast_str_append(&out, 0, " (wrapuptime = %d)", mem->wrapuptime);
+					ast_str_append(&out, 0, " (wrapuptime = %d/%d)", mem->wrapuptime, mem->current_wrapuptime);
 				}
 				if (mem->calls)
 					ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago) ",
@@ -6903,35 +6911,53 @@
 
 /*!
  * \internal
+ * \brief Modify the queue member wrapuptime based on the manager request.
+ */
+static int handle_manager_queue_member_wrapuptime(struct mansession *s, const struct message *m, int only_static)
+{
+	const char *interface, *wrapuptime, *queue;
+	int is_absolute = 1, value;
+
+	interface = astman_get_header(m, "Interface");
+	queue = astman_get_header(m, "Queue");
+	wrapuptime = astman_get_header(m, "Wrapuptime");
+
+	if (ast_strlen_zero(interface) || ast_strlen_zero(wrapuptime)) {
+		astman_send_error(s, m, "Need 'Interface' and 'Wrapuptime' parameters.");
+		return 0;
+	}
+
+	if (strchr(wrapuptime, '+') || strchr(wrapuptime, '-')) {
+		is_absolute = 0;
+	}
+
+	value = atoi(wrapuptime);
+
+	if (set_member_wrapuptime(queue, interface, value, only_static, is_absolute) < 0) {
+		astman_send_error(s, m, "Error while modifying the member wrapuptime.");
+	}
+
+	astman_send_ack(s, m, "Member wrapuptime modified.");
+
+	return 0;
+}
+
+/*!
+ * \internal
  * \brief Manager action to set the queue member wrapuptime.
  */
 static int manager_queue_member_wrapuptime(struct mansession *s, const struct message *m)
 {
-	const char *interface, *wrapuptime, *queue;
-	int is_absolute = 1, value;
-
-	interface = astman_get_header(m, "Interface");
-	queue = astman_get_header(m, "Queue");
-	wrapuptime = astman_get_header(m, "Wrapuptime");
-
-	if (ast_strlen_zero(interface) || ast_strlen_zero(wrapuptime)) {
-		astman_send_error(s, m, "Need 'Interface' and 'Wrapuptime' parameters.");
-		return 0;
-	}
-
-	if (strchr(wrapuptime, '+') || strchr(wrapuptime, '-')) {
-		is_absolute = 0;
-	}
-
-	value = atoi(wrapuptime);
-
-	if (set_member_wrapuptime(queue, interface, value, 1, is_absolute) < 0) {
-		astman_send_error(s, m, "Error while modifying the member wrapuptime.");
-	}
-
-	astman_send_ack(s, m, "Member wrapuptime modified.");
-
-	return 0;
+	return handle_manager_queue_member_wrapuptime(s, m, 1);
+}
+
+/*!
+ * \internal
+ * \brief Manager action to set the queue member next wrapuptime.
+ */
+static int manager_queue_member_next_wrapuptime(struct mansession *s, const struct message *m)
+{
+	return handle_manager_queue_member_wrapuptime(s, m, 0);
 }
 
 static char *handle_queue_add_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -7581,7 +7607,9 @@
 	res |= ast_manager_register("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable");
 	res |= ast_manager_register("QueueLog", EVENT_FLAG_AGENT, manager_queue_log_custom, "Adds custom entry in queue_log");
 	res |= ast_manager_register("QueuePenalty", EVENT_FLAG_AGENT, manager_queue_member_penalty, "Set the penalty for a queue member"); 
-	res |= ast_manager_register("QueueWrapuptime", EVENT_FLAG_AGENT, manager_queue_member_wrapuptime, "Set the wrapuptime for a queue member"); 
+	res |= ast_manager_register("QueueMemberWrapuptime", EVENT_FLAG_AGENT, manager_queue_member_wrapuptime, "Set the wrapuptime for a queue member."); 
+	res |= ast_manager_register("QueueMemberNextWrapuptime", EVENT_FLAG_AGENT, manager_queue_member_next_wrapuptime,
+		"Set the wrapuptime for a queue member, only for the next call."); 
 	res |= ast_manager_register("QueueRule", 0, manager_queue_rule_show, "Queue Rules");
 	res |= ast_manager_register("QueueReload", 0, manager_queue_reload, "Reload a queue, queues, or any sub-section of a queue or queues");
 	res |= ast_manager_register("QueueReset", 0, manager_queue_reset, "Reset queue statistics");

Modified: team/group/per_member_wrapuptime/doc/manager_1_1.txt
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/per_member_wrapuptime/doc/manager_1_1.txt?view=diff&rev=194210&r1=194209&r2=194210
==============================================================================
--- team/group/per_member_wrapuptime/doc/manager_1_1.txt (original)
+++ team/group/per_member_wrapuptime/doc/manager_1_1.txt Wed May 13 08:40:10 2009
@@ -138,18 +138,27 @@
 
 * NEW ACTIONS
 -------------
-- Action: QueueWrapuptime
-	Modules: app_queue
-	Purpose:
-		Set the queue members wrapuptime, also disable the wrapuptime or
-		increment it for the next call.
+- Action: QueueMemberWrapuptime
+	Modules: app_queue
+	Purpose:
+		Set the queue members wrapuptime.
 	Variables:
 	  ActionID: <id>	Action ID for this transaction. WIll be returned.
 	  Interface: <member>	The member interface name.
 	  Queue: <queuename>	(optional) Specify a queue to only apply the changes
 	  			for the member in that queue.
-	  Static: <boolean>	If 'true' apply the change to the member configuration,
-	  			if 'false' only apply the change to the next call.
+	  Wrapuptime: <value>	The wrapuptime integer value to set, if a + o - is specified,
+	  			the value is treated as an offset of the current wrapuptime
+				value.
+- Action: QueueMemberNextWrapuptime
+	Modules: app_queue
+	Purpose:
+		Set the queue members wrapuptime only for the next call.
+	Variables:
+	  ActionID: <id>	Action ID for this transaction. WIll be returned.
+	  Interface: <member>	The member interface name.
+	  Queue: <queuename>	(optional) Specify a queue to only apply the changes
+	  			for the member in that queue.
 	  Wrapuptime: <value>	The wrapuptime integer value to set, if a + o - is specified,
 	  			the value is treated as an offset of the current wrapuptime
 				value.




More information about the svn-commits mailing list