adhearsion 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/CHANGELOG +12 -0
  2. data/Rakefile +6 -5
  3. data/adhearsion.gemspec +9 -5
  4. data/app_generators/ahn/ahn_generator.rb +5 -0
  5. data/app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.rb +1 -1
  6. data/app_generators/ahn/templates/components/disabled/sandbox/sandbox.rb +1 -1
  7. data/app_generators/ahn/templates/components/disabled/xmpp_gateway/README.markdown +3 -0
  8. data/app_generators/ahn/templates/components/disabled/xmpp_gateway/xmpp_gateway.rb +11 -0
  9. data/app_generators/ahn/templates/components/disabled/xmpp_gateway/xmpp_gateway.yml +0 -0
  10. data/app_generators/ahn/templates/config/startup.rb +10 -1
  11. data/lib/adhearsion/cli.rb +7 -2
  12. data/lib/adhearsion/foundation/event_socket.rb +1 -1
  13. data/lib/adhearsion/foundation/future_resource.rb +1 -1
  14. data/lib/adhearsion/host_definitions.rb +1 -1
  15. data/lib/adhearsion/initializer.rb +21 -8
  16. data/lib/adhearsion/initializer/configuration.rb +44 -3
  17. data/lib/adhearsion/initializer/database.rb +11 -1
  18. data/lib/adhearsion/initializer/ldap.rb +7 -1
  19. data/lib/adhearsion/initializer/xmpp.rb +42 -0
  20. data/lib/adhearsion/version.rb +26 -2
  21. data/lib/adhearsion/voip/asterisk/agi_server.rb +2 -1
  22. data/lib/adhearsion/voip/asterisk/commands.rb +186 -85
  23. data/lib/adhearsion/voip/asterisk/manager_interface.rb +147 -50
  24. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb +1 -1
  25. data/lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb +1 -1
  26. data/lib/adhearsion/voip/call.rb +15 -8
  27. data/lib/adhearsion/voip/dial_plan.rb +21 -4
  28. data/lib/adhearsion/voip/dsl/dialing_dsl.rb +1 -1
  29. data/lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb +2 -2
  30. data/lib/adhearsion/voip/dsl/dialplan/dispatcher.rb +2 -2
  31. data/lib/adhearsion/voip/menu_state_machine/menu_class.rb +2 -2
  32. data/lib/adhearsion/xmpp/connection.rb +61 -0
  33. data/lib/theatre/invocation.rb +1 -1
  34. data/lib/theatre/namespace_manager.rb +1 -1
  35. metadata +12 -6
  36. data/lib/adhearsion/foundation/global.rb +0 -1
@@ -142,7 +142,7 @@ module Adhearsion
142
142
  patterns.unshift pattern
143
143
  end
144
144
 
145
- class RouteException < Exception; end
145
+ class RouteException < StandardError; end
146
146
 
147
147
  end
148
148
  end
@@ -9,7 +9,7 @@ module Adhearsion
9
9
  # particular context. The serve() method in the servlet_container actually
10
10
  # rescues these exceptions specifically and then does +e.target to execute
11
11
  # that code.
12
- class ControlPassingException < Exception
12
+ class ControlPassingException < StandardError
13
13
 
14
14
  attr_reader :target
15
15
 
@@ -20,7 +20,7 @@ module Adhearsion
20
20
 
21
21
  end
22
22
 
23
- class ContextNotFoundException < Exception; end
23
+ class ContextNotFoundException < StandardError; end
24
24
  end
25
25
  end
26
26
  end
@@ -3,7 +3,7 @@ module Adhearsion
3
3
  module DSL
4
4
  module Dialplan
5
5
 
6
- class ReturnValue < Exception
6
+ class ReturnValue < StandardError
7
7
  attr_reader :obj
8
8
  def initialize(obj)
9
9
  @obj = obj
@@ -11,7 +11,7 @@ module Adhearsion
11
11
  end
12
12
  end
13
13
 
14
- class Hangup < Exception; end
14
+ class Hangup < StandardError; end
15
15
 
16
16
  # Instantiated and returned in every dialplan command
17
17
  class EventCommand
@@ -102,9 +102,9 @@ module Adhearsion
102
102
  raise MenuGetAnotherDigitOrTimeout
103
103
  end
104
104
 
105
- # The superclass from which all message-like exceptions decend. It should never
105
+ # The superclass from which all message-like exceptions descend. It should never
106
106
  # be instantiated directly.
107
- class MenuResult < Exception; end
107
+ class MenuResult < StandardError; end
108
108
 
109
109
  # Raised when the user's input matches
110
110
  class MenuResultFound < MenuResult
