[svn-commits] file: trunk r57943 - in /trunk: CHANGES channels/chan_zap.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Mar 5 13:13:51 MST 2007


Author: file
Date: Mon Mar  5 14:13:51 2007
New Revision: 57943

URL: http://svn.digium.com/view/asterisk?view=rev&rev=57943
Log:
Add zap show version CLI command. This pulls the version/echo canceller in use directly using the ZT_GETVERSION ioctl. (issue #9094 reported by tootai)

Modified:
    trunk/CHANGES
    trunk/channels/chan_zap.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=57943&r1=57942&r2=57943
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Mar  5 14:13:51 2007
@@ -67,6 +67,7 @@
   * Added 'o' and 'X' options to Chanspy.
   * Added the parkedcallreparking option to features.conf
   * SMDI is now enabled in voicemail using the smdienable option.
+  * Added zap show version CLI command to chan_zap.
 
 AMI - The manager (TCP/TLS/HTTP)
 --------------------------------

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=57943&r1=57942&r2=57943
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Mon Mar  5 14:13:51 2007
@@ -10994,6 +10994,29 @@
 #undef FORMAT2
 }
 
+static int zap_show_version(int fd, int argc, char *argv[])
+{
+	int pseudo_fd = -1;
+	struct zt_versioninfo vi;
+
+	if ((pseudo_fd = open("/dev/zap/ctl", O_RDONLY)) < 0) {
+		ast_cli(fd, "Failed to open control file to get version.\n");
+		return RESULT_SUCCESS;
+	}
+
+	strcpy(vi.version, "Unknown");
+	strcpy(vi.echo_canceller, "Unknown");
+
+	if (ioctl(pseudo_fd, ZT_GETVERSION, &vi))
+		ast_cli(fd, "Failed to get version from control file.\n");
+	else
+		ast_cli(fd, "Zaptel Version: %s Echo Canceller: %s\n", vi.version, vi.echo_canceller);
+
+	close(pseudo_fd);
+
+	return RESULT_SUCCESS;
+}
+
 static const char show_channels_usage[] =
 	"Usage: zap show channels\n"
 	"	Shows a list of available channels\n";
@@ -11017,6 +11040,10 @@
 	"	Note that this will STOP any running CALL on zaptel channels.\n"
 	"";
 
+static char zap_show_version_usage[] =
+        "Usage: zap show version\n"
+        "       Shows the Zaptel version in use\n";
+
 static struct ast_cli_entry zap_cli[] = {
 	{ { "zap", "show", "cadences", NULL },
 	handle_zap_show_cadences, "List cadences",
@@ -11041,6 +11068,10 @@
 	{ { "zap", "show", "status", NULL},
 	zap_show_status, "Show all Zaptel cards status",
 	zap_show_status_usage },
+
+	{ { "zap", "show", "version", NULL},
+	zap_show_version, "Show the Zaptel version in use",
+	zap_show_version_usage },
 };
 
 #define TRANSFER	0



More information about the svn-commits mailing list