[asterisk-commits] moy: branch moy/mfcr2 r154022 - /team/moy/mfcr2/channels/chan_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 3 14:29:52 CST 2008
Author: moy
Date: Mon Nov 3 14:29:52 2008
New Revision: 154022
URL: http://svn.digium.com/view/asterisk?view=rev&rev=154022
Log:
added mfcr2 show variants command
Modified:
team/moy/mfcr2/channels/chan_dahdi.c
Modified: team/moy/mfcr2/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2/channels/chan_dahdi.c?view=diff&rev=154022&r1=154021&r2=154022
==============================================================================
--- team/moy/mfcr2/channels/chan_dahdi.c (original)
+++ team/moy/mfcr2/channels/chan_dahdi.c Mon Nov 3 14:29:52 2008
@@ -12916,6 +12916,34 @@
return CLI_SUCCESS;
}
+static char *handle_mfcr2_show_variants(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+#define FORMAT "%4s %40s\n"
+ int i = 0;
+ int numvariants = 0;
+ const openr2_variant_entry_t *variants;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "mfcr2 show variants";
+ e->usage =
+ "Usage: mfcr2 show variants\n"
+ " Shows the list of MFC/R2 variants supported.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+ if (!(variants = openr2_proto_get_variant_list(&numvariants))) {
+ ast_cli(a->fd, "Failed to get list of variants.\n");
+ return CLI_FAILURE;
+ }
+ ast_cli(a->fd, FORMAT, "Variant Code", "Country");
+ for (i = 0; i < numvariants; i++) {
+ ast_cli(a->fd, FORMAT, variants[i].name, variants[i].country);
+ }
+ return CLI_SUCCESS;
+#undef FORMAT
+}
+
static char *handle_mfcr2_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
#define FORMAT "%4s %-7.7s %-7.7s %-8.8s %-9.9s %-16.16s %-8.8s %-8.8s\n"
@@ -12993,7 +13021,6 @@
ast_mutex_unlock(&iflock);
return CLI_SUCCESS;
#undef FORMAT
-#undef FORMAT2
}
static char *handle_mfcr2_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -13218,6 +13245,7 @@
static struct ast_cli_entry zap_mfcr2_cli[] = {
AST_CLI_DEFINE(handle_mfcr2_version, "Show OpenR2 library version"),
+ AST_CLI_DEFINE(handle_mfcr2_show_variants, "Show supported MFC/R2 variants"),
AST_CLI_DEFINE(handle_mfcr2_show_channels, "Show MFC/R2 channels"),
AST_CLI_DEFINE(handle_mfcr2_set_debug, "Set MFC/R2 channel logging level"),
AST_CLI_DEFINE(handle_mfcr2_call_files, "Enable/Disable MFC/R2 call files"),
More information about the asterisk-commits
mailing list