summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_oss.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 268ff782f..e665eb2e9 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1125,25 +1125,32 @@ static char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args
{
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;
}