[asterisk-commits] mmichelson: branch mmichelson/queue-reset r99124 - /team/mmichelson/queue-res...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 18 16:35:22 CST 2008


Author: mmichelson
Date: Fri Jan 18 16:35:21 2008
New Revision: 99124

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99124
Log:
Adding manager commands to reload and reset queues. 

Next up: Documenting it all!


Modified:
    team/mmichelson/queue-reset/apps/app_queue.c

Change Statistics:
 team/mmichelson/queue-reset/apps/app_queue.c |   38 +++++++++++++++
 1 file changed, 38 insertions(+)

Modified: team/mmichelson/queue-reset/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-reset/apps/app_queue.c?view=diff&rev=99124&r1=99123&r2=99124
==============================================================================
--- team/mmichelson/queue-reset/apps/app_queue.c (original)
+++ team/mmichelson/queue-reset/apps/app_queue.c Fri Jan 18 16:35:21 2008
@@ -5687,6 +5687,41 @@
 	return 0;
 }
 
+static int manager_queue_reload(struct mansession *s, const struct message *m)
+{
+	enum queue_reload_mask mask = QUEUE_RELOAD_ALL;
+	const char *queuename = NULL;
+	
+	queuename = astman_get_header(m, "Queue");
+	if (!strcasecmp(S_OR(astman_get_header(m, "Reset"), ""), "no"))
+		mask &= ~QUEUE_RESET_STATS;
+	if (!strcasecmp(S_OR(astman_get_header(m, "Members"), ""), "no"))
+		mask &= ~QUEUE_RELOAD_MEMBER;
+	if (!strcasecmp(S_OR(astman_get_header(m, "Rules"), ""), "no"))
+		mask &= ~QUEUE_RELOAD_RULES;
+
+	reload_handler(1, mask, queuename);
+	return 0;
+}
+
+static int manager_queue_reset(struct mansession *s, const struct message *m)
+{
+	const char *queuename = NULL;
+	queuename = astman_get_header(m, "Queue");
+
+	reload_handler(1, QUEUE_RESET_STATS, queuename);
+	return 0;
+}
+
+static int manager_queue_member_reload(struct mansession *s, const struct message *m)
+{
+	const char *queuename = NULL;
+	queuename = astman_get_header(m, "Queue");
+
+	reload_handler(1, QUEUE_RELOAD_MEMBER, queuename);
+	return 0;
+}
+
 static char *complete_queue_add_member(const char *line, const char *word, int pos, int state)
 {
 	/* 0 - queue; 1 - add; 2 - member; 3 - <interface>; 4 - to; 5 - <queue>; 6 - penalty; 7 - <penalty>; 8 - as; 9 - <membername> */
@@ -6316,6 +6351,9 @@
 	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("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");
+	res |= ast_manager_register("QueueMemberReload", 0, manager_queue_member_reload, "Reload queue members");
 	res |= ast_custom_function_register(&queuevar_function);
 	res |= ast_custom_function_register(&queuemembercount_function);
 	res |= ast_custom_function_register(&queuemembercount_dep);




More information about the asterisk-commits mailing list