adhearsion 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,5 @@
1
- 0.8.1
2
-
3
-
1
+ 0.8.0 rev 2
2
+ - Added a few non-critical files to the .gemspec. They were ignored
4
3
 
5
4
  Notes from before 0.8.0:
6
5
  - (NOTE: This is obviously not a comprehensive list of pre-0.8.0 work. 0.8.0 was a complete rewrite of the previous version)
data/README.markdown ADDED
@@ -0,0 +1,31 @@
1
+ Adhearsion
2
+ ==========
3
+
4
+ Adhearsion is an open-source voice application development framework. Adhearsion users write applications atop the framework with Ruby and **call into their code**.
5
+
6
+ Adhearsion rests above a lower-level telephony platform, namely [Asterisk](http://asterisk.org), though there are experimental bindings for both [FreeSWITCH](http://freeswitch.org) and [Yate](http://yate.null.ro/pmwiki).
7
+
8
+ Adhearsion has...
9
+
10
+ * An elegant dialplan system for writing the code which controls a live phone call
11
+ * A sophisticated Asterisk Manager Interface library with a lexer written in [Ragel](http://www.complang.org/ragel).
12
+ * An events subsystem which maintains a Thread-pool for executing your namespaced callbacks. (supports AMI events too!)
13
+ * A very useful component architecture with which you may write Adhearsion plugins and share them with the world.
14
+ * JRuby compatibility for running atop the Java Virtual Machine and using virtually any Java library.
15
+ * Good regression test coverage
16
+
17
+ Use the public Adhearsion sandbox!
18
+ ==================================
19
+
20
+ Don't want to screw with setting up a telephony system? You can test your Adhearsion applications using our public sandbox!
21
+
22
+ Visit [http://adhearsion.com/getting_started](http://adhearsion.com/getting_started) for more information!
23
+
24
+ Yes, in minutes you can be controlling your cell phone for free! :)
25
+
26
+ Documentation
27
+ =============
28
+
29
+ Visit [Adhearsion's website](http://adhearsion.com) for more information about the framework or visit the [wiki](http://docs.adhearsion.com) for documentation on how to use it.
30
+
31
+ If you're having trouble, you may want to try asking your question on the IRC channel, [mailing list](http://groups.google.com/group/adhearsion) or, if you've found a bug, report it on the [bug tracker](http://adhearsion.lighthouseapp.com/projects/5871-adhearsion/overview).
data/adhearsion.gemspec CHANGED
@@ -1,17 +1,20 @@
1
1
  ADHEARSION_FILES = %w{
2
+ README.markdown
2
3
  adhearsion.gemspec
3
4
  app_generators/ahn/ahn_generator.rb
4
5
  app_generators/ahn/templates/.ahnrc
5
6
  app_generators/ahn/templates/components/ami_remote/ami_remote.rb
6
7
  app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE
7
- app_generators/ahn/templates/components/disabled/stomp_gateway/config.yml
8
+ app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.yml
8
9
  app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown
9
10
  app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb
10
- app_generators/ahn/templates/components/restful_rpc/config.yml
11
- app_generators/ahn/templates/components/restful_rpc/example-client.rb
12
- app_generators/ahn/templates/components/restful_rpc/README.markdown
13
- app_generators/ahn/templates/components/restful_rpc/restful_rpc.rb
14
- app_generators/ahn/templates/components/restful_rpc/spec/restful_rpc_spec.rb
11
+ app_generators/ahn/templates/components/disabled/sandbox/sandbox.rb
12
+ app_generators/ahn/templates/components/disabled/sandbox/sandbox.yml
13
+ app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.yml
14
+ app_generators/ahn/templates/components/disabled/restful_rpc/example-client.rb
15
+ app_generators/ahn/templates/components/disabled/restful_rpc/README.markdown
16
+ app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.rb
17
+ app_generators/ahn/templates/components/disabled/restful_rpc/spec/restful_rpc_spec.rb
15
18
  app_generators/ahn/templates/components/simon_game/simon_game.rb
16
19
  app_generators/ahn/templates/config/startup.rb
17
20
  app_generators/ahn/templates/dialplan.rb
@@ -106,12 +109,11 @@ ADHEARSION_FILES = %w{
106
109
  lib/theatre/version.rb
107
110
  LICENSE
108
111
  Rakefile
109
- README.txt
110
112
  }
111
113
 
112
114
  Gem::Specification.new do |s|
113
115
  s.name = "adhearsion"
114
- s.version = "0.8.0"
116
+ s.version = "0.8.1"
115
117
 
116
118
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
117
119
  s.authors = ["Jay Phillips"]
@@ -28,14 +28,17 @@ class AhnGenerator < RubiGen::Base
28
28
  m.file *["components/ami_remote/ami_remote.rb"]*2
29
29
 
30
30
  m.file *["components/disabled/stomp_gateway/stomp_gateway.rb"]*2
31
- m.file *["components/disabled/stomp_gateway/config.yml"]*2
31
+ m.file *["components/disabled/stomp_gateway/stomp_gateway.yml"]*2
32
32
  m.file *["components/disabled/stomp_gateway/README.markdown"]*2
33
33
 
34
- m.file *["components/restful_rpc/restful_rpc.rb"]*2
35
- m.file *["components/restful_rpc/config.yml"]*2
36
- m.file *["components/restful_rpc/README.markdown"]*2
37
- m.file *["components/restful_rpc/example-client.rb"]*2
38
- m.file *["components/restful_rpc/spec/restful_rpc_spec.rb"]*2
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
39
42
 
40
43
  m.file *["config/startup.rb"]*2
41
44
  m.file *["dialplan.rb"]*2
@@ -80,8 +83,9 @@ EOS
80
83
  BASEDIRS = %w(
81
84
  components/simon_game
82
85
  components/disabled/stomp_gateway
86
+ components/disabled/sandbox
83
87
  components/ami_remote
84
- components/restful_rpc/spec
88
+ components/disabled/restful_rpc/spec
85
89
  config
86
90
  )
87
91
  end
@@ -0,0 +1,109 @@
1
+ require 'md5'
2
+ require 'open-uri'
3
+
4
+ SANDBOX_VERSION = 1.0
5
+
6
+ initialization do
7
+ # We shouldn't start initializing until after the AGI server has initialized.
8
+ Events.register_callback(:after_initialized) do
9
+ ahn_log.sandbox "Fetching sandbox connection information"
10
+
11
+ config = if COMPONENTS.sandbox.has_key? "connect_to"
12
+ {"connect_to" => COMPONENTS.sandbox["connect_to"]}
13
+ else
14
+ begin
15
+ yaml_data = open("http://sandbox.adhearsion.com/component/#{SANDBOX_VERSION}").read
16
+ YAML.load yaml_data
17
+ rescue SocketError
18
+ ahn_log.sandbox.error "Could not connect to the sandbox server! Skipping sandbox initialization!"
19
+ next
20
+ rescue => e
21
+ ahn_log.sandbox.error "COULD NOT RETRIEVE SANDBOX CONNECTION INFORMATION! Not initializing sandbox component!"
22
+ next
23
+ end
24
+ end
25
+
26
+ begin
27
+ # The "connect_to" key is what this version supports
28
+ if config.kind_of?(Hash) && config.has_key?("connect_to")
29
+ config = config['connect_to']
30
+
31
+ host, port = config.values_at "host", "port"
32
+
33
+ ahn_log.sandbox "Connecting to #{host}:#{port}"
34
+
35
+ username, password = COMPONENTS.sandbox["username"], COMPONENTS.sandbox["password"]
36
+
37
+ if username.blank? || password.blank? || username == "user123"
38
+ ahn_log.sandbox.error "You must specify your username and password in this component's config file!"
39
+ next
40
+ end
41
+
42
+ # Part of the AGI-superset protocol we use to log in.
43
+ identifying_hash = MD5.md5(username + ":" + password).to_s
44
+
45
+ if host.nil? || port.nil?
46
+ ahn_log.sandbox.error "Invalid YAML returned from server! Skipping sandbox initialization!"
47
+ next
48
+ end
49
+
50
+ Thread.new do
51
+ loop do
52
+ begin
53
+ ahn_log.sandbox.debug "Establishing outbound AGI socket"
54
+ socket = TCPSocket.new(host, port)
55
+ socket.puts identifying_hash
56
+ response = socket.gets
57
+ unless response
58
+ ahn_log.sandbox "Communication with the sandbox ended before receiving any response. Trying again in 10 seconds."
59
+ sleep 10
60
+ next
61
+ end
62
+ response.chomp!
63
+ case
64
+ when "authentication accepted"
65
+ ahn_log.sandbox "Authentication accepted"
66
+
67
+ start_signal = socket.gets
68
+ next unless start_signal
69
+ start_signal.chomp!
70
+
71
+ if start_signal
72
+ ahn_log.sandbox "Incoming call from remote sandbox server!"
73
+ begin
74
+ Adhearsion::Initializer::AsteriskInitializer.agi_server.server.serve(socket)
75
+ rescue => e
76
+ ahn_log.error "Non-fatal exception in the AGI server: #{e.inspect} \n" + e.backtrace.join("\n")
77
+ ensure
78
+ socket.close
79
+ end
80
+ ahn_log.sandbox "AGI server finished serving call. Reconnecting to sandbox."
81
+ else
82
+ ahn_log.sandbox "Remote Asterisk server received no call. Reconnecting..."
83
+ end
84
+ when "authentication failed"
85
+ ahn_log.sandbox.error "Your username or password is invalid! Skipping sandbox initialization..."
86
+ break
87
+ when /^wait (\d+)$/
88
+ sleep response[/^wait (\d+)$/,1].to_i
89
+ else
90
+ ahn_log.sandbox.error "Invalid login acknowledgement! Skipping sandbox initialization!"
91
+ break
92
+ end
93
+ rescue Errno::ECONNREFUSED
94
+ ahn_log.sandbox.error "Could not connect to the sandbox server! Sandbox component stopping..."
95
+ break
96
+ rescue => e
97
+ ahn_log.error "Unrecognized error: #{e.inspect} \n" + e.backtrace.join("\n")
98
+ end
99
+ end
100
+ end
101
+
102
+ else
103
+ ahn_log.sandbox.error "COULD NOT RETRIEVE SANDBOX CONNECTION INFORMATION! Not initializing sandbox component!"
104
+ end
105
+ rescue => e
106
+ ahn_log.sandbox.error "Encountered an error when connecting to the sandbox! #{e.message}\n" + e.backtrace.join("\n")
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,2 @@
1
+ username: user123
2
+ password: pass123
@@ -35,7 +35,7 @@ Setting up a Ruby Stomp server
35
35
 
36
36
  Install the pure-Ruby Stomp server by doing "gem install stompserver". This will add the "stompserver" command to your system. When running it without any parameters, it starts without requiring authentication. If you're wanting to get a quick experiment running, I recommend simply doing that.
37
37
 
38
- Open the config.yml file in the stomp_gateway component folder. Comment out the four settings at the top of the file named "user", "pass", "host" and "port" by prepending a "#" to their line. This will cause the component to choose defaults for those properties. The component's defaults will match the expected credentials for the experimental stompserver you're already running on your computer.
38
+ Open the `stomp_gateway.yml` file in the stomp_gateway component folder. Comment out the four settings at the top of the file named "user", "pass", "host" and "port" by prepending a "#" to their line. This will cause the component to choose defaults for those properties. The component's defaults will match the expected credentials for the experimental stompserver you're already running on your computer.
39
39
 
40
40
  You also need specify a subscription name in
41
41
 
@@ -115,7 +115,7 @@ USAGE
115
115
  # look at the examples in newly-created projects.
116
116
  RUBY
117
117
  end
118
- File.open(new_component_dir + "/config.yml","w") do |file|
118
+ File.open(new_component_dir + "/#{component_name}.yml","w") do |file|
119
119
  file.puts '# You can use this file for component-specific configuration.'
120
120
  end
121
121
  puts "Created blank component '#{component_name}' at components/#{component_name}"
@@ -18,7 +18,6 @@ module Adhearsion
18
18
  end
19
19
 
20
20
  SCOPE_NAMES = [:dialplan, :events, :generators, :rpc, :global]
21
- DEFAULT_CONFIG_NAME = "config.yml"
22
21
 
23
22
  attr_reader :scopes, :lazy_config_loader
24
23
  def initialize(path_to_container_directory)
@@ -61,7 +60,7 @@ module Adhearsion
61
60
  #
62
61
  def configuration_for_component_named(component_name)
63
62
  component_dir = File.join(@path_to_container_directory, component_name)
64
- config_file = File.join component_dir, DEFAULT_CONFIG_NAME
63
+ config_file = File.join component_dir, "#{component_name}.yml"
65
64
  if File.exists?(config_file)
66
65
  YAML.load_file config_file
67
66
  else
@@ -2,8 +2,8 @@ module Adhearsion #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0 unless defined? MAJOR
4
4
  MINOR = 8 unless defined? MINOR
5
- TINY = 0 unless defined? TINY
5
+ TINY = 1 unless defined? TINY
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.') unless defined? STRING
8
8
  end
9
- end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Phillips
@@ -43,19 +43,22 @@ extensions: []
43
43
  extra_rdoc_files: []
44
44
 
45
45
  files:
46
+ - README.markdown
46
47
  - adhearsion.gemspec
47
48
  - app_generators/ahn/ahn_generator.rb
48
49
  - app_generators/ahn/templates/.ahnrc
49
50
  - app_generators/ahn/templates/components/ami_remote/ami_remote.rb
50
51
  - app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE
51
- - app_generators/ahn/templates/components/disabled/stomp_gateway/config.yml
52
+ - app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.yml
52
53
  - app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown
53
54
  - app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb
54
- - app_generators/ahn/templates/components/restful_rpc/config.yml
55
- - app_generators/ahn/templates/components/restful_rpc/example-client.rb
56
- - app_generators/ahn/templates/components/restful_rpc/README.markdown
57
- - app_generators/ahn/templates/components/restful_rpc/restful_rpc.rb
58
- - app_generators/ahn/templates/components/restful_rpc/spec/restful_rpc_spec.rb
55
+ - app_generators/ahn/templates/components/disabled/sandbox/sandbox.rb
56
+ - app_generators/ahn/templates/components/disabled/sandbox/sandbox.yml
57
+ - app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.yml
58
+ - app_generators/ahn/templates/components/disabled/restful_rpc/example-client.rb
59
+ - app_generators/ahn/templates/components/disabled/restful_rpc/README.markdown
60
+ - app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.rb
61
+ - app_generators/ahn/templates/components/disabled/restful_rpc/spec/restful_rpc_spec.rb
59
62
  - app_generators/ahn/templates/components/simon_game/simon_game.rb
60
63
  - app_generators/ahn/templates/config/startup.rb
61
64
  - app_generators/ahn/templates/dialplan.rb
@@ -150,7 +153,6 @@ files:
150
153
  - lib/theatre/version.rb
151
154
  - LICENSE
152
155
  - Rakefile
153
- - README.txt
154
156
  has_rdoc: false
155
157
  homepage: http://adhearsion.com
156
158
  post_install_message:
data/README.txt DELETED
@@ -1,5 +0,0 @@
1
- Adhearsion
2
- by Jay Phillips, et. al
3
- http://adhearsion.com
4
-
5
- Adhearsion is an open-source framework written in Ruby designed to vastly improve Voice over IP development. It rests atop established telephony platforms (such as Asterisk and Freeswitch) and abstracts their complexity with the beauty of a well-designed, high-level suite of solutions.