[asterisk-commits] moy: branch moy/mfcr2-1.4 r154133 - /team/moy/mfcr2-1.4/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 3 18:44:05 CST 2008


Author: moy
Date: Mon Nov  3 18:44:05 2008
New Revision: 154133

URL: http://svn.digium.com/view/asterisk?view=rev&rev=154133
Log:
added mfcr2 show variants command

Modified:
    team/moy/mfcr2-1.4/channels/chan_dahdi.c

Modified: team/moy/mfcr2-1.4/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.4/channels/chan_dahdi.c?view=diff&rev=154133&r1=154132&r2=154133
==============================================================================
--- team/moy/mfcr2-1.4/channels/chan_dahdi.c (original)
+++ team/moy/mfcr2-1.4/channels/chan_dahdi.c Mon Nov  3 18:44:05 2008
@@ -10765,6 +10765,24 @@
 {
 	ast_cli(fd, "OpenR2 version: %s, revision: %s\n", openr2_get_version(), openr2_get_revision());
 	return RESULT_SUCCESS;
+}
+
+static int handle_mfcr2_show_variants(int fd, int argc, char *argv[]) 
+{
+#define FORMAT "%4s %40s\n"
+	int numvariants = 0;
+	int i;
+	const openr2_variant_entry_t *variants;
+	if (!(variants = openr2_proto_get_variant_list(&numvariants))) {
+		ast_cli(fd, "Failed to get list of variants.\n");
+		return RESULT_FAILURE;
+	}
+	ast_cli(fd, FORMAT, "Variant Code", "Country");
+	for (i = 0; i < numvariants; i++) {
+		ast_cli(fd, FORMAT, variants[i].name, variants[i].country);
+	}
+	return RESULT_SUCCESS;
+#undef FORMAT
 }	
 
 static int handle_mfcr2_show_channels(int fd, int argc, char *argv[])
@@ -10834,7 +10852,6 @@
 	ast_mutex_unlock(&iflock);
 	return RESULT_SUCCESS;
 #undef FORMAT
-#undef FORMAT2
 }
 
 static int handle_mfcr2_set_debug(int fd, int argc, char *argv[])
@@ -11008,6 +11025,9 @@
 static const char dahdi_r2_version_help[] = 
 			"Usage: mfcr2 show version\n"
 			"       Shows the version of the OpenR2 library being used.\n";
+static const char dahdi_r2_variants_help[] = 
+			"Usage: mfcr2 show variants\n"
+			"       Show supported MFC/R2 variants.\n";
 static const char dahdi_r2_showchannels_help[] =
 			"Usage: mfcr2 show channels [group <group> | context <context>]\n"
 			"       Shows the zap channels configured with MFC/R2 signaling.\n";
@@ -11034,6 +11054,10 @@
 	{ { "mfcr2", "show", "version", NULL },
 	handle_mfcr2_version, "Show OpenR2 library version",
 	dahdi_r2_version_help },
+
+	{ { "mfcr2", "show", "variants", NULL },
+	handle_mfcr2_show_variants, "Show supported MFC/R2 variants",
+	dahdi_r2_variants_help },
 
 	{ { "mfcr2", "show", "channels", NULL },
 	handle_mfcr2_show_channels, "Show MFC/R2 channels",




More information about the asterisk-commits mailing list