[asterisk-commits] russell: branch russell/chan_console r54034 - /team/russell/chan_console/chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Feb 12 09:39:21 MST 2007


Author: russell
Date: Mon Feb 12 10:39:20 2007
New Revision: 54034

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54034
Log:
Add "answer" 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=54034&r1=54033&r2=54034
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Mon Feb 12 10:39:20 2007
@@ -858,6 +858,38 @@
 }
 
 /*!
+ * \brief answer command from the console
+ */
+static char *cli_console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
+	struct console_pvt *pvt = &console_pvt;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console answer";
+		e->usage =
+			"Usage: console answer\n"
+			"       Answers an incoming call on the console (OSS) channel.\n";
+		return NULL;
+
+	case CLI_GENERATE:
+		return NULL;	/* no completion */
+	}
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
+	if (!pvt->owner) {
+		ast_cli(a->fd, "No one is calling us\n");
+		return CLI_FAILURE;
+	}
+	pvt->hookstate = 1;
+	pvt->cursound = -1;
+	ast_queue_frame(pvt->owner, &f);
+
+	return CLI_SUCCESS;
+}
+
+/*!
  * \brief Console send text CLI command
  *
  * \note concatenate all arguments into a single string. argv is NULL-terminated
@@ -901,6 +933,7 @@
 	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_console_answer, "Answer an incoming console call"),
 	NEW_CLI(cli_console_sendtext, "Send text to a connected party"),
 	NEW_CLI(cli_list_devices, "List available devices"),
 };



More information about the asterisk-commits mailing list