summaryrefslogtreecommitdiff
path: root/fxstest.c
diff options
context:
space:
mode:
authorDoug Bailey <dbailey@digium.com>2009-01-19 15:19:31 +0000
committerDoug Bailey <dbailey@digium.com>2009-01-19 15:19:31 +0000
commitd7850e8fcb49ac546e052d839ca23987dc35a08b (patch)
treed5da28a508683929baaf4bd6a46a785b8ff93445 /fxstest.c
parente90d34e571562884b239bc59af77dabbcfaf4b8a (diff)
Add test to excercise VMWI
Enhance polarity test by making sure the line is in an active state before testing (issue #14104) Reported by: alecdavis Patches: dahditools-14104.diff.txt uploaded by dbailey (license ) Tested by: alecdavis git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@5728 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'fxstest.c')
-rw-r--r--fxstest.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/fxstest.c b/fxstest.c
index c1606d0..0b4d3c4 100644
--- a/fxstest.c
+++ b/fxstest.c
@@ -58,7 +58,8 @@ int main(int argc, char *argv[])
" regdump - dumps ProSLIC registers\n"
" tones - plays a series of tones\n"
" polarity - tests polarity reversal\n"
- " ring - rings phone\n");
+ " ring - rings phone\n"
+ " vmwi - toggles VMWI lamp\n");
exit(1);
}
fd = open(argv[1], O_RDWR);
@@ -66,8 +67,27 @@ int main(int argc, char *argv[])
fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno));
exit(1);
}
- if (!strcasecmp(argv[2], "ring")) {
- fprintf(stderr, "Ringing phone...\n");
+
+ if (!strcasecmp(argv[2], "vmwi")) {
+ fprintf(stderr, "Twiddling vmwi...\n");
+ x = DAHDI_VMWI_LREV | 1;
+ res = ioctl(fd, DAHDI_VMWI, &x);
+ if (res) {
+ fprintf(stderr, "Unable to set VMWI...\n");
+ } else {
+ fprintf(stderr, "Set 1 Voice Message...\n");
+ sleep(5);
+ x = DAHDI_VMWI_LREV | 2;
+ ioctl(fd, DAHDI_VMWI, &x);
+ fprintf(stderr, "Set 2 Voice Messages...\n");
+ sleep(5);
+ x = DAHDI_VMWI_LREV;
+ ioctl(fd, DAHDI_VMWI, &x);
+ fprintf(stderr, "Set No Voice messages...\n");
+ sleep(2);
+ }
+ } else if (!strcasecmp(argv[2], "ring")) {
+ fprintf(stderr, "Ringing phone...\n");
x = DAHDI_RING;
res = ioctl(fd, DAHDI_HOOK, &x);
if (res) {
@@ -78,6 +98,13 @@ int main(int argc, char *argv[])
}
} else if (!strcasecmp(argv[2], "polarity")) {
fprintf(stderr, "Twiddling polarity...\n");
+ /* Insure that the channel is in active mode */
+ x = DAHDI_RING;
+ res = ioctl(fd, DAHDI_HOOK, &x);
+ usleep(100000);
+ x = 0;
+ res = ioctl(fd, DAHDI_HOOK, &x);
+
x = 0;
res = ioctl(fd, DAHDI_SETPOLARITY, &x);
if (res) {