aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-05 20:13:51 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-05 20:13:51 +0000
commitd1bedc0b2dc3a94cb3e00ec5f5bd44e1b0c4e817 (patch)
tree213bbff42b549da317933cbaa077753fcae01ccb /channels
parentd9b9b917e9ed636e0f699f97ff719d2c7fb4c65e (diff)
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)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@57943 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_zap.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 154885f3f..06bb13ad7 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -10994,6 +10994,29 @@ static int zap_show_status(int fd, int argc, char *argv[]) {
#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 @@ static const char zap_restart_usage[] =
" 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 @@ static struct ast_cli_entry zap_cli[] = {
{ { "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