AsteriskRuby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +174 -0
- data/examples/AGIMenu/config/menu.yaml +78 -0
- data/examples/AGIMenu/example1-filename.rb +64 -0
- data/examples/AGIMenu/example2-file.rb +65 -0
- data/examples/AGIMenu/example3-yaml.rb +65 -0
- data/examples/AGIMenu/example4-hash.rb +74 -0
- data/examples/AGIMenu/example5-empty.rb +65 -0
- data/examples/AGISelection/example1.rb +68 -0
- data/examples/AGIServer/config/example-config.yaml +64 -0
- data/examples/AGIServer/example1-routing.rb +105 -0
- data/examples/AGIServer/example2-agiblock.rb +91 -0
- data/examples/AGIServer/example3-agiparamsblock.rb +92 -0
- data/examples/AGIState/example1.rb +65 -0
- data/lib/AGI.rb +1072 -0
- data/lib/AGIExceptions.rb +139 -0
- data/lib/AGIFramework.rb +69 -0
- data/lib/AGIMenu.rb +244 -0
- data/lib/AGIResponse.rb +160 -0
- data/lib/AGIRoute.rb +72 -0
- data/lib/AGIRouter.rb +153 -0
- data/lib/AGISelection.rb +155 -0
- data/lib/AGIServer.rb +295 -0
- data/lib/AGIState.rb +91 -0
- data/lib/AsteriskRuby.rb +65 -0
- data/tests/AGI/tests.rb +519 -0
- data/tests/AGIMenu/config/menu.yaml +79 -0
- data/tests/AGIMenu/tests.rb +179 -0
- data/tests/AGISelection/tests.rb +104 -0
- data/tests/AGIServer/tests.rb +224 -0
- data/tests/AGIState/tests.rb +80 -0
- metadata +100 -0
data/README
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
Author: Michael Komitee <mkomitee@vonage.com>
|
2
|
+
|
3
|
+
License: BSD License
|
4
|
+
|
5
|
+
Copyright (c) 2007, Vonage Holdings
|
6
|
+
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
10
|
+
modification, are permitted provided that the following conditions are met:
|
11
|
+
|
12
|
+
* Redistributions of source code must retain the above copyright
|
13
|
+
notice, this list of conditions and the following disclaimer.
|
14
|
+
* Redistributions in binary form must reproduce the above copyright
|
15
|
+
notice, this list of conditions and the following disclaimer in the
|
16
|
+
documentation and/or other materials provided with the distribution.
|
17
|
+
* Neither the name of Vonage Holdings nor the names of its
|
18
|
+
contributors may be used to endorse or promote products derived from this
|
19
|
+
software without specific prior written permission.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
24
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
25
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
26
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31
|
+
POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
|
33
|
+
= Asterisk Ruby Framework -- AGI for Ruby
|
34
|
+
|
35
|
+
AGI, AGIMenu, AGISelection, and AGIServer work together with their supporting libraries to complete an Asterisk AGI Framework for applications.
|
36
|
+
* AGI: handles interaction between ruby and Asterisk. Asterisk connects to the AGI via either pipes or sockets
|
37
|
+
* AGIMenu: implements more complex logic dealing with menus and prompts
|
38
|
+
* AGISelection: implements more complex logic dealing with audio playback and digit strings
|
39
|
+
* AGIServer: implements a TCPServer via a block or rails routes, which instantiates AGI objects for Asterisk interaction
|
40
|
+
|
41
|
+
== Download
|
42
|
+
|
43
|
+
The latest version of asterisk-ruby can be found at
|
44
|
+
|
45
|
+
* http://rubyforge.org/project/
|
46
|
+
|
47
|
+
== Installation
|
48
|
+
|
49
|
+
=== Normal Installation
|
50
|
+
|
51
|
+
Setup based installation is currently unsupported
|
52
|
+
|
53
|
+
=== GEM Installation
|
54
|
+
|
55
|
+
Download and install asterisk-ruby with the following.
|
56
|
+
|
57
|
+
% gem install asterisk-ruby
|
58
|
+
|
59
|
+
== Usage, ...
|
60
|
+
|
61
|
+
=== AGI
|
62
|
+
|
63
|
+
The AGI object can be used to interact with an Asterisk. It can be used within the AGIServer framework, or independantly. Simply instantiate an AGI object and pass it input and output IO objects. Asterisk extensions can exec an agi script (in asterisk parlance, agi or deadagi), in which case you'll want to use stdin and stdout, or asterisk extensions can connect to a daemonized agi server (in asterisk parlance, fagi) and you'd want to use a tcp socket.
|
64
|
+
|
65
|
+
agi = AGI.new(:input => STDIN, :output => STDOUT)
|
66
|
+
agi.init
|
67
|
+
agi.answer
|
68
|
+
agi.hangup
|
69
|
+
|
70
|
+
Note, all agi instances will be uninitialized. The initialization process of an agi channel must be performed before any other interaction with the channel can be accomplished.
|
71
|
+
|
72
|
+
=== AGIMenu
|
73
|
+
|
74
|
+
Sometimes when dealing with Asterisk AGI, a generic AGIMenu object can come in handy. Thats where the aptly named AGIMenu object comes into play. With AGIMenu, you can configure a menu of options based on a yaml configuration or a hash. For example:
|
75
|
+
|
76
|
+
AGIMenu.sounds_dir = 'agimenu-test/sounds/'
|
77
|
+
hash = {:introduction=>["welcome", "instructions"],
|
78
|
+
:conclusion=>"what-is-your-choice",
|
79
|
+
:timeout=>17,
|
80
|
+
:choices=>
|
81
|
+
[{:dtmf=>"*", :audio=>["to-go-back", "press", "digits/star"]},
|
82
|
+
{:dtmf=>1, :audio=>["press", "digits/1", "for-option-1"]},
|
83
|
+
{:dtmf=>2, :audio=>["press", "digits/2", "for-option-2"]},
|
84
|
+
{:dtmf=>"#", :audio=>["or", "press", "digits/pound", "to-repeat"]}]}
|
85
|
+
|
86
|
+
menu = AGIMenu.new(hash)
|
87
|
+
menu.play(:agi => AGI.new())
|
88
|
+
|
89
|
+
This results in Asterisk using sounds in it's agimenu-test/sounds directory to play a menu which accepts the DTMF *, 1, 2, or #. It will first play the introduction sound files 'welcome' and 'instructions', then play the menu sound files 'to-go-back' 'press' 'digits/star' 'press' 'digits/1' 'for-option-1' 'press 'digits/2' 'for-option-2' 'or' 'press' 'digits/pound' 'to-repeat', and then play the conslusion sound file 'what-is-your-choice' and then wait 17 seconds.
|
90
|
+
|
91
|
+
You could hand AGIMenu.new() a filename, a file, a yaml oject, a hash, or nothing at all. You can then modify the menu with the classes various methods.
|
92
|
+
|
93
|
+
=== AGISelection
|
94
|
+
|
95
|
+
AGISelection can be used to get a string of digits from an asterisk channel. You configure it similarly to an AGIMenu, but it takes a max_digits paramater and only accepts a single audio file. AGIMenu only accepts a single dtmf digit, whereas AGISelection can accept multiple digits. It would be used to have a user input a PIN or a telephone number or something similar.
|
96
|
+
|
97
|
+
agi = AGI.new()
|
98
|
+
yaml_hash = {:audio => 'tt-monkeys', :max_digits => 4}
|
99
|
+
foo = AGISelection.new(yaml_hash)
|
100
|
+
foo.read(:agi => AGI.new())
|
101
|
+
|
102
|
+
=== AGIServer
|
103
|
+
|
104
|
+
There are several ways to use the AGIServer module. All of them have a few things in common. In general, since we're creating a server, we need a way to cleanly kill it. So we setup sigint anf sigterm handlers to shutdown all instances of AGIServer Objects
|
105
|
+
|
106
|
+
trap('INT') { AGIServer.shutdown }
|
107
|
+
trap('TERM') { AGIServer.shutdown }
|
108
|
+
|
109
|
+
We also tend to use a logger because this should be daemonized. While developing, I reccomend you log to STDERR
|
110
|
+
|
111
|
+
logger = Logger.new(STDERR)
|
112
|
+
logger.level = Logger::DEBUG
|
113
|
+
|
114
|
+
I use YAML for configuration options. This just sets up the bind port, address, and some threading configuration options.
|
115
|
+
|
116
|
+
config = YAML.load_file('config/example-config.yaml')
|
117
|
+
config[:logger] = logger
|
118
|
+
config[:params] = {:custom1 => 'data1'}
|
119
|
+
|
120
|
+
And then we generate our server
|
121
|
+
|
122
|
+
begin
|
123
|
+
MyAgiServer = AGIServer.new(config)
|
124
|
+
rescue Errno::EADDRINUSE
|
125
|
+
error = "Cannot start MyAgiServer, Address already in use."
|
126
|
+
logger.fatal(error)
|
127
|
+
print "#{error}\n"
|
128
|
+
exit
|
129
|
+
else
|
130
|
+
print "#{$$}"
|
131
|
+
end
|
132
|
+
|
133
|
+
In this example, I'll show you the rails-routing means of working with the AGIServer. Define a Route class along with a few routes, and start the server.
|
134
|
+
|
135
|
+
class TestRoutes < AGIRoute
|
136
|
+
def sample
|
137
|
+
agi.answer
|
138
|
+
print "CUSTOM1 = [#{params[:custom1]}]\n"
|
139
|
+
print "URI = [#{request[:uri]}]\n"
|
140
|
+
print "ID = [#{request[:id]}]\n"
|
141
|
+
print "METHOD = [#{request[:method]}]\n"
|
142
|
+
print "OPTIONS = #{request[:options].pretty_inspect}"
|
143
|
+
print "FOO = [#{request[:options]['foo']}]\n"
|
144
|
+
print '-' * 10 + "\n"
|
145
|
+
helper_method
|
146
|
+
agi.hangup
|
147
|
+
end
|
148
|
+
private
|
149
|
+
def helper_method
|
150
|
+
print "I'm private which means I'm not accessible as a route!\n"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
MyAgiServer.start
|
154
|
+
MyAgiServer.finish
|
155
|
+
|
156
|
+
Pointing an asterisk extension at agi://localhost:4573/TestRoutes/sample/1/?foo=bar will execute the sample method in the TestRoutes class.
|
157
|
+
|
158
|
+
In this example, I'll show you how to use a block to define the AGI logic. Simply start the server and pass it a block expecting an agi object:
|
159
|
+
|
160
|
+
MyAgiServer.start do |agi|
|
161
|
+
agi.answer
|
162
|
+
puts "I'm Alive!"
|
163
|
+
agi.hangup
|
164
|
+
end
|
165
|
+
MyAgiServer.finish
|
166
|
+
|
167
|
+
In this example, I'll show you another way to use a block to define the AGI logic. This block makes configuration parameters available during the call:
|
168
|
+
|
169
|
+
MyAgiServer.start do |agi,params|
|
170
|
+
agi.answer
|
171
|
+
print "PARAMS = #{params.pretty_inspect}"
|
172
|
+
agi.hangup
|
173
|
+
end
|
174
|
+
MyAgiServer.finish
|
@@ -0,0 +1,78 @@
|
|
1
|
+
## Copyright (c) 2007, Vonage Holdings
|
2
|
+
##
|
3
|
+
## All rights reserved.
|
4
|
+
##
|
5
|
+
## Redistribution and use in source and binary forms, with or without
|
6
|
+
## modification, are permitted provided that the following conditions are met:
|
7
|
+
##
|
8
|
+
## * Redistributions of source code must retain the above copyright
|
9
|
+
## notice, this list of conditions and the following disclaimer.
|
10
|
+
## * Redistributions in binary form must reproduce the above copyright
|
11
|
+
## notice, this list of conditions and the following disclaimer in the
|
12
|
+
## documentation and/or other materials provided with the distribution.
|
13
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
14
|
+
## contributors may be used to endorse or promote products derived from this
|
15
|
+
## software without specific prior written permission.
|
16
|
+
##
|
17
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
20
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
21
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
##
|
29
|
+
## Author: Michael Komitee
|
30
|
+
---
|
31
|
+
:title: "Test Menu"
|
32
|
+
:introduction:
|
33
|
+
- welcome
|
34
|
+
- instructions
|
35
|
+
:choices:
|
36
|
+
- :dtmf: *
|
37
|
+
:audio: press-star-to-go-back
|
38
|
+
- :dtmf: 1
|
39
|
+
:audio:
|
40
|
+
- press
|
41
|
+
- digits/1
|
42
|
+
- for-option-1
|
43
|
+
- :dtmf: 2
|
44
|
+
:audio:
|
45
|
+
- press
|
46
|
+
- digits/2
|
47
|
+
- for-option-2
|
48
|
+
- :dtmf: '#'
|
49
|
+
:audio: or-press-pound-to-repeat
|
50
|
+
:conclusion: what-is-your-choice
|
51
|
+
:timeout: 5
|
52
|
+
## Copyright (c) 2007, Vonage Holdings
|
53
|
+
##
|
54
|
+
## All rights reserved.
|
55
|
+
##
|
56
|
+
## Redistribution and use in source and binary forms, with or without
|
57
|
+
## modification, are permitted provided that the following conditions are met:
|
58
|
+
##
|
59
|
+
## * Redistributions of source code must retain the above copyright
|
60
|
+
## notice, this list of conditions and the following disclaimer.
|
61
|
+
## * Redistributions in binary form must reproduce the above copyright
|
62
|
+
## notice, this list of conditions and the following disclaimer in the
|
63
|
+
## documentation and/or other materials provided with the distribution.
|
64
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
65
|
+
## contributors may be used to endorse or promote products derived from this
|
66
|
+
## software without specific prior written permission.
|
67
|
+
##
|
68
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
69
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
70
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
71
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
72
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
73
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
74
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
75
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
76
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
77
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
78
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/local/bin/ruby -wKU -I ../../lib
|
2
|
+
## Copyright (c) 2007, Vonage Holdings
|
3
|
+
##
|
4
|
+
## All rights reserved.
|
5
|
+
##
|
6
|
+
## Redistribution and use in source and binary forms, with or without
|
7
|
+
## modification, are permitted provided that the following conditions are met:
|
8
|
+
##
|
9
|
+
## * Redistributions of source code must retain the above copyright
|
10
|
+
## notice, this list of conditions and the following disclaimer.
|
11
|
+
## * Redistributions in binary form must reproduce the above copyright
|
12
|
+
## notice, this list of conditions and the following disclaimer in the
|
13
|
+
## documentation and/or other materials provided with the distribution.
|
14
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
15
|
+
## contributors may be used to endorse or promote products derived from this
|
16
|
+
## software without specific prior written permission.
|
17
|
+
##
|
18
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
22
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
##
|
30
|
+
## Author: Michael Komitee <mkomitee@gmail.com>
|
31
|
+
|
32
|
+
require 'AGIMenu'
|
33
|
+
require 'pp'
|
34
|
+
|
35
|
+
AGIMenu.sounds_dir = 'agimenu-test/sounds/'
|
36
|
+
menu = AGIMenu.new('config/menu.yaml')
|
37
|
+
menu.play(:agi => AGI.new())
|
38
|
+
## Copyright (c) 2007, Vonage Holdings
|
39
|
+
##
|
40
|
+
## All rights reserved.
|
41
|
+
##
|
42
|
+
## Redistribution and use in source and binary forms, with or without
|
43
|
+
## modification, are permitted provided that the following conditions are met:
|
44
|
+
##
|
45
|
+
## * Redistributions of source code must retain the above copyright
|
46
|
+
## notice, this list of conditions and the following disclaimer.
|
47
|
+
## * Redistributions in binary form must reproduce the above copyright
|
48
|
+
## notice, this list of conditions and the following disclaimer in the
|
49
|
+
## documentation and/or other materials provided with the distribution.
|
50
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
51
|
+
## contributors may be used to endorse or promote products derived from this
|
52
|
+
## software without specific prior written permission.
|
53
|
+
##
|
54
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
55
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
56
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
57
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
58
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
59
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
60
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
61
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
62
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
63
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
64
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/local/bin/ruby -wKU -I ../../lib
|
2
|
+
## Copyright (c) 2007, Vonage Holdings
|
3
|
+
##
|
4
|
+
## All rights reserved.
|
5
|
+
##
|
6
|
+
## Redistribution and use in source and binary forms, with or without
|
7
|
+
## modification, are permitted provided that the following conditions are met:
|
8
|
+
##
|
9
|
+
## * Redistributions of source code must retain the above copyright
|
10
|
+
## notice, this list of conditions and the following disclaimer.
|
11
|
+
## * Redistributions in binary form must reproduce the above copyright
|
12
|
+
## notice, this list of conditions and the following disclaimer in the
|
13
|
+
## documentation and/or other materials provided with the distribution.
|
14
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
15
|
+
## contributors may be used to endorse or promote products derived from this
|
16
|
+
## software without specific prior written permission.
|
17
|
+
##
|
18
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
22
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
##
|
30
|
+
## Author: Michael Komitee <mkomitee@gmail.com>
|
31
|
+
|
32
|
+
require 'AGIMenu'
|
33
|
+
require 'pp'
|
34
|
+
|
35
|
+
AGIMenu.sounds_dir = 'agimenu-test/sounds/'
|
36
|
+
pp menu = AGIMenu.new(File.open('config/menu.yaml'))
|
37
|
+
pp menu.play(:agi => AGI.new())
|
38
|
+
|
39
|
+
## Copyright (c) 2007, Vonage Holdings
|
40
|
+
##
|
41
|
+
## All rights reserved.
|
42
|
+
##
|
43
|
+
## Redistribution and use in source and binary forms, with or without
|
44
|
+
## modification, are permitted provided that the following conditions are met:
|
45
|
+
##
|
46
|
+
## * Redistributions of source code must retain the above copyright
|
47
|
+
## notice, this list of conditions and the following disclaimer.
|
48
|
+
## * Redistributions in binary form must reproduce the above copyright
|
49
|
+
## notice, this list of conditions and the following disclaimer in the
|
50
|
+
## documentation and/or other materials provided with the distribution.
|
51
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
52
|
+
## contributors may be used to endorse or promote products derived from this
|
53
|
+
## software without specific prior written permission.
|
54
|
+
##
|
55
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
56
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
57
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
58
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
59
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
60
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
61
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
62
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
63
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
64
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
65
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/local/bin/ruby -wKU -I ../../lib
|
2
|
+
## Copyright (c) 2007, Vonage Holdings
|
3
|
+
##
|
4
|
+
## All rights reserved.
|
5
|
+
##
|
6
|
+
## Redistribution and use in source and binary forms, with or without
|
7
|
+
## modification, are permitted provided that the following conditions are met:
|
8
|
+
##
|
9
|
+
## * Redistributions of source code must retain the above copyright
|
10
|
+
## notice, this list of conditions and the following disclaimer.
|
11
|
+
## * Redistributions in binary form must reproduce the above copyright
|
12
|
+
## notice, this list of conditions and the following disclaimer in the
|
13
|
+
## documentation and/or other materials provided with the distribution.
|
14
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
15
|
+
## contributors may be used to endorse or promote products derived from this
|
16
|
+
## software without specific prior written permission.
|
17
|
+
##
|
18
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
22
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
+
## POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
##
|
30
|
+
## Author: Michael Komitee <mkomitee@gmail.com>
|
31
|
+
|
32
|
+
require 'AGIMenu'
|
33
|
+
require 'pp'
|
34
|
+
|
35
|
+
AGIMenu.sounds_dir = 'agimenu-test/sounds/'
|
36
|
+
pp menu = AGIMenu.new(File.open( 'config/menu.yaml' ) { |f| YAML::load( f ) })
|
37
|
+
pp menu.play(:agi => AGI.new())
|
38
|
+
|
39
|
+
## Copyright (c) 2007, Vonage Holdings
|
40
|
+
##
|
41
|
+
## All rights reserved.
|
42
|
+
##
|
43
|
+
## Redistribution and use in source and binary forms, with or without
|
44
|
+
## modification, are permitted provided that the following conditions are met:
|
45
|
+
##
|
46
|
+
## * Redistributions of source code must retain the above copyright
|
47
|
+
## notice, this list of conditions and the following disclaimer.
|
48
|
+
## * Redistributions in binary form must reproduce the above copyright
|
49
|
+
## notice, this list of conditions and the following disclaimer in the
|
50
|
+
## documentation and/or other materials provided with the distribution.
|
51
|
+
## * Neither the name of Vonage Holdings nor the names of its
|
52
|
+
## contributors may be used to endorse or promote products derived from this
|
53
|
+
## software without specific prior written permission.
|
54
|
+
##
|
55
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
56
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
57
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
58
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
59
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
60
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
61
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
62
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
63
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
64
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
65
|
+
## POSSIBILITY OF SUCH DAMAGE.
|