[asterisk-commits] rizzo: branch rizzo/video_console r125275 - /team/rizzo/video_console/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 26 00:57:06 CDT 2008


Author: rizzo
Date: Thu Jun 26 00:57:05 2008
New Revision: 125275

URL: http://svn.digium.com/view/asterisk?view=rev&rev=125275
Log:
implement 'console mute toggle' to ease handling the mute status from
the GUI or CLI

Modified:
    team/rizzo/video_console/channels/chan_oss.c

Modified: team/rizzo/video_console/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_console/channels/chan_oss.c?view=diff&rev=125275&r1=125274&r2=125275
==============================================================================
--- team/rizzo/video_console/channels/chan_oss.c (original)
+++ team/rizzo/video_console/channels/chan_oss.c Thu Jun 26 00:57:05 2008
@@ -1125,25 +1125,32 @@
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
 	char *s;
+	int toggle = 0;
 	
 	if (cmd == CLI_INIT) {
-		e->command = "console {mute|unmute}";
+		e->command = "console {mute|unmute} [toggle]";
 		e->usage =
-			"Usage: console {mute|unmute}\n"
+			"Usage: console {mute|unmute} [toggle]\n"
 			"       Mute/unmute the microphone.\n";
 		return NULL;
 	} else if (cmd == CLI_GENERATE)
 		return NULL;
 
-	if (a->argc != e->args)
+	if (a->argc > e->args)
 		return CLI_SHOWUSAGE;
-	s = a->argv[e->args-1];
+	if (a->argc == e->args) {
+		if (strcasecmp(a->argv[e->args-1], "toggle"))
+			return CLI_SHOWUSAGE;
+		toggle = 1;
+	}
+	s = a->argv[e->args-2];
 	if (!strcasecmp(s, "mute"))
-		o->mute = 1;
+		o->mute = toggle ? ~o->mute : 1;
 	else if (!strcasecmp(s, "unmute"))
-		o->mute = 0;
+		o->mute = toggle ? ~o->mute : 0;
 	else
 		return CLI_SHOWUSAGE;
+	ast_cli(a->fd, "Console mic is %s\n", o->mute ? "off" : "on");
 	return CLI_SUCCESS;
 }
 




More information about the asterisk-commits mailing list