@@ -0,0 +1,61 @@
1
+ module Adhearsion
2
+ module XMPP
3
+ module Connection
4
+
5
+ mattr_accessor :client
6
+ class << self
7
+
8
+ # Open the XMPP connection
9
+ #
10
+ # @param [String] jid the client/component JID to connect to
11
+ # @param [String] password
12
+ # @param [String] server
13
+ # @param [Integer] port
14
+ def start(jid, password, server, port)
15
+ Blather.logger = ahn_log.xmpp
16
+ setup_client_object(jid, password, server, port)
17
+ register_event_namespaces
18
+ register_default_client_handlers
19
+ Events.register_callback(:after_initialized) do
20
+ connect
21
+ end
22
+ end
23
+
24
+ # Close the XMPP connection
25
+ def stop
26
+ shutdown
27
+ end
28
+
29
+ private
30
+
31
+ def setup_client_object(jid, password, server, port)
32
+ self.client = Blather::Client.setup(jid, password, server, port)
33
+ end
34
+
35
+ def connect
36
+ EventMachine.run {client.connect}
37
+ end
38
+
39
+ def register_event_namespaces
40
+ Events.register_namespace_name "/xmpp"
41
+ end
42
+
43
+ def register_default_client_handlers
44
+ client.register_handler(:ready) do
45
+ ahn_log.xmpp.info "Connected to XMPP server! Send messages to #{client.jid.stripped}."
46
+ end
47
+
48
+ client.register_handler(:disconnected) do
49
+ if Adhearsion.status == :running
50
+ ahn_log.xmpp.warning "XMPP Disconnected. Reconnecting."
51
+ connect
52
+ end
53
+ # TODO: fix this to reconnect XMPP cleanly
54
+ end
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -11,7 +11,7 @@ module Theatre
11
11
 
12
12
  attr_reader :queued_time, :started_time, :finished_time, :unique_id, :callback, :namespace, :error, :returned_value
13
13
 
14
- class InvalidStateError < Exception; end
14
+ class InvalidStateError < StandardError; end
15
15
 
16
16
  ##
17
17
  # Create a new Invocation.
@@ -144,7 +144,7 @@ module Theatre
144
144
 
145
145
  end
146
146
 
147
- class NamespaceNotFound < Exception
147
+ class NamespaceNotFound < StandardError
148
148
  def initialize(full_path)
149
149
  super "Could not find #{full_path.inspect} in the namespace registry. Did you register it yet?"
150
150
  end
metadata CHANGED
@@ -1,21 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 4
10
- version: 0.8.4
9
+ - 5
10
+ version: 0.8.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jay Phillips
14
+ - Jason Goecke
15
+ - Ben Klang
14
16
  autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2008-08-21 00:00:00 -07:00
20
+ date: 2010-08-24 00:00:00 -04:00
19
21
  default_executable:
20
22
  dependencies:
21
23
  - !ruby/object:Gem::Dependency
@@ -67,7 +69,7 @@ dependencies:
67
69
  type: :runtime
68
70
  version_requirements: *id003
69
71
  description: Adhearsion is an open-source telephony development framework
70
- email: Jay&Adhearsion.com
72
+ email: dev&Adhearsion.com
71
73
  executables:
72
74
  - ahn
73
75
  - ahnctl
@@ -92,6 +94,9 @@ files:
92
94
  - app_generators/ahn/templates/components/disabled/restful_rpc/README.markdown
93
95
  - app_generators/ahn/templates/components/disabled/restful_rpc/restful_rpc.rb
94
96
  - app_generators/ahn/templates/components/disabled/restful_rpc/spec/restful_rpc_spec.rb
97
+ - app_generators/ahn/templates/components/disabled/xmpp_gateway/xmpp_gateway.rb
98
+ - app_generators/ahn/templates/components/disabled/xmpp_gateway/xmpp_gateway.yml
99
+ - app_generators/ahn/templates/components/disabled/xmpp_gateway/README.markdown
95
100
  - app_generators/ahn/templates/components/simon_game/simon_game.rb
96
101
  - app_generators/ahn/templates/config/startup.rb
97
102
  - app_generators/ahn/templates/dialplan.rb
@@ -116,7 +121,6 @@ files:
116
121
  - lib/adhearsion/foundation/custom_daemonizer.rb
117
122
  - lib/adhearsion/foundation/event_socket.rb
118
123
  - lib/adhearsion/foundation/future_resource.rb
119
- - lib/adhearsion/foundation/global.rb
120
124
  - lib/adhearsion/foundation/metaprogramming.rb
121
125
  - lib/adhearsion/foundation/numeric.rb
122
126
  - lib/adhearsion/foundation/pseudo_guid.rb
@@ -133,6 +137,7 @@ files:
133
137
  - lib/adhearsion/initializer/drb.rb
134
138
  - lib/adhearsion/initializer/freeswitch.rb
135
139
  - lib/adhearsion/initializer/rails.rb
140
+ - lib/adhearsion/initializer/xmpp.rb
136
141
  - lib/adhearsion/logging.rb
137
142
  - lib/adhearsion/tasks.rb
138
143
  - lib/adhearsion/tasks/database.rb
@@ -178,6 +183,7 @@ files:
178
183
  - lib/adhearsion/voip/menu_state_machine/matchers.rb
179
184
  - lib/adhearsion/voip/menu_state_machine/menu_builder.rb
180
185
  - lib/adhearsion/voip/menu_state_machine/menu_class.rb
186
+ - lib/adhearsion/xmpp/connection.rb
181
187
  - lib/theatre.rb
182
188
  - lib/theatre/callback_definition_loader.rb
183
189
  - lib/theatre/guid.rb
@@ -1 +0,0 @@
1
- Infinity = 1.0/0.0