| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package VoiceXML::Client::Item::Audio; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
15
|
use base qw (VoiceXML::Client::Item); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
212
|
|
|
6
|
3
|
|
|
3
|
|
20
|
use VoiceXML::Client::Util; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
59
|
|
|
7
|
3
|
|
|
3
|
|
16
|
use VoiceXML::Client::Item::Util; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
89
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Copyright (C) 2007,2008 by Pat Deegan. |
|
13
|
|
|
|
|
|
|
All rights reserved |
|
14
|
|
|
|
|
|
|
http://voicexml.psychogenic.com |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This library is released under the terms of the GNU GPL version 3, making it available only for |
|
17
|
|
|
|
|
|
|
free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). |
|
18
|
|
|
|
|
|
|
Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to |
|
19
|
|
|
|
|
|
|
acquire a distinct license for their application. This approach encourages the use of free software |
|
20
|
|
|
|
|
|
|
while allowing for proprietary solutions that support further development. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This file is part of VoiceXML::Client. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
VoiceXML::Client is free software: you can redistribute it and/or modify |
|
28
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
29
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
30
|
|
|
|
|
|
|
(at your option) any later version. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
VoiceXML::Client is distributed in the hope that it will be useful, |
|
33
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
34
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
35
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
38
|
|
|
|
|
|
|
along with VoiceXML::Client. If not, see . |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
3
|
|
|
3
|
|
15
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
96
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
1129
|
use vars qw{ |
|
49
|
|
|
|
|
|
|
$VERSION |
|
50
|
3
|
|
|
3
|
|
15
|
}; |
|
|
3
|
|
|
|
|
6
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$VERSION = $VoiceXML::Client::Item::VERSION; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub init { |
|
58
|
7
|
|
|
7
|
1
|
10
|
my $self = shift; |
|
59
|
|
|
|
|
|
|
|
|
60
|
7
|
|
|
|
|
26
|
$self->{'src'} = $self->{'XMLElement'}->attribute('src'); |
|
61
|
7
|
|
|
|
|
115
|
$self->{'expr'} = $self->{'XMLElement'}->attribute('expr'); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
7
|
|
|
|
|
89
|
return 1; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub execute { |
|
69
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
|
70
|
3
|
|
|
|
|
5
|
my $handle = shift; |
|
71
|
3
|
|
|
|
|
4
|
my $optParams = shift; |
|
72
|
|
|
|
|
|
|
|
|
73
|
3
|
|
|
|
|
5
|
my $fileToPlay; |
|
74
|
3
|
50
|
|
|
|
9
|
if ($self->{'src'}) |
|
|
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
{ |
|
76
|
3
|
|
|
|
|
8
|
$fileToPlay = $self->{'src'}; |
|
77
|
|
|
|
|
|
|
} elsif ($self->{'expr'}) |
|
78
|
|
|
|
|
|
|
{ |
|
79
|
0
|
|
|
|
|
0
|
$fileToPlay = VoiceXML::Client::Item::Util->evaluateExpression($self, $self->{'expr'}); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} else { |
|
82
|
0
|
|
|
|
|
0
|
warn "Audio::execute() called but no src or expr set"; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
3
|
50
|
|
|
|
8
|
VoiceXML::Client::Util::log_msg("Audio element playing $fileToPlay") if ($VoiceXML::Client::Debug); |
|
86
|
|
|
|
|
|
|
|
|
87
|
3
|
|
|
|
|
6
|
my $errorFileToPlay; |
|
88
|
3
|
50
|
|
|
|
16
|
if ($fileToPlay) |
|
89
|
|
|
|
|
|
|
{ |
|
90
|
3
|
50
|
33
|
|
|
52
|
if (-e $fileToPlay && -r $fileToPlay) |
|
91
|
|
|
|
|
|
|
{ |
|
92
|
0
|
|
|
|
|
0
|
$handle->play($fileToPlay); |
|
93
|
|
|
|
|
|
|
} else { |
|
94
|
3
|
|
|
|
|
19
|
VoiceXML::Client::Util::log_msg("Audio element could not find file '$fileToPlay'"); |
|
95
|
3
|
|
|
|
|
157
|
$errorFileToPlay = $self->getErrorMessageFile(); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} else { |
|
98
|
0
|
|
|
|
|
0
|
VoiceXML::Client::Util::log_msg("Audio element has no file to play set"); |
|
99
|
0
|
|
|
|
|
0
|
$errorFileToPlay = $self->getErrorMessageFile(); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
3
|
50
|
|
|
|
9
|
$handle->play($errorFileToPlay) if ($errorFileToPlay); |
|
103
|
|
|
|
|
|
|
|
|
104
|
3
|
|
|
|
|
53
|
return $self->executeChildren($handle, $optParams); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub getErrorMessageFile { |
|
108
|
3
|
|
|
3
|
0
|
5
|
my $self = shift; |
|
109
|
3
|
|
|
|
|
5
|
my $params = shift; |
|
110
|
|
|
|
|
|
|
|
|
111
|
3
|
0
|
33
|
|
|
17
|
return $params->{'errormsgfile'} |
|
|
|
|
33
|
|
|
|
|
|
112
|
|
|
|
|
|
|
if (exists $params->{'errormsgfile'} && $params->{'errormsgfile'} && -r $params->{'errormsgfile'}); |
|
113
|
|
|
|
|
|
|
|
|
114
|
3
|
50
|
|
|
|
8
|
VoiceXML::Client::Util::log_msg("Audio element can't locate error message file") if ($VoiceXML::Client::Debug); |
|
115
|
|
|
|
|
|
|
|
|
116
|
3
|
|
|
|
|
17
|
return undef; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |