7 my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
11 last unless length($_);
12 if (/^agi_(\w+)\:\s+(.*)$/) {
17 print STDERR
"AGI Environment Dump:\n";
18 foreach my $i (sort keys %AGI) {
19 print STDERR
" -- $i = $AGI{$i}\n";
28 $res =~ /result=(-?\d+)/;
30 print STDERR
"FAIL ($res)\n";
33 print STDERR
"PASS ($1)\n";
37 print STDERR
"FAIL (unexpected result '$res')\n";
42 print STDERR
"1. Testing 'sendfile'...";
43 print "STREAM FILE beep \"\"\n";
45 &checkresult
($result);
47 print STDERR
"2. Testing 'sendtext'...";
48 print "SEND TEXT \"hello world\"\n";
50 &checkresult
($result);
52 print STDERR
"3. Testing 'sendimage'...";
53 print "SEND IMAGE asterisk-image\n";
55 &checkresult
($result);
57 print STDERR
"4. Testing 'saynumber'...";
58 print "SAY NUMBER 192837465 \"\"\n";
60 &checkresult
($result);
62 print STDERR
"5. Testing 'waitdtmf'...";
63 print "WAIT FOR DIGIT 1000\n";
65 &checkresult
($result);
67 print STDERR
"6. Testing 'record'...";
68 print "RECORD FILE testagi gsm 1234 3000\n";
70 &checkresult
($result);
72 print STDERR
"6a. Testing 'record' playback...";
73 print "STREAM FILE testagi \"\"\n";
75 &checkresult
($result);
77 print STDERR
"================== Complete ======================\n";
78 print STDERR
"$tests tests completed, $pass passed, $fail failed\n";
79 print STDERR
"==================================================\n";