[asterisk-commits] eliel: branch group/per_member_wrapuptime r194206 - /team/group/per_member_wr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 12 22:13:40 CDT 2009


Author: eliel
Date: Tue May 12 22:13:25 2009
New Revision: 194206

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=194206
Log:
Make CLI command 'queue set wrapuptime' and AMI action 'QueueWrapuptime' modify
the member configuration and do not allow with this command the possibility to
modify the Next wrapuptime only.


Modified:
    team/group/per_member_wrapuptime/apps/app_queue.c

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=194206&r1=194205&r2=194206
==============================================================================
--- team/group/per_member_wrapuptime/apps/app_queue.c (original)
+++ team/group/per_member_wrapuptime/apps/app_queue.c Tue May 12 22:13:25 2009
@@ -6907,22 +6907,16 @@
  */
 static int manager_queue_member_wrapuptime(struct mansession *s, const struct message *m)
 {
-	const char *interface, *wrapuptime, *static_value, *queue;
-	int default_wrapuptime = 0, is_absolute = 1, value;
+	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");
-	static_value = astman_get_header(m, "Static");
 
 	if (ast_strlen_zero(interface) || ast_strlen_zero(wrapuptime)) {
 		astman_send_error(s, m, "Need 'Interface' and 'Wrapuptime' parameters.");
-		return -1;
-	}
-
-	if (!ast_strlen_zero(static_value)) {
-		/* also modify the member static value? */
-		default_wrapuptime = ast_true(static_value);
+		return 0;
 	}
 
 	if (strchr(wrapuptime, '+') || strchr(wrapuptime, '-')) {
@@ -6931,7 +6925,7 @@
 
 	value = atoi(wrapuptime);
 
-	if (set_member_wrapuptime(queue, interface, value, default_wrapuptime, is_absolute) < 0) {
+	if (set_member_wrapuptime(queue, interface, value, 1, is_absolute) < 0) {
 		astman_send_error(s, m, "Error while modifying the member wrapuptime.");
 	}
 
@@ -7253,9 +7247,9 @@
 /*! \brief Implement autocomplete for CLI command 'queue set wrapuptime' */
 static char *complete_queue_set_member_wrapuptime(const char *line, const char *word, int pos, int state)
 {
-	static char *opts[] = { "in", "static", NULL };
-
-	/* 0 - queue; 1 - set; 2 - wrapuptime; 3 - <wrapuptime>; 4 - on; 5 - <member>; 6 - in; 7 - <queue>; 8 - current*/
+	static char *opts[] = { "in", NULL };
+
+	/* 0 - queue; 1 - set; 2 - wrapuptime; 3 - <wrapuptime>; 4 - on; 5 - <member>; 6 - in; 7 - <queue> */
 	switch (pos) {
 	case 3:
 		return ast_cli_complete_number(word, 0, 0x7fffffff, state);
@@ -7267,15 +7261,7 @@
 	case 6:
 		return ast_cli_complete(word, opts, state);
 	case 7:
-		if (strstr(line, " in ")) {
-			return complete_queue(line, word, pos, state);
-		}
-		break;
-	case 8:
-		if (!state) {
-			return ast_strdup("static");
-		}
-		break;
+		return complete_queue(line, word, pos, state);
 	default:
 		return NULL;
 	}
@@ -7287,13 +7273,13 @@
 static char *handle_queue_set_member_wrapuptime(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	char *queuename = NULL, *interface, *ret;
-	int wrapuptime, member_default = 0, absolute = 1;
+	int wrapuptime, absolute = 1;
 
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "queue set wrapuptime";
 		e->usage = 
-		"Usage: queue set wrapuptime <wrapuptime> on <interface> [in <queue>] [static]\n"
+		"Usage: queue set wrapuptime <wrapuptime> on <interface> [in <queue>]\n"
 		"	Set a member's wrapuptime in the queue specified. If no queue is specified\n"
 		"	then that interface's wrapuptime is set in all queues to which that interface is a member.\n"
 		"       if 'static' is specified, only modify the wrapuptime for the last call\n";
@@ -7302,10 +7288,9 @@
 		return complete_queue_set_member_wrapuptime(a->line, a->word, a->pos, a->n);
 	}
 
-	if (a->argc < 6 || a->argc > 9) {
+	if (a->argc < 6 || a->argc > 8) {
 		return CLI_SHOWUSAGE;
-	} else if (strcasecmp(a->argv[4], "on") || ((a->argc > 6 && strcmp(a->argv[6], "in"))
-		&& (a->argc == 9 && strcasecmp(a->argv[a->argc - 1], "static")))) {
+	} else if (strcasecmp(a->argv[4], "on") || (a->argc > 6 && strcmp(a->argv[6], "in"))) {
 		return CLI_SHOWUSAGE;
 	}
 
@@ -7314,17 +7299,13 @@
 	}
 	interface = a->argv[5];
 	wrapuptime = atoi(a->argv[3]);
-
-	if ((a->argc == 7 || a->argc == 9) && !strcasecmp(a->argv[a->argc - 1], "static")) {
-		member_default = 1;
-	}
 
 	/* the passed value is an offset or an absolute value? */
 	if (strchr(a->argv[3], '+') || strchr(a->argv[3], '-')) {
 		absolute = 0;
 	}
 
-	if (set_member_wrapuptime(queuename, interface, wrapuptime, member_default, absolute)) {
+	if (set_member_wrapuptime(queuename, interface, wrapuptime, 1, absolute)) {
 		ast_cli(a->fd, "Failed to set wrapuptime on interface '%s'", interface);
 		ret = CLI_FAILURE;
 	} else {




More information about the asterisk-commits mailing list