dect
/
asterisk
Archived
13
0
Fork 0

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
This commit is contained in:
file 2007-03-05 20:13:51 +00:00
parent d9b9b917e9
commit d1bedc0b2d
2 changed files with 32 additions and 0 deletions

View File

@ -67,6 +67,7 @@ Miscellaneous
* 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)
--------------------------------

View File

@ -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