[asterisk-commits] russell: branch russell/chan_console r49059 -
/team/russell/chan_console/chan...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Dec 29 06:39:24 MST 2006
Author: russell
Date: Fri Dec 29 07:39:24 2006
New Revision: 49059
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49059
Log:
Add support for the console {mute|unmute} CLI command.
Modified:
team/russell/chan_console/channels/chan_console.c
Modified: team/russell/chan_console/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_console.c?view=diff&rev=49059&r1=49058&r2=49059
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Fri Dec 29 07:39:24 2006
@@ -126,6 +126,8 @@
unsigned int sampsent;
/*! On-hook = 0, Off-hook = 1 */
unsigned int hookstate:1;
+ /*! Unmuted = 0, Muted = 1 */
+ unsigned int muted:1;
/*! Ignore context in the console dial CLI command */
unsigned int overridecontext:1;
/*! The PortAudio callback is being executed */
@@ -468,7 +470,8 @@
fr->subclass = AST_FORMAT_SLINEAR;
fr->samples = NUM_SAMPLES;
fr->datalen = NUM_SAMPLES * 2;
- memcpy(fr->data, input, NUM_SAMPLES * 2);
+ if (!pvt.muted) /* If muted, just leave the data all zeros */
+ memcpy(fr->data, input, NUM_SAMPLES * 2);
/* If the channel is in the process of being hung up, then it will be
* locked while calling the console_hangup callback, and that could be
@@ -616,6 +619,35 @@
return CLI_SUCCESS;
}
+static char *cli_console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char *s;
+
+ if (cmd == CLI_INIT) {
+ e->command = "console {mute|unmute}";
+ e->usage =
+ "Usage: console {mute|unmute}\n"
+ " Mute/unmute the microphone.\n";
+ return NULL;
+ } else if (cmd == CLI_GENERATE)
+ return NULL;
+
+ if (a->argc != e->args)
+ return CLI_SHOWUSAGE;
+ s = a->argv[e->args-1];
+ if (!strcasecmp(s, "mute"))
+ pvt.muted = 1;
+ else if (!strcasecmp(s, "unmute"))
+ pvt.muted = 0;
+ else
+ return CLI_SHOWUSAGE;
+
+ ast_verbose(" --- <(\"<) --- The Console is now %s --- (>\")> ---\n",
+ pvt.muted ? "Muted" : "Unmuted");
+
+ return CLI_SUCCESS;
+}
+
static char *cli_list_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
PaDeviceIndex index, num, def_input, def_output;
@@ -658,6 +690,7 @@
static struct ast_cli_entry cli_console[] = {
NEW_CLI(cli_console_dial, "Dial an extension from the console"),
NEW_CLI(cli_console_hangup, "Hangup a call on the console"),
+ NEW_CLI(cli_console_mute, "Disable/Enable mic input"),
NEW_CLI(cli_list_devices, "List available devices"),
};
More information about the asterisk-commits
mailing list