[asterisk-commits] moy: branch moy/mfcr2-1.2 r154134 - /team/moy/mfcr2-1.2/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 3 19:15:54 CST 2008


Author: moy
Date: Mon Nov  3 19:15:54 2008
New Revision: 154134

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

Modified:
    team/moy/mfcr2-1.2/channels/chan_zap.c

Modified: team/moy/mfcr2-1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/channels/chan_zap.c?view=diff&rev=154134&r1=154133&r2=154134
==============================================================================
--- team/moy/mfcr2-1.2/channels/chan_zap.c (original)
+++ team/moy/mfcr2-1.2/channels/chan_zap.c Mon Nov  3 19:15:54 2008
@@ -10095,6 +10095,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[])
@@ -10164,7 +10182,6 @@
 	ast_mutex_unlock(&iflock);
 	return RESULT_SUCCESS;
 #undef FORMAT
-#undef FORMAT2
 }
 
 static int handle_mfcr2_set_debug(int fd, int argc, char *argv[])
@@ -10338,6 +10355,9 @@
 static char zt_r2_version_help[] = 
 			"Usage: mfcr2 show version\n"
 			"       Shows the version of the OpenR2 library being used.\n";
+static char zt_r2_variants_help[] = 
+			"Usage: mfcr2 show variants\n"
+			"       Show supported MFC/R2 variants.\n";
 static char zt_r2_showchannels_help[] =
 			"Usage: mfcr2 show channels [group <group> | context <context>]\n"
 			"       Shows the zap channels configured with MFC/R2 signaling.\n";
@@ -10364,6 +10384,10 @@
 	{ { "mfcr2", "show", "version", NULL },
 	handle_mfcr2_version, "Show OpenR2 library version",
 	zt_r2_version_help },
+
+	{ { "mfcr2", "show", "variants", NULL },
+	handle_mfcr2_show_variants, "Show supported MFC/R2 variants",
+	zt_r2_variants_help},
 
 	{ { "mfcr2", "show", "channels", NULL },
 	handle_mfcr2_show_channels, "Show MFC/R2 channels",




More information about the asterisk-commits mailing list