| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package VoiceXML::Client::Device::Dummy; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
14
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
99
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
16
|
use base qw(VoiceXML::Client::DeviceHandle); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
2333
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 VoiceXML::Client::Device::Dummy |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
VoiceXML::Client::Device::Dummy -- a minimally functional implementation the DeviceHandle interface |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
VoiceXML::Client::DeviceHandle module, device handle api based on the VOCP voice messaging system package |
|
22
|
|
|
|
|
|
|
VOCP::Device. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Copyright (C) 2002,2008 Patrick Deegan |
|
25
|
|
|
|
|
|
|
All rights reserved |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This file is part of VoiceXML::Client. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
VoiceXML::Client is free software: you can redistribute it and/or modify |
|
31
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
32
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
33
|
|
|
|
|
|
|
(at your option) any later version. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
VoiceXML::Client is distributed in the hope that it will be useful, |
|
36
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
37
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
38
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
41
|
|
|
|
|
|
|
along with VoiceXML::Client. If not, see . |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub connect { |
|
51
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
52
|
0
|
|
|
|
|
0
|
my $params = shift; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
0
|
print "VoiceXML::Client::Device::Dummy::connect() called\n" |
|
55
|
|
|
|
|
|
|
if ($VoiceXML::Client::Debug); |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
0
|
return 1; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub disconnect { |
|
62
|
3
|
|
|
3
|
0
|
6
|
my $self = shift; |
|
63
|
3
|
|
|
|
|
21
|
my $params = shift; |
|
64
|
|
|
|
|
|
|
|
|
65
|
3
|
50
|
|
|
|
12
|
print "VoiceXML::Client::Device::Dummy::disconnect()\n" |
|
66
|
|
|
|
|
|
|
if ($VoiceXML::Client::Debug); |
|
67
|
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
15
|
return 1; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 beep FREQUENCY LENGTH |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Sends a beep through the chosen device using given frequency (HZ) and length (in miliseconds). Returns a defined |
|
76
|
|
|
|
|
|
|
and true value on success. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub beep { |
|
81
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
82
|
0
|
|
|
|
|
|
my $frequency = shift; |
|
83
|
0
|
|
|
|
|
|
my $length = shift; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
print "VoiceXML::Client::Device::Dummy::beep($frequency, $length)\n"; |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return 1; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 dial DESTINATION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Connects to destination. Returns defined & true on success. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub dial { |
|
99
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
100
|
0
|
|
|
|
|
|
my $destination = shift; |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
print "dialing ($destination)\n"; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return 1; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 play PLAYPARAM |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
plays a sound (file, text-to-speech, whatever is appropriate) base on PLAYPARAM. May or may not block during |
|
111
|
|
|
|
|
|
|
play depending on device implementation. Returns true on success. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub play { |
|
116
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
117
|
0
|
|
|
|
|
|
my $playthis = shift; |
|
118
|
0
|
|
|
|
|
|
my $type = shift; |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
print "Playing ($playthis)\n"; |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
return 1; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 record TOFILE |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Records input from user to device to file TOFILE. Returns true on success. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub record { |
|
134
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
135
|
0
|
|
|
|
|
|
my $tofile = shift; |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
print "Recording ($tofile) \n"; |
|
139
|
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return 1; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 wait TIME |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Simply waits for TIME seconds. Device should accept/queue user input |
|
147
|
|
|
|
|
|
|
during interval. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub wait { |
|
152
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
153
|
0
|
|
|
|
|
|
my $time = shift; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
print "Waiting ($time)\n"; |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
return 1; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 waitFor STATE |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Waits until STATE is reached/returned by device. Device should accept/queue user input |
|
165
|
|
|
|
|
|
|
during interval. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub waitFor { |
|
170
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
171
|
0
|
|
|
|
|
|
my $state = shift; |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
print "WaitFor($state)\n"; |
|
174
|
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
return 1; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 stop |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Immediately stop any current activity (wait, play, record, etc.). |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
|
183
|
|
|
|
|
|
|
sub stop { |
|
184
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
print "Stop()\n"; |
|
188
|
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
return 1; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 blocking_play PLAYTHIS |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
play PLAYTHIS and return only when done. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub blockingPlay { |
|
199
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
200
|
0
|
|
|
|
|
|
my $playthis = shift; |
|
201
|
0
|
|
|
|
|
|
my $type = shift; |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
print "Playing ($playthis)... blocked\n"; |
|
205
|
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
return 1; |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 readnum PLAYTHIS TIMEOUT [REPEATTIMES] |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Plays the PLAYTHIS and then waits for the sequence of the digit input finished. If none are entered within TIMEOUT |
|
215
|
|
|
|
|
|
|
seconds, it re-plays the message again. It returns failure (undefined value) if no digits are entered after the message |
|
216
|
|
|
|
|
|
|
has been played REPEATTIMES (defaults to 3) times. |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
It returns a string (a sequence of DTMF tones 0-9,A-D and `*') without the final stop key (normally '#'). |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=cut |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub readnum { |
|
226
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
227
|
0
|
|
|
|
|
|
my $playthis = shift; |
|
228
|
0
|
|
|
|
|
|
my $timeout = shift; |
|
229
|
0
|
|
0
|
|
|
|
my $repeatTimes = shift || 3; |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
|
print STDOUT "\nEnter DTMF Selection ([0-9]+):"; |
|
233
|
0
|
|
|
|
|
|
my $num = ; |
|
234
|
0
|
|
|
|
|
|
chomp($num); |
|
235
|
0
|
|
|
|
|
|
$num =~ s/[^\d\*]+//g; |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
|
return $num; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 validDataFormats |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Returns an array ref of valid data formats (eg 'rmd', 'wav', 'au') the device will accept. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub validDataFormats { |
|
250
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
251
|
|
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
|
print "ValidDataFormats() queried\n"; |
|
253
|
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
return ['rmd', 'wav', 'mp3']; |
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub receiveImage { |
|
260
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
261
|
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
print "ReceiveImage()\n"; |
|
263
|
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
return 1; |
|
265
|
|
|
|
|
|
|
} |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
# Not sure what to do with this method... how do you support faxes while abstracting the modem voice device?? |
|
269
|
|
|
|
|
|
|
sub sendImage { |
|
270
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
271
|
0
|
|
|
|
|
|
my $file = shift; |
|
272
|
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
print "SendImage()\n"; |
|
274
|
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
return 1; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
1; |