AsteriskRuby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
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
+ hash = {:introduction=>["welcome", "instructions"],
37
+ :conclusion=>"what-is-your-choice",
38
+ :timeout=>17,
39
+ :choices=>
40
+ [{:dtmf=>"*", :audio=>["to-go-back", "press", "digits/star"]},
41
+ {:dtmf=>1, :audio=>["press", "digits/1", "for-option-1"]},
42
+ {:dtmf=>2, :audio=>["press", "digits/2", "for-option-2"]},
43
+ {:dtmf=>"#", :audio=>["or", "press", "digits/pound", "to repeat"]}]}
44
+
45
+ pp menu = AGIMenu.new(hash)
46
+ pp menu.play(:agi => AGI.new())
47
+
48
+ ## Copyright (c) 2007, Vonage Holdings
49
+ ##
50
+ ## All rights reserved.
51
+ ##
52
+ ## Redistribution and use in source and binary forms, with or without
53
+ ## modification, are permitted provided that the following conditions are met:
54
+ ##
55
+ ## * Redistributions of source code must retain the above copyright
56
+ ## notice, this list of conditions and the following disclaimer.
57
+ ## * Redistributions in binary form must reproduce the above copyright
58
+ ## notice, this list of conditions and the following disclaimer in the
59
+ ## documentation and/or other materials provided with the distribution.
60
+ ## * Neither the name of Vonage Holdings nor the names of its
61
+ ## contributors may be used to endorse or promote products derived from this
62
+ ## software without specific prior written permission.
63
+ ##
64
+ ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
65
+ ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
66
+ ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
67
+ ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
68
+ ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
69
+ ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
70
+ ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
71
+ ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
72
+ ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
73
+ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
74
+ ## 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()
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,68 @@
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 'rubygems'
33
+ require 'AGI'
34
+ require 'AGISelection'
35
+ require 'pp'
36
+
37
+ agi = AGI.new()
38
+ yaml_hash = {:audio => 'tt-monkeys', :max_digits => 4}
39
+ foo = AGISelection.new(yaml_hash)
40
+ foo.read(:agi => AGI.new())
41
+
42
+ ## Copyright (c) 2007, Vonage Holdings
43
+ ##
44
+ ## All rights reserved.
45
+ ##
46
+ ## Redistribution and use in source and binary forms, with or without
47
+ ## modification, are permitted provided that the following conditions are met:
48
+ ##
49
+ ## * Redistributions of source code must retain the above copyright
50
+ ## notice, this list of conditions and the following disclaimer.
51
+ ## * Redistributions in binary form must reproduce the above copyright
52
+ ## notice, this list of conditions and the following disclaimer in the
53
+ ## documentation and/or other materials provided with the distribution.
54
+ ## * Neither the name of Vonage Holdings nor the names of its
55
+ ## contributors may be used to endorse or promote products derived from this
56
+ ## software without specific prior written permission.
57
+ ##
58
+ ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
59
+ ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60
+ ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61
+ ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
62
+ ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
63
+ ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
64
+ ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
65
+ ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
66
+ ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
67
+ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
68
+ ## POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,64 @@
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
+ :bind_port: 4573
32
+ :min_workers: 5
33
+ :max_workers: 10
34
+ :jobs_per_worker: 2
35
+ :stats: true
36
+ :bind_host: 127.0.0.1
37
+
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,105 @@
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 'AGIServer'
33
+ require 'yaml'
34
+
35
+ trap('INT') { AGIServer.shutdown }
36
+ trap('TERM') { AGIServer.shutdown }
37
+
38
+ logger = Logger.new(STDERR)
39
+ logger.level = Logger::DEBUG
40
+
41
+ config = YAML.load_file('config/example-config.yaml')
42
+ config[:logger] = logger
43
+ config[:params] = {:custom1 => 'data1'}
44
+ begin
45
+ MyAgiServer = AGIServer.new(config)
46
+ rescue Errno::EADDRINUSE
47
+ error = "Cannot start MyAgiServer, Address already in use."
48
+ logger.fatal(error)
49
+ print "#{error}\n"
50
+ exit
51
+ else
52
+ print "#{$$}"
53
+ end
54
+
55
+
56
+ class TestRoutes < AGIRoute
57
+ # To test this, map asterisk to http://localhost:4573/TestRoutes/sample/1/?foo=bar
58
+ def sample
59
+ agi.answer
60
+ print "CUSTOM1 = [#{params[:custom1]}]\n"
61
+ print "URI = [#{request[:uri]}]\n"
62
+ print "ID = [#{request[:id]}]\n"
63
+ print "METHOD = [#{request[:method]}]\n"
64
+ print "OPTIONS = #{request[:options].pretty_inspect}"
65
+ print "FOO = [#{request[:options]['foo']}]\n"
66
+ print '-' * 10 + "\n"
67
+ helper_method
68
+ agi.hangup
69
+ end
70
+ private
71
+ def helper_method
72
+ print "I'm private which means I'm not accessible as a route!\n"
73
+ end
74
+ end
75
+
76
+ MyAgiServer.start
77
+ MyAgiServer.finish
78
+
79
+ ## Copyright (c) 2007, Vonage Holdings
80
+ ##
81
+ ## All rights reserved.
82
+ ##
83
+ ## Redistribution and use in source and binary forms, with or without
84
+ ## modification, are permitted provided that the following conditions are met:
85
+ ##
86
+ ## * Redistributions of source code must retain the above copyright
87
+ ## notice, this list of conditions and the following disclaimer.
88
+ ## * Redistributions in binary form must reproduce the above copyright
89
+ ## notice, this list of conditions and the following disclaimer in the
90
+ ## documentation and/or other materials provided with the distribution.
91
+ ## * Neither the name of Vonage Holdings nor the names of its
92
+ ## contributors may be used to endorse or promote products derived from this
93
+ ## software without specific prior written permission.
94
+ ##
95
+ ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
96
+ ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97
+ ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
98
+ ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
99
+ ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
100
+ ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
101
+ ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
102
+ ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
103
+ ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
104
+ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
105
+ ## POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,91 @@
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 'AGIServer'
33
+ require 'yaml'
34
+
35
+ trap('INT') { AGIServer.shutdown }
36
+ trap('TERM') { AGIServer.shutdown }
37
+
38
+ logger = Logger.new(STDERR)
39
+ logger.level = Logger::DEBUG
40
+
41
+ config = YAML.load_file('config/example-config.yaml')
42
+ config[:logger] = logger
43
+
44
+ begin
45
+ MyAgiServer = AGIServer.new(config)
46
+ rescue Errno::EADDRINUSE
47
+ error = "Cannot start MyAgiServer, Address already in use."
48
+ logger.fatal(error)
49
+ puts error
50
+ exit
51
+ else
52
+ puts "#{$$}"
53
+ end
54
+
55
+ trap('INT') { AGIServer.shutdown }
56
+ trap('TERM') { AGIServer.shutdown }
57
+
58
+ MyAgiServer.start do |agi|
59
+ agi.answer
60
+ puts "I'm Alive!"
61
+ agi.hangup
62
+ end
63
+ MyAgiServer.finish
64
+
65
+ ## Copyright (c) 2007, Vonage Holdings
66
+ ##
67
+ ## All rights reserved.
68
+ ##
69
+ ## Redistribution and use in source and binary forms, with or without
70
+ ## modification, are permitted provided that the following conditions are met:
71
+ ##
72
+ ## * Redistributions of source code must retain the above copyright
73
+ ## notice, this list of conditions and the following disclaimer.
74
+ ## * Redistributions in binary form must reproduce the above copyright
75
+ ## notice, this list of conditions and the following disclaimer in the
76
+ ## documentation and/or other materials provided with the distribution.
77
+ ## * Neither the name of Vonage Holdings nor the names of its
78
+ ## contributors may be used to endorse or promote products derived from this
79
+ ## software without specific prior written permission.
80
+ ##
81
+ ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
82
+ ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
83
+ ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
84
+ ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
85
+ ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
86
+ ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
87
+ ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
88
+ ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
89
+ ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
90
+ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
91
+ ## POSSIBILITY OF SUCH DAMAGE.