mtrudel-adhearsion 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +26 -0
- data/EVENTS +11 -0
- data/LICENSE +456 -0
- data/Rakefile +127 -0
- data/adhearsion.gemspec +149 -0
- data/app_generators/ahn/USAGE +5 -0
- data/app_generators/ahn/ahn_generator.rb +91 -0
- data/app_generators/ahn/templates/.ahnrc +34 -0
- data/app_generators/ahn/templates/README +8 -0
- data/app_generators/ahn/templates/Rakefile +25 -0
- data/app_generators/ahn/templates/components/ami_remote/ami_remote.rb +15 -0
- data/app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE +7 -0
- data/app_generators/ahn/templates/components/disabled/restful_rpc/README.markdown +11 -0
- data/app_generators/ahn/templates/components/disabled/restful_rpc/example-client.rb +48 -0
- data/app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.rb +87 -0
- data/app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.yml +34 -0
- data/app_generators/ahn/templates/components/disabled/restful_rpc/spec/restful_rpc_spec.rb +263 -0
- data/app_generators/ahn/templates/components/disabled/sandbox/sandbox.rb +104 -0
- data/app_generators/ahn/templates/components/disabled/sandbox/sandbox.yml +2 -0
- data/app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown +47 -0
- data/app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb +34 -0
- data/app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.yml +12 -0
- data/app_generators/ahn/templates/components/simon_game/simon_game.rb +56 -0
- data/app_generators/ahn/templates/config/startup.rb +50 -0
- data/app_generators/ahn/templates/dialplan.rb +3 -0
- data/app_generators/ahn/templates/events.rb +32 -0
- data/bin/ahn +28 -0
- data/bin/ahnctl +68 -0
- data/bin/jahn +42 -0
- data/examples/asterisk_manager_interface/standalone.rb +51 -0
- data/lib/adhearsion.rb +37 -0
- data/lib/adhearsion/cli.rb +223 -0
- data/lib/adhearsion/component_manager.rb +207 -0
- data/lib/adhearsion/component_manager/component_tester.rb +55 -0
- data/lib/adhearsion/component_manager/spec_framework.rb +24 -0
- data/lib/adhearsion/events_support.rb +84 -0
- data/lib/adhearsion/foundation/all.rb +9 -0
- data/lib/adhearsion/foundation/blank_slate.rb +5 -0
- data/lib/adhearsion/foundation/custom_daemonizer.rb +45 -0
- data/lib/adhearsion/foundation/event_socket.rb +203 -0
- data/lib/adhearsion/foundation/future_resource.rb +36 -0
- data/lib/adhearsion/foundation/global.rb +1 -0
- data/lib/adhearsion/foundation/metaprogramming.rb +17 -0
- data/lib/adhearsion/foundation/numeric.rb +13 -0
- data/lib/adhearsion/foundation/pseudo_guid.rb +10 -0
- data/lib/adhearsion/foundation/relationship_properties.rb +42 -0
- data/lib/adhearsion/foundation/string.rb +26 -0
- data/lib/adhearsion/foundation/synchronized_hash.rb +96 -0
- data/lib/adhearsion/foundation/thread_safety.rb +7 -0
- data/lib/adhearsion/host_definitions.rb +67 -0
- data/lib/adhearsion/initializer.rb +373 -0
- data/lib/adhearsion/initializer/asterisk.rb +81 -0
- data/lib/adhearsion/initializer/configuration.rb +254 -0
- data/lib/adhearsion/initializer/database.rb +50 -0
- data/lib/adhearsion/initializer/drb.rb +31 -0
- data/lib/adhearsion/initializer/freeswitch.rb +22 -0
- data/lib/adhearsion/initializer/rails.rb +41 -0
- data/lib/adhearsion/logging.rb +92 -0
- data/lib/adhearsion/tasks.rb +16 -0
- data/lib/adhearsion/tasks/database.rb +5 -0
- data/lib/adhearsion/tasks/deprecations.rb +59 -0
- data/lib/adhearsion/tasks/generating.rb +20 -0
- data/lib/adhearsion/tasks/lint.rb +4 -0
- data/lib/adhearsion/tasks/testing.rb +37 -0
- data/lib/adhearsion/version.rb +9 -0
- data/lib/adhearsion/voip/asterisk.rb +4 -0
- data/lib/adhearsion/voip/asterisk/agi_server.rb +84 -0
- data/lib/adhearsion/voip/asterisk/commands.rb +1314 -0
- data/lib/adhearsion/voip/asterisk/config_generators/agents.conf.rb +140 -0
- data/lib/adhearsion/voip/asterisk/config_generators/config_generator.rb +101 -0
- data/lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb +250 -0
- data/lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb +240 -0
- data/lib/adhearsion/voip/asterisk/config_manager.rb +71 -0
- data/lib/adhearsion/voip/asterisk/manager_interface.rb +597 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb +1589 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb +286 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb +78 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl +87 -0
- data/lib/adhearsion/voip/asterisk/special_dial_plan_managers.rb +80 -0
- data/lib/adhearsion/voip/asterisk/super_manager.rb +19 -0
- data/lib/adhearsion/voip/call.rb +453 -0
- data/lib/adhearsion/voip/call_routing.rb +64 -0
- data/lib/adhearsion/voip/commands.rb +9 -0
- data/lib/adhearsion/voip/constants.rb +39 -0
- data/lib/adhearsion/voip/conveniences.rb +18 -0
- data/lib/adhearsion/voip/dial_plan.rb +218 -0
- data/lib/adhearsion/voip/dsl/dialing_dsl.rb +151 -0
- data/lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb +37 -0
- data/lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb +27 -0
- data/lib/adhearsion/voip/dsl/dialplan/dispatcher.rb +124 -0
- data/lib/adhearsion/voip/dsl/dialplan/parser.rb +71 -0
- data/lib/adhearsion/voip/dsl/dialplan/thread_mixin.rb +16 -0
- data/lib/adhearsion/voip/dsl/numerical_string.rb +117 -0
- data/lib/adhearsion/voip/freeswitch/basic_connection_manager.rb +48 -0
- data/lib/adhearsion/voip/freeswitch/event_handler.rb +58 -0
- data/lib/adhearsion/voip/freeswitch/freeswitch_dialplan_command_factory.rb +129 -0
- data/lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb +38 -0
- data/lib/adhearsion/voip/freeswitch/oes_server.rb +195 -0
- data/lib/adhearsion/voip/menu_state_machine/calculated_match.rb +80 -0
- data/lib/adhearsion/voip/menu_state_machine/matchers.rb +123 -0
- data/lib/adhearsion/voip/menu_state_machine/menu_builder.rb +58 -0
- data/lib/adhearsion/voip/menu_state_machine/menu_class.rb +149 -0
- data/lib/theatre.rb +151 -0
- data/lib/theatre/README.markdown +64 -0
- data/lib/theatre/callback_definition_loader.rb +84 -0
- data/lib/theatre/guid.rb +23 -0
- data/lib/theatre/invocation.rb +121 -0
- data/lib/theatre/namespace_manager.rb +153 -0
- data/lib/theatre/version.rb +2 -0
- metadata +182 -0
data/Rakefile
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
abort "You must install RSpec: sudo gem install rspec"
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'yard'
|
15
|
+
YARD::Rake::YardocTask.new do |t|
|
16
|
+
t.files = ['lib/**/*.rb'] + %w[README.markdown TODO.markdown LICENSE]
|
17
|
+
end
|
18
|
+
rescue LoadError
|
19
|
+
STDERR.puts "\nCould not require() YARD! Install with 'gem install yard' to get the 'yardoc' task\n\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'lib/adhearsion/version'
|
23
|
+
|
24
|
+
AHN_TESTS = ['spec/**/test_*.rb']
|
25
|
+
GEMSPEC = eval File.read("adhearsion.gemspec")
|
26
|
+
RAGEL_FILES = %w[lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb]
|
27
|
+
THEATRE_TESTS = 'theatre-spec/**/*_spec.rb'
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'rcov/rcovtask'
|
31
|
+
Rcov::RcovTask.new do |t|
|
32
|
+
t.test_files = Dir[*AHN_TESTS]
|
33
|
+
t.output_dir = 'coverage'
|
34
|
+
t.verbose = true
|
35
|
+
t.rcov_opts.concat %w[--sort coverage --sort-reverse -x gems -x /var --no-validator-links]
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
STDERR.puts "Could not load rcov tasks -- rcov does not appear to be installed. Continuing anyway."
|
39
|
+
end
|
40
|
+
|
41
|
+
Rake::GemPackageTask.new(GEMSPEC).define
|
42
|
+
|
43
|
+
# YARD::Rake::YardocTask.new do |t|
|
44
|
+
# t.files = ['lib/**/*.rb'] # optional
|
45
|
+
# # t.options = ['--any', '--extra', '--opts'] # optional
|
46
|
+
# end
|
47
|
+
|
48
|
+
desc "Run the unit tests for Adhearsion"
|
49
|
+
task :spec do
|
50
|
+
Dir[*AHN_TESTS].each do |file|
|
51
|
+
load file
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Check Ragel version"
|
56
|
+
task :check_ragel_version do
|
57
|
+
ragel_version_match = `ragel --version`.match(/(\d)\.(\d)+/)
|
58
|
+
abort "Could not get Ragel version! Is it installed? You must have at least version 6.3" unless ragel_version_match
|
59
|
+
big, small = ragel_version_match.captures.map { |n| n.to_i }
|
60
|
+
if big < 6 || (big == 6 && small < 3)
|
61
|
+
abort "Please upgrade Ragel! You're on version #{ragel_version_match[0]} and must be on 6.3 or later"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "Used to regenerate the AMI source code files. Note: requires Ragel 6.3 or later be installed on your system"
|
66
|
+
task :ragel => :check_ragel_version do
|
67
|
+
RAGEL_FILES.each do |ragel_file|
|
68
|
+
ruby_file = ragel_file.sub(".rl.rb", ".rb")
|
69
|
+
puts `ragel -n -R #{ragel_file} -o #{ruby_file} 2>&1`
|
70
|
+
raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Generates a GraphVis document showing the Ragel state machine"
|
75
|
+
task :visualize_ragel => :check_ragel_version do
|
76
|
+
RAGEL_FILES.each do |ragel_file|
|
77
|
+
base_name = File.basename ragel_file, ".rl.rb"
|
78
|
+
puts "ragel -V #{ragel_file} -o #{base_name}.dot 2>&1"
|
79
|
+
puts `ragel -V #{ragel_file} -o #{base_name}.dot 2>&1`
|
80
|
+
raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "Run all RSpecs for Theatre"
|
85
|
+
Spec::Rake::SpecTask.new("theatre_specs") do |t|
|
86
|
+
t.spec_files = FileList[THEATRE_TESTS]
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "Compares Adhearsion's files with those listed in adhearsion.gemspec"
|
90
|
+
task :check_gemspec_files do
|
91
|
+
|
92
|
+
files_from_gemspec = ADHEARSION_FILES
|
93
|
+
files_from_filesystem = Dir.glob(File.dirname(__FILE__) + "/**/*").map do |filename|
|
94
|
+
filename[0...Dir.pwd.length] == Dir.pwd ? filename[(Dir.pwd.length+1)..-1] : filename
|
95
|
+
end
|
96
|
+
files_from_filesystem.reject! { |f| File.directory? f }
|
97
|
+
|
98
|
+
puts
|
99
|
+
puts 'Pipe this command to "grep -v \'spec/\' | grep -v test" to ignore test files'
|
100
|
+
puts
|
101
|
+
puts '##########################################'
|
102
|
+
puts '## Files on filesystem not in the gemspec:'
|
103
|
+
puts '##########################################'
|
104
|
+
puts((files_from_filesystem - files_from_gemspec).map { |f| " " + f })
|
105
|
+
|
106
|
+
|
107
|
+
puts '##########################################'
|
108
|
+
puts '## Files in gemspec not in the filesystem:'
|
109
|
+
puts '##########################################'
|
110
|
+
puts((files_from_gemspec - files_from_filesystem).map { |f| " " + f })
|
111
|
+
end
|
112
|
+
|
113
|
+
desc "Test that the .gemspec file executes"
|
114
|
+
task :debug_gem do
|
115
|
+
require 'rubygems/specification'
|
116
|
+
gemspec = File.read('adhearsion.gemspec')
|
117
|
+
spec = nil
|
118
|
+
Thread.new { spec = eval("$SAFE = 3\n#{gemspec}") }.join
|
119
|
+
puts "SUCCESS: Gemspec runs at the $SAFE level 3."
|
120
|
+
end
|
121
|
+
|
122
|
+
desc 'Install the package as a gem.'
|
123
|
+
task :install_gem => [:clobber_package, :package] do
|
124
|
+
windows = /djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM
|
125
|
+
gem = Dir['pkg/*.gem'].first
|
126
|
+
sh "#{'sudo ' unless windows}gem install --local #{gem}"
|
127
|
+
end
|
data/adhearsion.gemspec
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
ADHEARSION_FILES = %w{
|
2
|
+
adhearsion.gemspec
|
3
|
+
app_generators/ahn/ahn_generator.rb
|
4
|
+
app_generators/ahn/templates/.ahnrc
|
5
|
+
app_generators/ahn/templates/components/ami_remote/ami_remote.rb
|
6
|
+
app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE
|
7
|
+
app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.yml
|
8
|
+
app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown
|
9
|
+
app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb
|
10
|
+
app_generators/ahn/templates/components/disabled/sandbox/sandbox.rb
|
11
|
+
app_generators/ahn/templates/components/disabled/sandbox/sandbox.yml
|
12
|
+
app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.yml
|
13
|
+
app_generators/ahn/templates/components/disabled/restful_rpc/example-client.rb
|
14
|
+
app_generators/ahn/templates/components/disabled/restful_rpc/README.markdown
|
15
|
+
app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.rb
|
16
|
+
app_generators/ahn/templates/components/disabled/restful_rpc/spec/restful_rpc_spec.rb
|
17
|
+
app_generators/ahn/templates/components/simon_game/simon_game.rb
|
18
|
+
app_generators/ahn/templates/config/startup.rb
|
19
|
+
app_generators/ahn/templates/dialplan.rb
|
20
|
+
app_generators/ahn/templates/events.rb
|
21
|
+
app_generators/ahn/templates/Rakefile
|
22
|
+
app_generators/ahn/templates/README
|
23
|
+
app_generators/ahn/USAGE
|
24
|
+
bin/ahn
|
25
|
+
bin/ahnctl
|
26
|
+
bin/jahn
|
27
|
+
CHANGELOG
|
28
|
+
EVENTS
|
29
|
+
examples/asterisk_manager_interface/standalone.rb
|
30
|
+
lib/adhearsion.rb
|
31
|
+
lib/adhearsion/cli.rb
|
32
|
+
lib/adhearsion/component_manager.rb
|
33
|
+
lib/adhearsion/component_manager/component_tester.rb
|
34
|
+
lib/adhearsion/component_manager/spec_framework.rb
|
35
|
+
lib/adhearsion/events_support.rb
|
36
|
+
lib/adhearsion/foundation/all.rb
|
37
|
+
lib/adhearsion/foundation/blank_slate.rb
|
38
|
+
lib/adhearsion/foundation/custom_daemonizer.rb
|
39
|
+
lib/adhearsion/foundation/event_socket.rb
|
40
|
+
lib/adhearsion/foundation/future_resource.rb
|
41
|
+
lib/adhearsion/foundation/global.rb
|
42
|
+
lib/adhearsion/foundation/metaprogramming.rb
|
43
|
+
lib/adhearsion/foundation/numeric.rb
|
44
|
+
lib/adhearsion/foundation/pseudo_guid.rb
|
45
|
+
lib/adhearsion/foundation/relationship_properties.rb
|
46
|
+
lib/adhearsion/foundation/string.rb
|
47
|
+
lib/adhearsion/foundation/synchronized_hash.rb
|
48
|
+
lib/adhearsion/foundation/thread_safety.rb
|
49
|
+
lib/adhearsion/host_definitions.rb
|
50
|
+
lib/adhearsion/initializer.rb
|
51
|
+
lib/adhearsion/initializer/asterisk.rb
|
52
|
+
lib/adhearsion/initializer/configuration.rb
|
53
|
+
lib/adhearsion/initializer/database.rb
|
54
|
+
lib/adhearsion/initializer/drb.rb
|
55
|
+
lib/adhearsion/initializer/freeswitch.rb
|
56
|
+
lib/adhearsion/initializer/rails.rb
|
57
|
+
lib/adhearsion/logging.rb
|
58
|
+
lib/adhearsion/tasks.rb
|
59
|
+
lib/adhearsion/tasks/database.rb
|
60
|
+
lib/adhearsion/tasks/deprecations.rb
|
61
|
+
lib/adhearsion/tasks/generating.rb
|
62
|
+
lib/adhearsion/tasks/lint.rb
|
63
|
+
lib/adhearsion/tasks/testing.rb
|
64
|
+
lib/adhearsion/version.rb
|
65
|
+
lib/adhearsion/voip/asterisk.rb
|
66
|
+
lib/adhearsion/voip/asterisk/agi_server.rb
|
67
|
+
lib/adhearsion/voip/asterisk/commands.rb
|
68
|
+
lib/adhearsion/voip/asterisk/config_generators/agents.conf.rb
|
69
|
+
lib/adhearsion/voip/asterisk/config_generators/config_generator.rb
|
70
|
+
lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb
|
71
|
+
lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb
|
72
|
+
lib/adhearsion/voip/asterisk/config_manager.rb
|
73
|
+
lib/adhearsion/voip/asterisk/manager_interface.rb
|
74
|
+
lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb
|
75
|
+
lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb
|
76
|
+
lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
|
77
|
+
lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl
|
78
|
+
lib/adhearsion/voip/asterisk/special_dial_plan_managers.rb
|
79
|
+
lib/adhearsion/voip/asterisk/super_manager.rb
|
80
|
+
lib/adhearsion/voip/call.rb
|
81
|
+
lib/adhearsion/voip/call_routing.rb
|
82
|
+
lib/adhearsion/voip/commands.rb
|
83
|
+
lib/adhearsion/voip/constants.rb
|
84
|
+
lib/adhearsion/voip/conveniences.rb
|
85
|
+
lib/adhearsion/voip/dial_plan.rb
|
86
|
+
lib/adhearsion/voip/dsl/dialing_dsl.rb
|
87
|
+
lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb
|
88
|
+
lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb
|
89
|
+
lib/adhearsion/voip/dsl/dialplan/dispatcher.rb
|
90
|
+
lib/adhearsion/voip/dsl/dialplan/parser.rb
|
91
|
+
lib/adhearsion/voip/dsl/dialplan/thread_mixin.rb
|
92
|
+
lib/adhearsion/voip/dsl/numerical_string.rb
|
93
|
+
lib/adhearsion/voip/freeswitch/basic_connection_manager.rb
|
94
|
+
lib/adhearsion/voip/freeswitch/event_handler.rb
|
95
|
+
lib/adhearsion/voip/freeswitch/freeswitch_dialplan_command_factory.rb
|
96
|
+
lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
|
97
|
+
lib/adhearsion/voip/freeswitch/oes_server.rb
|
98
|
+
lib/adhearsion/voip/menu_state_machine/calculated_match.rb
|
99
|
+
lib/adhearsion/voip/menu_state_machine/matchers.rb
|
100
|
+
lib/adhearsion/voip/menu_state_machine/menu_builder.rb
|
101
|
+
lib/adhearsion/voip/menu_state_machine/menu_class.rb
|
102
|
+
lib/theatre.rb
|
103
|
+
lib/theatre/callback_definition_loader.rb
|
104
|
+
lib/theatre/guid.rb
|
105
|
+
lib/theatre/invocation.rb
|
106
|
+
lib/theatre/namespace_manager.rb
|
107
|
+
lib/theatre/README.markdown
|
108
|
+
lib/theatre/version.rb
|
109
|
+
LICENSE
|
110
|
+
Rakefile
|
111
|
+
}
|
112
|
+
|
113
|
+
Gem::Specification.new do |s|
|
114
|
+
s.name = "adhearsion"
|
115
|
+
s.version = "0.8.3"
|
116
|
+
|
117
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
118
|
+
s.authors = ["Jay Phillips"]
|
119
|
+
|
120
|
+
s.date = "2008-08-21"
|
121
|
+
s.description = "Adhearsion is an open-source telephony development framework (with minor mods)"
|
122
|
+
s.email = "Jay -at- Codemecca.com"
|
123
|
+
s.executables = ["ahn", "ahnctl", "jahn"]
|
124
|
+
|
125
|
+
s.files = ADHEARSION_FILES
|
126
|
+
|
127
|
+
s.has_rdoc = false
|
128
|
+
s.homepage = "http://adhearsion.com"
|
129
|
+
s.require_paths = ["lib"]
|
130
|
+
s.rubyforge_project = "adhearsion"
|
131
|
+
s.rubygems_version = "1.2.0"
|
132
|
+
s.summary = "Adhearsion, open-source telephony development framework"
|
133
|
+
|
134
|
+
if s.respond_to? :specification_version then
|
135
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
136
|
+
s.specification_version = 2
|
137
|
+
|
138
|
+
if current_version >= 3 then
|
139
|
+
s.add_runtime_dependency("rubigen", [">= 1.0.6"])
|
140
|
+
s.add_runtime_dependency("log4r", [">= 1.0.5"])
|
141
|
+
else
|
142
|
+
s.add_dependency("rubigen", [">= 1.0.6"])
|
143
|
+
s.add_dependency("log4r", [">= 1.0.5"])
|
144
|
+
end
|
145
|
+
else
|
146
|
+
s.add_dependency("rubigen", [">= 1.0.6"])
|
147
|
+
s.add_dependency("log4r", [">= 1.0.5"])
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
class AhnGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name, :component
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@destination_root = File.expand_path(args.shift)
|
14
|
+
@name = base_name
|
15
|
+
@component = 'simon_game'
|
16
|
+
extract_options
|
17
|
+
end
|
18
|
+
|
19
|
+
def manifest
|
20
|
+
record do |m|
|
21
|
+
# Ensure appropriate folder(s) exists
|
22
|
+
m.directory ''
|
23
|
+
BASEDIRS.each { |path| m.directory path }
|
24
|
+
|
25
|
+
m.file *[".ahnrc"]*2
|
26
|
+
|
27
|
+
m.file *["components/simon_game/simon_game.rb"]*2
|
28
|
+
m.file *["components/ami_remote/ami_remote.rb"]*2
|
29
|
+
|
30
|
+
m.file *["components/disabled/stomp_gateway/stomp_gateway.rb"]*2
|
31
|
+
m.file *["components/disabled/stomp_gateway/stomp_gateway.yml"]*2
|
32
|
+
m.file *["components/disabled/stomp_gateway/README.markdown"]*2
|
33
|
+
|
34
|
+
m.file *["components/disabled/restful_rpc/restful_rpc.rb"]*2
|
35
|
+
m.file *["components/disabled/restful_rpc/restful_rpc.yml"]*2
|
36
|
+
m.file *["components/disabled/restful_rpc/README.markdown"]*2
|
37
|
+
m.file *["components/disabled/restful_rpc/example-client.rb"]*2
|
38
|
+
m.file *["components/disabled/restful_rpc/spec/restful_rpc_spec.rb"]*2
|
39
|
+
|
40
|
+
m.file *["components/disabled/sandbox/sandbox.yml"]*2
|
41
|
+
m.file *["components/disabled/sandbox/sandbox.rb"]*2
|
42
|
+
|
43
|
+
m.file *["config/startup.rb"]*2
|
44
|
+
m.file *["dialplan.rb"]*2
|
45
|
+
m.file *["events.rb"]*2
|
46
|
+
m.file *["README"]*2
|
47
|
+
m.file *["Rakefile"]*2
|
48
|
+
|
49
|
+
# m.dependency "install_rubigen_scripts", [destination_root, 'ahn', 'adhearsion', 'test_spec'],
|
50
|
+
# :shebang => options[:shebang], :collision => :force
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
def banner
|
56
|
+
<<-EOS
|
57
|
+
Creates a ...
|
58
|
+
|
59
|
+
USAGE: #{spec.name} name"
|
60
|
+
EOS
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_options!(opts)
|
64
|
+
opts.separator ''
|
65
|
+
opts.separator 'Options:'
|
66
|
+
# For each option below, place the default
|
67
|
+
# at the top of the file next to "default_options"
|
68
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
69
|
+
# "Some comment about this option",
|
70
|
+
# "Default: none") { |options[:author]| }
|
71
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
72
|
+
end
|
73
|
+
|
74
|
+
def extract_options
|
75
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
76
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
77
|
+
# raw instance variable value.
|
78
|
+
# @author = options[:author]
|
79
|
+
end
|
80
|
+
|
81
|
+
# Installation skeleton. Intermediate directories are automatically
|
82
|
+
# created so don't sweat their absence here.
|
83
|
+
BASEDIRS = %w(
|
84
|
+
components/simon_game
|
85
|
+
components/disabled/stomp_gateway
|
86
|
+
components/disabled/sandbox
|
87
|
+
components/ami_remote
|
88
|
+
components/disabled/restful_rpc/spec
|
89
|
+
config
|
90
|
+
)
|
91
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Adhearsion Runtime Configuration.
|
2
|
+
|
3
|
+
# You can use the "gems" section to force Adhearsion to load a particular version of a gem.
|
4
|
+
# This is useful when a component require()s a gem, but you don't want it to use the latest one installed on the system.
|
5
|
+
# For example, if a component require()s activerecord, sucking in the latest on the system, and then you enable a Rails app
|
6
|
+
# which wants a particular version of activerecord, RubyGems will raise an error saying "you cannot activate two versions of
|
7
|
+
# the same gem". Note: specifying the version, source and require names is optional, but you must include a : after the gem name to make it a YAML key/value pair (with a nil value).
|
8
|
+
gems:
|
9
|
+
# twitter:
|
10
|
+
# hpricot:
|
11
|
+
# rack:
|
12
|
+
# # require() one library when initializing:
|
13
|
+
# require: rack
|
14
|
+
# memcache-client:
|
15
|
+
# version >= 1.5.2
|
16
|
+
# require:
|
17
|
+
# # require() an Array of libraries when initializing:
|
18
|
+
# - memcache
|
19
|
+
# - memcache_util
|
20
|
+
# activerecord:
|
21
|
+
# version: >= 2.1.0
|
22
|
+
# aasm:
|
23
|
+
# source: http://gems.github.com
|
24
|
+
|
25
|
+
paths:
|
26
|
+
|
27
|
+
# All paths are relative to this file's directory
|
28
|
+
init: config/startup.rb
|
29
|
+
|
30
|
+
dialplan: dialplan.rb
|
31
|
+
|
32
|
+
events: events.rb
|
33
|
+
|
34
|
+
models: models/*.rb
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Start your new app with "ahn start /path/to/your/app"
|
2
|
+
|
3
|
+
If you wish to use Adhearsion to control Asterisk's dialplan,
|
4
|
+
change the contexts you wish to be affected in your
|
5
|
+
/etc/asterisk/extensions.conf file to the following:
|
6
|
+
|
7
|
+
[your_context_name]
|
8
|
+
exten => _X.,1,AGI(agi://1.2.3.4) ; This IP here
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This file is for the "rake" tool which automates project-related tasks. If you need to automate things, you can create
|
2
|
+
# a new Rake task here. See http://rake.rubyforge.org for more info.
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'adhearsion'
|
7
|
+
require 'adhearsion/tasks'
|
8
|
+
rescue LoadError
|
9
|
+
STDERR.puts "\nCannot load Adhearsion! Not all Rake tasks will be loaded!\n\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Writes a .gitignore file that ignores certain SCM annoyances such as log files"
|
13
|
+
task :gitignore do
|
14
|
+
ignore_file = "#{Dir.pwd}/.gitignore"
|
15
|
+
if File.exists? ignore_file
|
16
|
+
STDERR.puts "File #{ignore_file} already exists!"
|
17
|
+
else
|
18
|
+
File.open ignore_file, 'w' do |file|
|
19
|
+
# Add other files to the Array below
|
20
|
+
%w[ log ].each do |pattern|
|
21
|
+
file.puts pattern
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
methods_for :rpc do
|
2
|
+
|
3
|
+
# Simply create proxy methods for the high-level AMI methods
|
4
|
+
|
5
|
+
[:send_action, :introduce, :originate, :call_into_context, :call_and_exec, :ping].each do |method_name|
|
6
|
+
define_method(method_name) do |*args|
|
7
|
+
if VoIP::Asterisk.manager_interface
|
8
|
+
VoIP::Asterisk.manager_interface.send(method_name, *args)
|
9
|
+
else
|
10
|
+
ahn_log.ami_remote.error "AMI has not been enabled in startup.rb!"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|