adhearsion 2.6.4 → 3.0.0.beta1

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 (242) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -9
  3. data/CHANGELOG.md +22 -7
  4. data/Gemfile +2 -0
  5. data/README.markdown +4 -5
  6. data/Rakefile +1 -2
  7. data/adhearsion.gemspec +19 -8
  8. data/features/cli_create.feature +19 -3
  9. data/features/step_definitions/cli_steps.rb +0 -11
  10. data/features/support/env.rb +3 -4
  11. data/lib/adhearsion.rb +48 -27
  12. data/lib/adhearsion/call.rb +34 -50
  13. data/lib/adhearsion/call_controller.rb +6 -12
  14. data/lib/adhearsion/call_controller/dial.rb +15 -53
  15. data/lib/adhearsion/call_controller/input.rb +39 -162
  16. data/lib/adhearsion/call_controller/input/ask_grammar_builder.rb +44 -0
  17. data/lib/adhearsion/call_controller/input/menu_builder.rb +136 -0
  18. data/lib/adhearsion/call_controller/input/prompt_builder.rb +78 -0
  19. data/lib/adhearsion/call_controller/input/result.rb +46 -0
  20. data/lib/adhearsion/call_controller/output.rb +48 -67
  21. data/lib/adhearsion/call_controller/output/abstract_player.rb +3 -3
  22. data/lib/adhearsion/call_controller/output/async_player.rb +3 -3
  23. data/lib/adhearsion/call_controller/output/player.rb +1 -1
  24. data/lib/adhearsion/call_controller/record.rb +23 -8
  25. data/lib/adhearsion/calls.rb +1 -1
  26. data/lib/adhearsion/cli_commands/ahn_command.rb +2 -65
  27. data/lib/adhearsion/cli_commands/thor_errors.rb +0 -6
  28. data/lib/adhearsion/configuration.rb +91 -39
  29. data/lib/adhearsion/core_ext/blather/stanza.rb +41 -0
  30. data/lib/adhearsion/core_ext/blather/stanza/presence.rb +13 -0
  31. data/lib/adhearsion/error.rb +5 -0
  32. data/lib/adhearsion/event.rb +21 -0
  33. data/lib/adhearsion/event/active_speaker.rb +11 -0
  34. data/lib/adhearsion/event/answered.rb +11 -0
  35. data/lib/adhearsion/event/asterisk.rb +10 -0
  36. data/lib/adhearsion/event/asterisk/ami.rb +34 -0
  37. data/lib/adhearsion/event/complete.rb +75 -0
  38. data/lib/adhearsion/event/dtmf.rb +11 -0
  39. data/lib/adhearsion/event/end.rb +22 -0
  40. data/lib/adhearsion/event/input_timers_started.rb +9 -0
  41. data/lib/adhearsion/event/joined.rb +17 -0
  42. data/lib/adhearsion/event/offer.rb +14 -0
  43. data/lib/adhearsion/event/ringing.rb +11 -0
  44. data/lib/adhearsion/event/started_speaking.rb +13 -0
  45. data/lib/adhearsion/event/stopped_speaking.rb +13 -0
  46. data/lib/adhearsion/event/unjoined.rb +17 -0
  47. data/lib/adhearsion/events.rb +47 -66
  48. data/lib/adhearsion/foundation.rb +0 -1
  49. data/lib/adhearsion/foundation/object.rb +0 -5
  50. data/lib/adhearsion/generators/app/app_generator.rb +4 -1
  51. data/lib/adhearsion/generators/app/templates/Gemfile.erb +2 -10
  52. data/lib/adhearsion/generators/app/templates/adhearsion.erb +9 -9
  53. data/lib/adhearsion/generators/app/templates/config.ru +7 -0
  54. data/lib/adhearsion/generators/app/templates/en.yml +4 -0
  55. data/lib/adhearsion/generators/app/templates/events.erb +2 -2
  56. data/lib/adhearsion/generators/app/templates/hello_world.wav +0 -0
  57. data/lib/adhearsion/generators/app/templates/simon_game.rb +2 -1
  58. data/lib/adhearsion/generators/app/templates/simon_game_spec.rb +2 -2
  59. data/lib/adhearsion/has_headers.rb +34 -0
  60. data/lib/adhearsion/http_server.rb +37 -0
  61. data/lib/adhearsion/initializer.rb +19 -153
  62. data/lib/adhearsion/logging.rb +6 -25
  63. data/lib/adhearsion/outbound_call.rb +5 -5
  64. data/lib/adhearsion/plugin.rb +1 -0
  65. data/lib/adhearsion/protocol_error.rb +26 -0
  66. data/lib/adhearsion/rayo.rb +30 -0
  67. data/lib/adhearsion/rayo/client.rb +62 -0
  68. data/lib/adhearsion/rayo/client/component_registry.rb +33 -0
  69. data/lib/adhearsion/rayo/command.rb +21 -0
  70. data/lib/adhearsion/rayo/command/accept.rb +16 -0
  71. data/lib/adhearsion/rayo/command/answer.rb +16 -0
  72. data/lib/adhearsion/rayo/command/dial.rb +57 -0
  73. data/lib/adhearsion/rayo/command/hangup.rb +16 -0
  74. data/lib/adhearsion/rayo/command/join.rb +43 -0
  75. data/lib/adhearsion/rayo/command/mute.rb +13 -0
  76. data/lib/adhearsion/rayo/command/redirect.rb +23 -0
  77. data/lib/adhearsion/rayo/command/reject.rb +40 -0
  78. data/lib/adhearsion/rayo/command/unjoin.rb +24 -0
  79. data/lib/adhearsion/rayo/command/unmute.rb +13 -0
  80. data/lib/adhearsion/rayo/command_node.rb +47 -0
  81. data/lib/adhearsion/rayo/component.rb +21 -0
  82. data/lib/adhearsion/rayo/component/asterisk.rb +13 -0
  83. data/lib/adhearsion/rayo/component/asterisk/agi.rb +14 -0
  84. data/lib/adhearsion/rayo/component/asterisk/agi/command.rb +46 -0
  85. data/lib/adhearsion/rayo/component/asterisk/ami.rb +14 -0
  86. data/lib/adhearsion/rayo/component/asterisk/ami/action.rb +61 -0
  87. data/lib/adhearsion/rayo/component/component_node.rb +90 -0
  88. data/lib/adhearsion/rayo/component/input.rb +186 -0
  89. data/lib/adhearsion/rayo/component/output.rb +471 -0
  90. data/lib/adhearsion/rayo/component/prompt.rb +53 -0
  91. data/lib/adhearsion/rayo/component/receive_fax.rb +26 -0
  92. data/lib/adhearsion/rayo/component/record.rb +165 -0
  93. data/lib/adhearsion/rayo/component/send_fax.rb +64 -0
  94. data/lib/adhearsion/rayo/component/stop.rb +11 -0
  95. data/lib/adhearsion/rayo/connection.rb +12 -0
  96. data/lib/adhearsion/rayo/connection/asterisk.rb +74 -0
  97. data/lib/adhearsion/rayo/connection/connected.rb +22 -0
  98. data/lib/adhearsion/rayo/connection/generic_connection.rb +22 -0
  99. data/lib/adhearsion/rayo/connection/xmpp.rb +198 -0
  100. data/lib/adhearsion/rayo/disconnected_error.rb +22 -0
  101. data/lib/adhearsion/{punchblock_plugin → rayo}/initializer.rb +19 -19
  102. data/lib/adhearsion/rayo/rayo_node.rb +127 -0
  103. data/lib/adhearsion/rayo/ref.rb +57 -0
  104. data/lib/adhearsion/statistics.rb +1 -1
  105. data/lib/adhearsion/tasks.rb +1 -2
  106. data/lib/adhearsion/tasks/configuration.rb +1 -1
  107. data/lib/adhearsion/tasks/environment.rb +0 -2
  108. data/lib/adhearsion/tasks/i18n.rb +49 -0
  109. data/lib/adhearsion/translator.rb +11 -0
  110. data/lib/adhearsion/translator/asterisk.rb +234 -0
  111. data/lib/adhearsion/translator/asterisk/agi_app.rb +17 -0
  112. data/lib/adhearsion/translator/asterisk/agi_command.rb +45 -0
  113. data/lib/adhearsion/translator/asterisk/ami_error_converter.rb +20 -0
  114. data/lib/adhearsion/translator/asterisk/call.rb +416 -0
  115. data/lib/adhearsion/translator/asterisk/channel.rb +43 -0
  116. data/lib/adhearsion/translator/asterisk/component.rb +88 -0
  117. data/lib/adhearsion/translator/asterisk/component/asterisk.rb +15 -0
  118. data/lib/adhearsion/translator/asterisk/component/asterisk/agi_command.rb +42 -0
  119. data/lib/adhearsion/translator/asterisk/component/asterisk/ami_action.rb +68 -0
  120. data/lib/adhearsion/translator/asterisk/component/composed_prompt.rb +76 -0
  121. data/lib/adhearsion/translator/asterisk/component/dtmf_recognizer.rb +137 -0
  122. data/lib/adhearsion/translator/asterisk/component/input.rb +34 -0
  123. data/lib/adhearsion/translator/asterisk/component/input_component.rb +90 -0
  124. data/lib/adhearsion/translator/asterisk/component/mrcp_native_prompt.rb +71 -0
  125. data/lib/adhearsion/translator/asterisk/component/mrcp_prompt.rb +55 -0
  126. data/lib/adhearsion/translator/asterisk/component/mrcp_recog_prompt.rb +165 -0
  127. data/lib/adhearsion/translator/asterisk/component/output.rb +233 -0
  128. data/lib/adhearsion/translator/asterisk/component/record.rb +101 -0
  129. data/lib/adhearsion/translator/asterisk/component/stop_by_redirect.rb +30 -0
  130. data/lib/adhearsion/translator/asterisk/unimrcp_app.rb +28 -0
  131. data/lib/adhearsion/uri_list.rb +21 -0
  132. data/lib/adhearsion/version.rb +1 -1
  133. data/spec/adhearsion/call_controller/dial_spec.rb +79 -1420
  134. data/spec/adhearsion/call_controller/input_spec.rb +1141 -237
  135. data/spec/adhearsion/call_controller/output/async_player_spec.rb +10 -10
  136. data/spec/adhearsion/call_controller/output/player_spec.rb +8 -8
  137. data/spec/adhearsion/call_controller/output_spec.rb +162 -215
  138. data/spec/adhearsion/call_controller/record_spec.rb +15 -16
  139. data/spec/adhearsion/call_controller_spec.rb +23 -40
  140. data/spec/adhearsion/call_spec.rb +123 -129
  141. data/spec/adhearsion/calls_spec.rb +3 -3
  142. data/spec/adhearsion/configuration_spec.rb +94 -108
  143. data/spec/adhearsion/event/answered_spec.rb +50 -0
  144. data/spec/adhearsion/event/asterisk/Find Results +402 -0
  145. data/spec/adhearsion/event/asterisk/ami_spec.rb +81 -0
  146. data/spec/adhearsion/event/complete_spec.rb +176 -0
  147. data/spec/adhearsion/event/dtmf_spec.rb +35 -0
  148. data/spec/adhearsion/event/end_spec.rb +85 -0
  149. data/spec/adhearsion/event/input_timers_started_spec.rb +19 -0
  150. data/spec/adhearsion/event/joined_spec.rb +53 -0
  151. data/spec/adhearsion/event/offer_spec.rb +106 -0
  152. data/spec/adhearsion/event/ringing_spec.rb +50 -0
  153. data/spec/adhearsion/event/started_speaking_spec.rb +37 -0
  154. data/spec/adhearsion/event/stopped_speaking_spec.rb +37 -0
  155. data/spec/adhearsion/event/unjoined_spec.rb +48 -0
  156. data/spec/adhearsion/event/untitled +0 -0
  157. data/spec/adhearsion/events_spec.rb +19 -45
  158. data/spec/adhearsion/initializer_spec.rb +12 -184
  159. data/spec/adhearsion/logging_spec.rb +5 -20
  160. data/spec/adhearsion/outbound_call_spec.rb +13 -13
  161. data/spec/adhearsion/plugin_spec.rb +3 -4
  162. data/spec/adhearsion/protocol_error_spec.rb +91 -0
  163. data/spec/adhearsion/rayo/client/component_registry_spec.rb +26 -0
  164. data/spec/adhearsion/rayo/client_spec.rb +134 -0
  165. data/spec/adhearsion/rayo/command/accept_spec.rb +63 -0
  166. data/spec/adhearsion/rayo/command/answer_spec.rb +73 -0
  167. data/spec/adhearsion/rayo/command/dial_spec.rb +156 -0
  168. data/spec/adhearsion/rayo/command/hangup_spec.rb +63 -0
  169. data/spec/adhearsion/rayo/command/join_spec.rb +158 -0
  170. data/spec/adhearsion/rayo/command/mute_spec.rb +32 -0
  171. data/spec/adhearsion/rayo/command/redirect_spec.rb +89 -0
  172. data/spec/adhearsion/rayo/command/reject_spec.rb +117 -0
  173. data/spec/adhearsion/rayo/command/unjoin_spec.rb +82 -0
  174. data/spec/adhearsion/rayo/command/unmute_spec.rb +32 -0
  175. data/spec/adhearsion/rayo/command_node_spec.rb +101 -0
  176. data/spec/adhearsion/rayo/component/asterisk/agi/command_spec.rb +111 -0
  177. data/spec/adhearsion/rayo/component/asterisk/ami/action_spec.rb +173 -0
  178. data/spec/adhearsion/rayo/component/component_node_spec.rb +110 -0
  179. data/spec/adhearsion/rayo/component/input_spec.rb +715 -0
  180. data/spec/adhearsion/rayo/component/output_spec.rb +1030 -0
  181. data/spec/adhearsion/rayo/component/prompt_spec.rb +171 -0
  182. data/spec/adhearsion/rayo/component/receive_fax_spec.rb +136 -0
  183. data/spec/adhearsion/rayo/component/record_spec.rb +497 -0
  184. data/spec/adhearsion/rayo/component/send_fax_spec.rb +144 -0
  185. data/spec/adhearsion/rayo/connection/asterisk_spec.rb +118 -0
  186. data/spec/adhearsion/rayo/connection/xmpp_spec.rb +449 -0
  187. data/spec/adhearsion/rayo/initializer_spec.rb +353 -0
  188. data/spec/adhearsion/rayo/ref_spec.rb +168 -0
  189. data/spec/adhearsion/rayo_spec.rb +7 -0
  190. data/spec/adhearsion/router/route_spec.rb +1 -1
  191. data/spec/adhearsion/statistics_spec.rb +2 -5
  192. data/spec/adhearsion/translator/asterisk/call_spec.rb +2047 -0
  193. data/spec/adhearsion/translator/asterisk/component/asterisk/agi_command_spec.rb +256 -0
  194. data/spec/adhearsion/translator/asterisk/component/asterisk/ami_action_spec.rb +151 -0
  195. data/spec/adhearsion/translator/asterisk/component/composed_prompt_spec.rb +257 -0
  196. data/spec/adhearsion/translator/asterisk/component/input_spec.rb +571 -0
  197. data/spec/adhearsion/translator/asterisk/component/mrcp_native_prompt_spec.rb +774 -0
  198. data/spec/adhearsion/translator/asterisk/component/mrcp_prompt_spec.rb +1244 -0
  199. data/spec/adhearsion/translator/asterisk/component/output_spec.rb +1850 -0
  200. data/spec/adhearsion/translator/asterisk/component/record_spec.rb +426 -0
  201. data/spec/adhearsion/translator/asterisk/component/stop_by_redirect_spec.rb +62 -0
  202. data/spec/adhearsion/translator/asterisk/component_spec.rb +83 -0
  203. data/spec/adhearsion/translator/asterisk_spec.rb +685 -0
  204. data/spec/adhearsion/uri_list_spec.rb +88 -0
  205. data/spec/adhearsion_spec.rb +89 -14
  206. data/spec/fixtures/locale/en.yml +13 -0
  207. data/spec/fixtures/locale/it.yml +13 -0
  208. data/spec/spec_helper.rb +18 -5
  209. data/spec/support/call_controller_test_helpers.rb +3 -2
  210. data/spec/support/initializer_stubs.rb +3 -1
  211. data/spec/support/punchblock_examples.rb +65 -0
  212. data/spec/support/punchblock_mocks.rb +12 -0
  213. metadata +412 -70
  214. data/features/cli_daemon.feature +0 -20
  215. data/features/cli_restart.feature +0 -52
  216. data/features/cli_stop.feature +0 -50
  217. data/lib/adhearsion/call_controller/menu_dsl.rb +0 -21
  218. data/lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb +0 -26
  219. data/lib/adhearsion/call_controller/menu_dsl/calculated_match.rb +0 -43
  220. data/lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb +0 -45
  221. data/lib/adhearsion/call_controller/menu_dsl/fixnum_match_calculator.rb +0 -11
  222. data/lib/adhearsion/call_controller/menu_dsl/match_calculator.rb +0 -40
  223. data/lib/adhearsion/call_controller/menu_dsl/menu.rb +0 -207
  224. data/lib/adhearsion/call_controller/menu_dsl/menu_builder.rb +0 -92
  225. data/lib/adhearsion/call_controller/menu_dsl/range_match_calculator.rb +0 -60
  226. data/lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb +0 -25
  227. data/lib/adhearsion/call_controller/utility.rb +0 -77
  228. data/lib/adhearsion/foundation/custom_daemonizer.rb +0 -52
  229. data/lib/adhearsion/punchblock_plugin.rb +0 -63
  230. data/scripts/cloc-1.64.pl +0 -10483
  231. data/spec/adhearsion/call_controller/menu_dsl/array_match_calculator_spec.rb +0 -76
  232. data/spec/adhearsion/call_controller/menu_dsl/calculated_match_collection_spec.rb +0 -60
  233. data/spec/adhearsion/call_controller/menu_dsl/calculated_match_spec.rb +0 -61
  234. data/spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb +0 -39
  235. data/spec/adhearsion/call_controller/menu_dsl/match_calculator_spec.rb +0 -17
  236. data/spec/adhearsion/call_controller/menu_dsl/menu_builder_spec.rb +0 -165
  237. data/spec/adhearsion/call_controller/menu_dsl/menu_spec.rb +0 -420
  238. data/spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb +0 -32
  239. data/spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb +0 -40
  240. data/spec/adhearsion/call_controller/utility_spec.rb +0 -90
  241. data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +0 -356
  242. data/spec/adhearsion/punchblock_plugin_spec.rb +0 -59
@@ -17,7 +17,7 @@ module Adhearsion
17
17
  :async => async
18
18
  end
19
19
 
20
- let(:component) { Punchblock::Component::Record.new component_options }
20
+ let(:component) { Adhearsion::Rayo::Component::Record.new component_options }
21
21
  let :stopper_grammar do
22
22
  RubySpeech::GRXML.draw :mode => 'dtmf', :root => 'inputdigits' do
23
23
  rule id: 'inputdigits', scope: 'public' do
@@ -38,7 +38,7 @@ module Adhearsion
38
38
  end
39
39
  end
40
40
  end
41
- let(:input_component) { Punchblock::Component::Input.new mode: :dtmf, grammar: { :value => stopper_grammar } }
41
+ let(:input_component) { Adhearsion::Rayo::Component::Input.new mode: :dtmf, grammar: { :value => stopper_grammar } }
42
42
 
43
43
  subject { Recorder.new controller, options }
44
44
 
@@ -53,7 +53,7 @@ module Adhearsion
53
53
  end
54
54
 
55
55
  let :component do
56
- Punchblock::Component::Record.new :max_duration => 5500,
56
+ Adhearsion::Rayo::Component::Record.new :max_duration => 5500,
57
57
  :initial_timeout => 6500,
58
58
  :final_timeout => 3200
59
59
  end
@@ -102,7 +102,7 @@ module Adhearsion
102
102
  end
103
103
 
104
104
  describe "when the input component completes" do
105
- let(:complete_event) { Punchblock::Event::Complete.new }
105
+ let(:complete_event) { Adhearsion::Event::Complete.new }
106
106
 
107
107
  before do
108
108
  subject.stopper_component.request!
@@ -148,11 +148,11 @@ module Adhearsion
148
148
  end
149
149
 
150
150
  describe "setting completion handlers" do
151
- let(:complete_event) { Punchblock::Event::Complete.new }
151
+ let(:complete_event) { Adhearsion::Event::Complete.new }
152
152
 
153
153
  it "should execute those handlers when recording completes" do
154
154
  foo = double 'foo'
155
- expect(foo).to receive(:call).once.with kind_of(Punchblock::Event::Complete)
155
+ expect(foo).to receive(:call).once.with kind_of(Adhearsion::Event::Complete)
156
156
  subject.handle_record_completion { |e| foo.call e }
157
157
  subject.record_component.trigger_event_handler complete_event
158
158
  end
@@ -170,13 +170,13 @@ module Adhearsion
170
170
  let(:parsed_options) do
171
171
  options.merge(max_duration: max_duration * 1000)
172
172
  end
173
- let(:component) { Punchblock::Component::Record.new parsed_options }
174
- let(:response) { Punchblock::Event::Complete.new }
173
+ let(:component) { Adhearsion::Rayo::Component::Record.new parsed_options }
174
+ let(:response) { Adhearsion::Event::Complete.new }
175
175
 
176
176
  describe "with :async => true and an :on_complete callback" do
177
177
  before do
178
178
  component
179
- expect(Punchblock::Component::Record).to receive(:new).once.with(parsed_options).and_return component
179
+ expect(Adhearsion::Rayo::Component::Record).to receive(:new).once.with(parsed_options).and_return component
180
180
  expect_message_waiting_for_response component
181
181
  @rec = Queue.new
182
182
  subject.record(options.merge(async: true)) { |rec| @rec.push rec }
@@ -196,7 +196,7 @@ module Adhearsion
196
196
  before do
197
197
  TestException = Class.new StandardError
198
198
  component
199
- expect(Punchblock::Component::Record).to receive(:new).once.with({}).and_return component
199
+ expect(Adhearsion::Rayo::Component::Record).to receive(:new).once.with({}).and_return component
200
200
  end
201
201
 
202
202
  it "should pass the exception to the events system" do
@@ -212,14 +212,13 @@ module Adhearsion
212
212
  component.execute!
213
213
  component.trigger_event_handler response
214
214
  expect(latch.wait(1)).to be true
215
- Adhearsion::Events.clear_handlers :exception
216
215
  end
217
216
  end
218
217
 
219
218
  describe "with :async => false" do
220
219
  before do
221
220
  component
222
- expect(Punchblock::Component::Record).to receive(:new).once.with(parsed_options).and_return component
221
+ expect(Adhearsion::Rayo::Component::Record).to receive(:new).once.with(parsed_options).and_return component
223
222
  expect_component_execution component
224
223
  @rec = Queue.new
225
224
  subject.record(options.merge(:async => false)) { |rec| @rec.push rec }
@@ -236,7 +235,7 @@ module Adhearsion
236
235
  end
237
236
 
238
237
  describe "with :interruptible => false" do
239
- let(:input_component) { Punchblock::Component::Input.new }
238
+ let(:input_component) { Adhearsion::Rayo::Component::Input.new }
240
239
  it "does not use an Input component" do
241
240
  expect(subject).to receive(:execute_component_and_await_completion).once.with(component)
242
241
  expect(subject).to receive(:write_and_await_response).never.with(input_component)
@@ -247,12 +246,12 @@ module Adhearsion
247
246
  describe "with :interruptible => true" do
248
247
  it "stops the recording" do
249
248
  def subject.write_and_await_response(input_component)
250
- input_component.trigger_event_handler Punchblock::Event::Complete.new
249
+ input_component.trigger_event_handler Adhearsion::Event::Complete.new
251
250
  end
252
251
 
253
252
  expect_input_component_complete_event 'dtmf-5'
254
253
 
255
- expect_any_instance_of(Punchblock::Component::Record).to receive(:stop!)
254
+ expect_any_instance_of(Adhearsion::Rayo::Component::Record).to receive(:stop!)
256
255
  expect(subject).to receive(:execute_component_and_await_completion).once.with(component)
257
256
  subject.record(options.merge(:async => false, :interruptible => true)) { |rec| @rec.push rec }
258
257
  end
@@ -262,7 +261,7 @@ module Adhearsion
262
261
  describe "check for the return value" do
263
262
  it "returns a Record component" do
264
263
  component
265
- expect(Punchblock::Component::Record).to receive(:new).once.with(parsed_options).and_return component
264
+ expect(Adhearsion::Rayo::Component::Record).to receive(:new).once.with(parsed_options).and_return component
266
265
  expect_component_execution component
267
266
  expect(subject.record(options.merge(:async => false))).to eq(component)
268
267
  component.request!
@@ -300,7 +300,7 @@ module Adhearsion
300
300
  end
301
301
 
302
302
  context "and some fail to terminate" do
303
- before { expect(subject.output1).to receive(:stop!).and_raise(Punchblock::Component::InvalidActionError) }
303
+ before { expect(subject.output1).to receive(:stop!).and_raise(Adhearsion::Rayo::Component::InvalidActionError) }
304
304
 
305
305
  it "should terminate the others" do
306
306
  expect(subject.output2).to receive(:stop!).once
@@ -310,7 +310,7 @@ module Adhearsion
310
310
  end
311
311
 
312
312
  context "when some have completed" do
313
- before { subject.output1.trigger_event_handler Punchblock::Event::Complete.new }
313
+ before { subject.output1.trigger_event_handler Adhearsion::Event::Complete.new }
314
314
 
315
315
  it "should not terminate the completed components" do
316
316
  expect(subject.output1).to receive(:stop!).never
@@ -360,7 +360,7 @@ module Adhearsion
360
360
  end
361
361
 
362
362
  context "and some fail to terminate" do
363
- before { expect(subject.output1).to receive(:stop!).and_raise(Punchblock::Component::InvalidActionError) }
363
+ before { expect(subject.output1).to receive(:stop!).and_raise(Adhearsion::Rayo::Component::InvalidActionError) }
364
364
 
365
365
  it "should terminate the others" do
366
366
  expect(subject.output2).to receive(:stop!).once
@@ -370,7 +370,7 @@ module Adhearsion
370
370
  end
371
371
 
372
372
  context "when some have completed" do
373
- before { subject.output1.trigger_event_handler Punchblock::Event::Complete.new }
373
+ before { subject.output1.trigger_event_handler Adhearsion::Event::Complete.new }
374
374
 
375
375
  it "should not terminate the completed components" do
376
376
  expect(subject.output1).to receive(:stop!).never
@@ -383,7 +383,7 @@ module Adhearsion
383
383
  end
384
384
 
385
385
  describe "#write_and_await_response" do
386
- let(:message) { Punchblock::Command::Accept.new }
386
+ let(:message) { Adhearsion::Rayo::Command::Accept.new }
387
387
 
388
388
  it "delegates to the call, blocking first until it is allowed to execute" do
389
389
  expect(subject).to receive(:block_until_resumed).once.ordered
@@ -393,12 +393,12 @@ module Adhearsion
393
393
 
394
394
  it "allows complete events to bubble" do
395
395
  bubbled = false
396
- message = Punchblock::Component::Output.new
396
+ message = Adhearsion::Rayo::Component::Output.new
397
397
  expect(subject.call).to receive(:write_and_await_response)
398
398
  subject.write_and_await_response message
399
- message.register_event_handler(Punchblock::Event::Complete) { bubbled = true }
399
+ message.register_event_handler(Adhearsion::Event::Complete) { bubbled = true }
400
400
  expect(bubbled).to be false
401
- message.trigger_event_handler Punchblock::Event::Complete.new
401
+ message.trigger_event_handler Adhearsion::Event::Complete.new
402
402
  expect(bubbled).to be true
403
403
  end
404
404
  end
@@ -432,32 +432,32 @@ module Adhearsion
432
432
  describe "#join" do
433
433
  it "delegates to the call, blocking first until it is allowed to execute, and unblocking when an unjoined event is received" do
434
434
  expect(subject).to receive(:block_until_resumed).once.ordered
435
- expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Punchblock::Command::Join.new(call_uri: 'call1'))
435
+ expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Adhearsion::Rayo::Command::Join.new(call_uri: 'call1'))
436
436
  latch = CountDownLatch.new 1
437
437
  Thread.new do
438
438
  subject.join 'call1', :foo => :bar
439
439
  latch.countdown!
440
440
  end
441
441
  expect(latch.wait(1)).to be false
442
- subject.call << Punchblock::Event::Joined.new(call_uri: 'call1')
442
+ subject.call << Adhearsion::Event::Joined.new(call_uri: 'call1')
443
443
  expect(latch.wait(1)).to be false
444
- subject.call << Punchblock::Event::Unjoined.new(call_uri: 'call1')
444
+ subject.call << Adhearsion::Event::Unjoined.new(call_uri: 'call1')
445
445
  expect(latch.wait(1)).to be true
446
446
  end
447
447
 
448
448
  context "with a mixer" do
449
449
  it "delegates to the call, blocking first until it is allowed to execute, and unblocking when an unjoined event is received" do
450
450
  expect(subject).to receive(:block_until_resumed).once.ordered
451
- expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Punchblock::Command::Join.new(mixer_name: 'foobar'))
451
+ expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Adhearsion::Rayo::Command::Join.new(mixer_name: 'foobar'))
452
452
  latch = CountDownLatch.new 1
453
453
  Thread.new do
454
454
  subject.join :mixer_name => 'foobar', :foo => :bar
455
455
  latch.countdown!
456
456
  end
457
457
  expect(latch.wait(1)).to be false
458
- subject.call << Punchblock::Event::Joined.new(:mixer_name => 'foobar')
458
+ subject.call << Adhearsion::Event::Joined.new(:mixer_name => 'foobar')
459
459
  expect(latch.wait(1)).to be false
460
- subject.call << Punchblock::Event::Unjoined.new(:mixer_name => 'foobar')
460
+ subject.call << Adhearsion::Event::Unjoined.new(:mixer_name => 'foobar')
461
461
  expect(latch.wait(1)).to be true
462
462
  end
463
463
  end
@@ -465,28 +465,28 @@ module Adhearsion
465
465
  context "with :async => true" do
466
466
  it "delegates to the call, blocking first until it is allowed to execute, and unblocking when the joined event is received" do
467
467
  expect(subject).to receive(:block_until_resumed).once.ordered
468
- expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Punchblock::Command::Join.new(call_uri: 'call1'))
468
+ expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Adhearsion::Rayo::Command::Join.new(call_uri: 'call1'))
469
469
  latch = CountDownLatch.new 1
470
470
  Thread.new do
471
471
  subject.join 'call1', :foo => :bar, :async => true
472
472
  latch.countdown!
473
473
  end
474
474
  expect(latch.wait(1)).to be false
475
- subject.call << Punchblock::Event::Joined.new(call_uri: 'call1')
475
+ subject.call << Adhearsion::Event::Joined.new(call_uri: 'call1')
476
476
  expect(latch.wait(1)).to be true
477
477
  end
478
478
 
479
479
  context "with a mixer" do
480
480
  it "delegates to the call, blocking first until it is allowed to execute, and unblocking when the joined event is received" do
481
481
  expect(subject).to receive(:block_until_resumed).once.ordered
482
- expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Punchblock::Command::Join.new(mixer_name: 'foobar'))
482
+ expect(call.wrapped_object).to receive(:write_and_await_response).once.ordered.with(Adhearsion::Rayo::Command::Join.new(mixer_name: 'foobar'))
483
483
  latch = CountDownLatch.new 1
484
484
  Thread.new do
485
485
  subject.join :mixer_name => 'foobar', :foo => :bar, :async => true
486
486
  latch.countdown!
487
487
  end
488
488
  expect(latch.wait(1)).to be false
489
- subject.call << Punchblock::Event::Joined.new(:mixer_name => 'foobar')
489
+ subject.call << Adhearsion::Event::Joined.new(:mixer_name => 'foobar')
490
490
  expect(latch.wait(1)).to be true
491
491
  end
492
492
  end
@@ -529,8 +529,8 @@ module Adhearsion
529
529
  end
530
530
 
531
531
  describe "#execute_component_and_await_completion" do
532
- let(:component) { Punchblock::Component::Output.new }
533
- let(:response) { Punchblock::Event::Complete.new }
532
+ let(:component) { Adhearsion::Rayo::Component::Output.new }
533
+ let(:response) { Adhearsion::Event::Complete.new }
534
534
 
535
535
  before do
536
536
  expect_message_of_type_waiting_for_response component
@@ -557,11 +557,11 @@ module Adhearsion
557
557
 
558
558
  describe "with an error response" do
559
559
  let(:response) do
560
- Punchblock::Event::Complete.new :reason => error
560
+ Adhearsion::Event::Complete.new :reason => error
561
561
  end
562
562
 
563
563
  let(:error) do
564
- Punchblock::Event::Complete::Error.new :details => details
564
+ Adhearsion::Event::Complete::Error.new :details => details
565
565
  end
566
566
 
567
567
  let(:details) { "Oh noes, it's all borked" }
@@ -571,24 +571,8 @@ module Adhearsion
571
571
  end
572
572
  end
573
573
 
574
- describe "with complete event with reason hangup" do
575
-
576
- let(:response) do
577
- Punchblock::Event::Complete.new :reason => complete_reason
578
- end
579
-
580
- let(:complete_reason) do
581
- Punchblock::Event::Complete::Hangup.new
582
- end
583
-
584
- it "raises the hangup" do
585
- expect { subject.execute_component_and_await_completion component }.to raise_error(Call::Hangup)
586
- end
587
-
588
- end
589
-
590
574
  it "blocks until the component receives a complete event" do
591
- slow_component = Punchblock::Component::Output.new
575
+ slow_component = Adhearsion::Rayo::Component::Output.new
592
576
  slow_component.request!
593
577
  slow_component.execute!
594
578
  Thread.new do
@@ -701,7 +685,6 @@ describe ExampleCallController do
701
685
  end
702
686
  subject.exec
703
687
  expect(latch.wait(1)).to be true
704
- Adhearsion::Events.clear_handlers :exception
705
688
  end
706
689
 
707
690
  it "should call the requested method when an exception is encountered" do
@@ -20,7 +20,7 @@ module Adhearsion
20
20
  let(:transport) { 'footransport' }
21
21
  let(:base_time) { Time.local(2008, 9, 1, 12, 0, 0) }
22
22
  let :offer do
23
- Punchblock::Event::Offer.new target_call_id: call_id,
23
+ Adhearsion::Event::Offer.new target_call_id: call_id,
24
24
  domain: domain,
25
25
  transport: transport,
26
26
  to: to,
@@ -158,7 +158,7 @@ module Adhearsion
158
158
  end
159
159
 
160
160
  context "when receiving an event with headers" do
161
- let(:event) { Punchblock::Event::End.new :headers => {'X-bar' => 'foo'} }
161
+ let(:event) { Adhearsion::Event::End.new :headers => {'X-bar' => 'foo'} }
162
162
 
163
163
  it "should merge later headers" do
164
164
  subject << event
@@ -166,7 +166,7 @@ module Adhearsion
166
166
  end
167
167
 
168
168
  context "with have symbol names" do
169
- let(:event) { Punchblock::Event::End.new :headers => {:x_bar => 'foo'} }
169
+ let(:event) { Adhearsion::Event::End.new :headers => {:x_bar => 'foo'} }
170
170
 
171
171
  it "should merge later headers" do
172
172
  subject << event
@@ -176,7 +176,7 @@ module Adhearsion
176
176
  end
177
177
 
178
178
  context "when sending a command with headers" do
179
- let(:command) { Punchblock::Command::Accept.new :headers => {'X-bar' => 'foo'} }
179
+ let(:command) { Adhearsion::Rayo::Command::Accept.new :headers => {'X-bar' => 'foo'} }
180
180
 
181
181
  it "should merge later headers" do
182
182
  subject.write_command command
@@ -251,7 +251,7 @@ module Adhearsion
251
251
  describe "for joined events" do
252
252
  context "joined to another call" do
253
253
  let :event do
254
- Punchblock::Event::Joined.new call_uri: 'footransport:foobar@rayo.net'
254
+ Adhearsion::Event::Joined.new call_uri: 'footransport:foobar@rayo.net'
255
255
  end
256
256
 
257
257
  it "should trigger any on_joined callbacks set for the matching call ID" do
@@ -289,7 +289,7 @@ module Adhearsion
289
289
 
290
290
  context "joined to a mixer" do
291
291
  let :event do
292
- Punchblock::Event::Joined.new :mixer_name => 'foobar'
292
+ Adhearsion::Event::Joined.new :mixer_name => 'foobar'
293
293
  end
294
294
 
295
295
  it "should trigger on_joined callbacks for the matching mixer name" do
@@ -329,7 +329,7 @@ module Adhearsion
329
329
  describe "for unjoined events" do
330
330
  context "unjoined from another call" do
331
331
  let :event do
332
- Punchblock::Event::Unjoined.new call_uri: 'footransport:foobar@rayo.net'
332
+ Adhearsion::Event::Unjoined.new call_uri: 'footransport:foobar@rayo.net'
333
333
  end
334
334
 
335
335
  it "should trigger any on_unjoined callbacks set for the matching call ID" do
@@ -367,7 +367,7 @@ module Adhearsion
367
367
 
368
368
  context "unjoined from a mixer" do
369
369
  let :event do
370
- Punchblock::Event::Unjoined.new :mixer_name => 'foobar'
370
+ Adhearsion::Event::Unjoined.new :mixer_name => 'foobar'
371
371
  end
372
372
 
373
373
  it "should trigger on_unjoined callbacks for the matching mixer name" do
@@ -406,7 +406,7 @@ module Adhearsion
406
406
 
407
407
  describe "for end events" do
408
408
  let :event do
409
- Punchblock::Event::End.new :reason => :hangup
409
+ Adhearsion::Event::End.new :reason => :hangup
410
410
  end
411
411
 
412
412
  it "should trigger any on_end callbacks set" do
@@ -434,7 +434,6 @@ module Adhearsion
434
434
  subject.register_event_handler { |e| raise 'foo' }
435
435
  expect { subject << :foo }.not_to raise_error
436
436
  expect(latch.wait(3)).to be true
437
- Adhearsion::Events.clear_handlers :exception
438
437
  end
439
438
  end
440
439
  end
@@ -446,11 +445,11 @@ module Adhearsion
446
445
  before { allow(other_call).to receive_messages uri: other_call_uri }
447
446
 
448
447
  let :joined_event do
449
- Punchblock::Event::Joined.new call_uri: other_call_uri
448
+ Adhearsion::Event::Joined.new call_uri: other_call_uri
450
449
  end
451
450
 
452
451
  let :unjoined_event do
453
- Punchblock::Event::Unjoined.new call_uri: other_call_uri
452
+ Adhearsion::Event::Unjoined.new call_uri: other_call_uri
454
453
  end
455
454
 
456
455
  context "when we know about the joined call" do
@@ -552,25 +551,9 @@ module Adhearsion
552
551
  end
553
552
 
554
553
  describe "#<<" do
555
- describe "with a Punchblock Complete Event and Reason Hangup" do
556
- let :complete_event do
557
- Punchblock::Event::Complete.new :reason => Punchblock::Event::Complete::Hangup.new
558
- end
559
-
560
- it "should mark the call as terminating" do
561
- subject << complete_event
562
- expect(subject.terminating?).to be true
563
- end
564
- end
565
-
566
- describe "with a Punchblock End" do
554
+ describe "with an End event" do
567
555
  let :end_event do
568
- Punchblock::Event::End.new :reason => :hangup, :platform_code => 'arbitrary_code'
569
- end
570
-
571
- it "should mark the call as terminating" do
572
- subject << end_event
573
- expect(subject.terminating?).to be true
556
+ Adhearsion::Event::End.new :reason => :hangup, :platform_code => 'arbitrary_code'
574
557
  end
575
558
 
576
559
  it "should mark the call as ended" do
@@ -618,7 +601,7 @@ module Adhearsion
618
601
  end
619
602
 
620
603
  it "should instruct the command registry to terminate" do
621
- command = Punchblock::Command::Answer.new
604
+ command = Adhearsion::Rayo::Command::Answer.new
622
605
  command.request!
623
606
  subject.future.write_and_await_response command
624
607
  subject << end_event
@@ -637,16 +620,16 @@ module Adhearsion
637
620
 
638
621
  context "with no custom lifetime" do
639
622
  around do |example|
640
- old_val = Adhearsion.config.platform.after_hangup_lifetime
623
+ old_val = Adhearsion.config.core.after_hangup_lifetime
641
624
  begin
642
625
  example.run
643
626
  rescue
644
- Adhearsion.config.platform.after_hangup_lifetime = old_val
627
+ Adhearsion.config.core.after_hangup_lifetime = old_val
645
628
  end
646
629
  end
647
630
 
648
631
  it "shuts down the actor using platform config" do
649
- Adhearsion.config.platform.after_hangup_lifetime = 2
632
+ Adhearsion.config.core.after_hangup_lifetime = 2
650
633
  subject << end_event
651
634
  sleep 2.1
652
635
  expect(subject.alive?).to be false
@@ -656,16 +639,16 @@ module Adhearsion
656
639
 
657
640
  context "with a custom lifetime" do
658
641
  around do |example|
659
- old_val = Adhearsion.config.platform.after_hangup_lifetime
642
+ old_val = Adhearsion.config.core.after_hangup_lifetime
660
643
  begin
661
644
  example.run
662
645
  rescue
663
- Adhearsion.config.platform.after_hangup_lifetime = old_val
646
+ Adhearsion.config.core.after_hangup_lifetime = old_val
664
647
  end
665
648
  end
666
649
 
667
650
  it "shuts down the actor using the Call#after_hangup_lifetime" do
668
- Adhearsion.config.platform.after_hangup_lifetime = 1
651
+ Adhearsion.config.core.after_hangup_lifetime = 1
669
652
  subject.after_hangup_lifetime = 2
670
653
  subject << end_event
671
654
  sleep 1.1
@@ -680,7 +663,7 @@ module Adhearsion
680
663
 
681
664
  describe "#wait_for_end" do
682
665
  let :end_event do
683
- Punchblock::Event::End.new reason: :hangup
666
+ Adhearsion::Event::End.new reason: :hangup
684
667
  end
685
668
 
686
669
  context "when the call has already ended" do
@@ -702,6 +685,18 @@ module Adhearsion
702
685
 
703
686
  expect(fut.value).to eq(:hangup)
704
687
  end
688
+
689
+ it "should unblock after a timeout" do
690
+ fut = subject.future.wait_for_end 1
691
+
692
+ sleep 0.5
693
+ expect(fut).not_to be_ready
694
+
695
+ sleep 0.5
696
+
697
+ expect { fut.value }.to raise_error(Celluloid::ConditionError)
698
+ expect(subject.alive?).to be(true)
699
+ end
705
700
  end
706
701
  end
707
702
 
@@ -753,11 +748,11 @@ module Adhearsion
753
748
  end
754
749
 
755
750
  describe "#write_command" do
756
- let(:command) { Punchblock::Command::Answer.new }
751
+ let(:command) { Adhearsion::Rayo::Command::Answer.new }
757
752
 
758
- it "should write the command to the Punchblock connection" do
753
+ it "should write the command to the Rayo connection" do
759
754
  expect(subject.wrapped_object).to receive(:client).once.and_return mock_client
760
- expect(mock_client).to receive(:execute_command).once.with(Punchblock::Command::Answer.new(target_call_id: call_id, domain: domain)).and_return true
755
+ expect(mock_client).to receive(:execute_command).once.with(Adhearsion::Rayo::Command::Answer.new(target_call_id: call_id, domain: domain)).and_return true
761
756
  subject.write_command command
762
757
  end
763
758
 
@@ -771,7 +766,7 @@ module Adhearsion
771
766
  end
772
767
 
773
768
  describe "if the command is a Hangup" do
774
- let(:command) { Punchblock::Command::Hangup.new }
769
+ let(:command) { Adhearsion::Rayo::Command::Hangup.new }
775
770
 
776
771
  it "should not raise a Hangup exception" do
777
772
  expect { subject.write_command command }.not_to raise_error
@@ -781,7 +776,7 @@ module Adhearsion
781
776
  end
782
777
 
783
778
  describe '#write_and_await_response' do
784
- let(:message) { Punchblock::Command::Accept.new }
779
+ let(:message) { Adhearsion::Rayo::Command::Accept.new }
785
780
  let(:response) { :foo }
786
781
 
787
782
  before do
@@ -800,7 +795,7 @@ module Adhearsion
800
795
  end
801
796
 
802
797
  it "blocks until a response is received" do
803
- slow_command = Punchblock::Command::Dial.new
798
+ slow_command = Adhearsion::Rayo::Command::Dial.new
804
799
  slow_command.request!
805
800
  Thread.new do
806
801
  sleep 0.5
@@ -812,7 +807,7 @@ module Adhearsion
812
807
  end
813
808
 
814
809
  context "while waiting for a response" do
815
- let(:slow_command) { Punchblock::Command::Dial.new }
810
+ let(:slow_command) { Adhearsion::Rayo::Command::Dial.new }
816
811
 
817
812
  before { slow_command.request! }
818
813
 
@@ -838,7 +833,7 @@ module Adhearsion
838
833
  end
839
834
 
840
835
  describe "with an error response" do
841
- let(:new_exception) { Punchblock::ProtocolError }
836
+ let(:new_exception) { Adhearsion::ProtocolError }
842
837
  let(:response) { new_exception.new }
843
838
 
844
839
  it "raises the error" do
@@ -872,7 +867,7 @@ module Adhearsion
872
867
  end
873
868
 
874
869
  describe "#send_message" do
875
- it "should send a message through the Punchblock connection using the call ID and domain" do
870
+ it "should send a message through the Rayo connection using the call ID and domain" do
876
871
  expect(subject.wrapped_object).to receive(:client).once.and_return mock_client
877
872
  expect(mock_client).to receive(:send_message).once.with(subject.id, subject.domain, "Hello World!", {})
878
873
  subject.send_message "Hello World!"
@@ -899,7 +894,7 @@ module Adhearsion
899
894
  describe '#accept' do
900
895
  describe "with no headers" do
901
896
  it 'should send an Accept message' do
902
- expect_message_waiting_for_response Punchblock::Command::Accept.new
897
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Accept.new
903
898
  subject.accept
904
899
  end
905
900
  end
@@ -907,14 +902,14 @@ module Adhearsion
907
902
  describe "with headers set" do
908
903
  it 'should send an Accept message with the correct headers' do
909
904
  headers = {:foo => 'bar'}
910
- expect_message_waiting_for_response Punchblock::Command::Accept.new(:headers => headers)
905
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Accept.new(:headers => headers)
911
906
  subject.accept headers
912
907
  end
913
908
  end
914
909
 
915
910
  describe "a second time" do
916
911
  it "should only send one Accept message" do
917
- expect_message_waiting_for_response Punchblock::Command::Accept.new
912
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Accept.new
918
913
  subject.accept
919
914
  subject.accept
920
915
  end
@@ -922,8 +917,8 @@ module Adhearsion
922
917
 
923
918
  context "with a failure response" do
924
919
  it 'should raise the error but not crash the actor' do
925
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
926
- expect_message_waiting_for_response Punchblock::Command::Accept.new, error
920
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
921
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Accept.new, error
927
922
  expect { subject.accept }.to raise_error error
928
923
  sleep 0.2
929
924
  expect(subject.alive?).to be true
@@ -934,7 +929,7 @@ module Adhearsion
934
929
  describe '#answer' do
935
930
  describe "with no headers" do
936
931
  it 'should send an Answer message' do
937
- expect_message_waiting_for_response Punchblock::Command::Answer.new
932
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Answer.new
938
933
  subject.answer
939
934
  end
940
935
  end
@@ -942,15 +937,15 @@ module Adhearsion
942
937
  describe "with headers set" do
943
938
  it 'should send an Answer message with the correct headers' do
944
939
  headers = {:foo => 'bar'}
945
- expect_message_waiting_for_response Punchblock::Command::Answer.new(:headers => headers)
940
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Answer.new(:headers => headers)
946
941
  subject.answer headers
947
942
  end
948
943
  end
949
944
 
950
945
  context "with a failure response" do
951
946
  it 'should raise the error but not crash the actor' do
952
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
953
- expect_message_waiting_for_response Punchblock::Command::Answer.new, error
947
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
948
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Answer.new, error
954
949
  expect { subject.answer }.to raise_error error
955
950
  sleep 0.2
956
951
  expect(subject.alive?).to be true
@@ -961,14 +956,14 @@ module Adhearsion
961
956
  describe '#reject' do
962
957
  describe "with a reason given" do
963
958
  it 'should send a Reject message with the correct reason' do
964
- expect_message_waiting_for_response Punchblock::Command::Reject.new(:reason => :decline)
959
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Reject.new(:reason => :decline)
965
960
  subject.reject :decline
966
961
  end
967
962
  end
968
963
 
969
964
  describe "with no reason given" do
970
965
  it 'should send a Reject message with the reason busy' do
971
- expect_message_waiting_for_response Punchblock::Command::Reject.new(:reason => :busy)
966
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Reject.new(:reason => :busy)
972
967
  subject.reject
973
968
  end
974
969
  end
@@ -976,7 +971,7 @@ module Adhearsion
976
971
  describe "with no headers" do
977
972
  it 'should send a Reject message' do
978
973
  expect_message_waiting_for_response do |c|
979
- c.is_a?(Punchblock::Command::Reject) && c.headers == {}
974
+ c.is_a?(Adhearsion::Rayo::Command::Reject) && c.headers == {}
980
975
  end
981
976
  subject.reject
982
977
  end
@@ -986,22 +981,22 @@ module Adhearsion
986
981
  it 'should send a Hangup message with the correct headers' do
987
982
  headers = {:foo => 'bar'}
988
983
  expect_message_waiting_for_response do |c|
989
- c.is_a?(Punchblock::Command::Reject) && c.headers == headers
984
+ c.is_a?(Adhearsion::Rayo::Command::Reject) && c.headers == headers
990
985
  end
991
986
  subject.reject nil, headers
992
987
  end
993
988
  end
994
989
 
995
990
  it "should immediately fire the :call_rejected event giving the call and the reason" do
996
- expect_message_waiting_for_response kind_of(Punchblock::Command::Reject)
991
+ expect_message_waiting_for_response kind_of(Adhearsion::Rayo::Command::Reject)
997
992
  expect(Adhearsion::Events).to receive(:trigger_immediately).once.with(:call_rejected, :call => subject, :reason => :decline)
998
993
  subject.reject :decline
999
994
  end
1000
995
 
1001
996
  context "with a failure response" do
1002
997
  it 'should raise the error but not crash the actor' do
1003
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1004
- expect_message_waiting_for_response Punchblock::Command::Reject.new(reason: :busy), error
998
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
999
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Reject.new(reason: :busy), error
1005
1000
  expect { subject.reject }.to raise_error error
1006
1001
  sleep 0.2
1007
1002
  expect(subject.alive?).to be true
@@ -1012,7 +1007,7 @@ module Adhearsion
1012
1007
  describe '#redirect' do
1013
1008
  describe "with a target given" do
1014
1009
  it 'should send a Redirect message with the correct target' do
1015
- expect_message_waiting_for_response Punchblock::Command::Redirect.new(to: 'sip:foo@bar.com')
1010
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Redirect.new(to: 'sip:foo@bar.com')
1016
1011
  subject.redirect 'sip:foo@bar.com'
1017
1012
  end
1018
1013
  end
@@ -1026,7 +1021,7 @@ module Adhearsion
1026
1021
  describe "with no headers" do
1027
1022
  it 'should send a Redirect message' do
1028
1023
  expect_message_waiting_for_response do |c|
1029
- c.is_a?(Punchblock::Command::Redirect) && c.headers == {}
1024
+ c.is_a?(Adhearsion::Rayo::Command::Redirect) && c.headers == {}
1030
1025
  end
1031
1026
  subject.redirect 'sip:foo@bar.com'
1032
1027
  end
@@ -1036,7 +1031,7 @@ module Adhearsion
1036
1031
  it 'should send a Redirect message with the correct headers' do
1037
1032
  headers = {:foo => 'bar'}
1038
1033
  expect_message_waiting_for_response do |c|
1039
- c.is_a?(Punchblock::Command::Redirect) && c.headers == headers
1034
+ c.is_a?(Adhearsion::Rayo::Command::Redirect) && c.headers == headers
1040
1035
  end
1041
1036
  subject.redirect 'sip:foo@bar.com', headers
1042
1037
  end
@@ -1044,8 +1039,8 @@ module Adhearsion
1044
1039
 
1045
1040
  context "with a failure response" do
1046
1041
  it 'should raise the error but not crash the actor' do
1047
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1048
- expect_message_waiting_for_response Punchblock::Command::Redirect.new(to: 'sip:foo@bar.com'), error
1042
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
1043
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Redirect.new(to: 'sip:foo@bar.com'), error
1049
1044
  expect { subject.redirect 'sip:foo@bar.com' }.to raise_error error
1050
1045
  sleep 0.2
1051
1046
  expect(subject.alive?).to be true
@@ -1067,14 +1062,14 @@ module Adhearsion
1067
1062
 
1068
1063
  describe "if the call is active" do
1069
1064
  it "should mark the call inactive" do
1070
- expect_message_waiting_for_response Punchblock::Command::Hangup.new
1065
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Hangup.new
1071
1066
  subject.hangup
1072
1067
  expect(subject).not_to be_active
1073
1068
  end
1074
1069
 
1075
1070
  describe "with no headers" do
1076
1071
  it 'should send a Hangup message' do
1077
- expect_message_waiting_for_response Punchblock::Command::Hangup.new
1072
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Hangup.new
1078
1073
  subject.hangup
1079
1074
  end
1080
1075
  end
@@ -1082,7 +1077,7 @@ module Adhearsion
1082
1077
  describe "with headers set" do
1083
1078
  it 'should send a Hangup message with the correct headers' do
1084
1079
  headers = {:foo => 'bar'}
1085
- expect_message_waiting_for_response Punchblock::Command::Hangup.new(:headers => headers)
1080
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Hangup.new(:headers => headers)
1086
1081
  subject.hangup headers
1087
1082
  end
1088
1083
  end
@@ -1090,8 +1085,8 @@ module Adhearsion
1090
1085
 
1091
1086
  context "with a failure response" do
1092
1087
  it 'should raise the error but not crash the actor' do
1093
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1094
- expect_message_waiting_for_response Punchblock::Command::Hangup.new, error
1088
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
1089
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Hangup.new, error
1095
1090
  expect { subject.hangup }.to raise_error error
1096
1091
  sleep 0.2
1097
1092
  expect(subject.alive?).to be true
@@ -1101,7 +1096,7 @@ module Adhearsion
1101
1096
 
1102
1097
  describe "#join" do
1103
1098
  def expect_join_with_options(options = {})
1104
- Punchblock::Command::Join.new(options).tap do |join|
1099
+ Adhearsion::Rayo::Command::Join.new(options).tap do |join|
1105
1100
  expect_message_waiting_for_response join
1106
1101
  end
1107
1102
  end
@@ -1129,7 +1124,7 @@ module Adhearsion
1129
1124
  it "should return the command" do
1130
1125
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1131
1126
  result = subject.join target, :media => :bridge, :direction => :recv
1132
- expect(result[:command]).to be_a Punchblock::Command::Join
1127
+ expect(result[:command]).to be_a Adhearsion::Rayo::Command::Join
1133
1128
  expect(result[:command].call_uri).to eql(uri)
1134
1129
  expect(result[:command].media).to eql(:bridge)
1135
1130
  expect(result[:command].direction).to eql(:recv)
@@ -1141,7 +1136,7 @@ module Adhearsion
1141
1136
 
1142
1137
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1143
1138
 
1144
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1139
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1145
1140
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1146
1141
  end
1147
1142
 
@@ -1151,10 +1146,10 @@ module Adhearsion
1151
1146
 
1152
1147
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1153
1148
 
1154
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1149
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1155
1150
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1156
1151
 
1157
- subject << Punchblock::Event::Unjoined.new(call_uri: uri)
1152
+ subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
1158
1153
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1159
1154
  end
1160
1155
 
@@ -1165,7 +1160,7 @@ module Adhearsion
1165
1160
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1166
1161
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1167
1162
 
1168
- subject << Punchblock::Event::End.new
1163
+ subject << Adhearsion::Event::End.new
1169
1164
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1170
1165
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1171
1166
  end
@@ -1174,18 +1169,18 @@ module Adhearsion
1174
1169
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1175
1170
  result = subject.join target, :media => :bridge, :direction => :recv
1176
1171
 
1177
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1178
- subject << Punchblock::Event::Unjoined.new(call_uri: uri)
1172
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1173
+ subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
1179
1174
 
1180
- subject << Punchblock::Event::End.new
1175
+ subject << Adhearsion::Event::End.new
1181
1176
  end
1182
1177
 
1183
1178
  it "should not error if multiple joined events are received for the same join" do
1184
1179
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1185
1180
  result = subject.join target, :media => :bridge, :direction => :recv
1186
1181
 
1187
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1188
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1182
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1183
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1189
1184
 
1190
1185
  expect(subject).to be_alive
1191
1186
  end
@@ -1210,7 +1205,7 @@ module Adhearsion
1210
1205
  it "should return the command" do
1211
1206
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1212
1207
  result = subject.join target, :media => :bridge, :direction => :recv
1213
- expect(result[:command]).to be_a Punchblock::Command::Join
1208
+ expect(result[:command]).to be_a Adhearsion::Rayo::Command::Join
1214
1209
  expect(result[:command].call_uri).to eql(uri)
1215
1210
  expect(result[:command].media).to eql(:bridge)
1216
1211
  expect(result[:command].direction).to eql(:recv)
@@ -1222,7 +1217,7 @@ module Adhearsion
1222
1217
 
1223
1218
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1224
1219
 
1225
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1220
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1226
1221
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1227
1222
  end
1228
1223
 
@@ -1232,10 +1227,10 @@ module Adhearsion
1232
1227
 
1233
1228
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1234
1229
 
1235
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1230
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1236
1231
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1237
1232
 
1238
- subject << Punchblock::Event::Unjoined.new(call_uri: uri)
1233
+ subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
1239
1234
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1240
1235
  end
1241
1236
 
@@ -1246,7 +1241,7 @@ module Adhearsion
1246
1241
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1247
1242
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1248
1243
 
1249
- subject << Punchblock::Event::End.new
1244
+ subject << Adhearsion::Event::End.new
1250
1245
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1251
1246
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1252
1247
  end
@@ -1255,18 +1250,18 @@ module Adhearsion
1255
1250
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1256
1251
  result = subject.join target, :media => :bridge, :direction => :recv
1257
1252
 
1258
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1259
- subject << Punchblock::Event::Unjoined.new(call_uri: uri)
1253
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1254
+ subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
1260
1255
 
1261
- subject << Punchblock::Event::End.new
1256
+ subject << Adhearsion::Event::End.new
1262
1257
  end
1263
1258
 
1264
1259
  it "should not error if multiple joined events are received for the same join" do
1265
1260
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1266
1261
  result = subject.join target, :media => :bridge, :direction => :recv
1267
1262
 
1268
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1269
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1263
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1264
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1270
1265
 
1271
1266
  expect(subject).to be_alive
1272
1267
  end
@@ -1292,7 +1287,7 @@ module Adhearsion
1292
1287
  it "should return the command" do
1293
1288
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1294
1289
  result = subject.join target.merge({:media => :bridge, :direction => :recv})
1295
- expect(result[:command]).to be_a Punchblock::Command::Join
1290
+ expect(result[:command]).to be_a Adhearsion::Rayo::Command::Join
1296
1291
  expect(result[:command].call_uri).to eql(uri)
1297
1292
  expect(result[:command].media).to eql(:bridge)
1298
1293
  expect(result[:command].direction).to eql(:recv)
@@ -1304,7 +1299,7 @@ module Adhearsion
1304
1299
 
1305
1300
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1306
1301
 
1307
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1302
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1308
1303
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1309
1304
  end
1310
1305
 
@@ -1314,10 +1309,10 @@ module Adhearsion
1314
1309
 
1315
1310
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1316
1311
 
1317
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1312
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1318
1313
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1319
1314
 
1320
- subject << Punchblock::Event::Unjoined.new(call_uri: uri)
1315
+ subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
1321
1316
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1322
1317
  end
1323
1318
 
@@ -1328,7 +1323,7 @@ module Adhearsion
1328
1323
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1329
1324
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1330
1325
 
1331
- subject << Punchblock::Event::End.new
1326
+ subject << Adhearsion::Event::End.new
1332
1327
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1333
1328
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1334
1329
  end
@@ -1337,18 +1332,18 @@ module Adhearsion
1337
1332
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1338
1333
  result = subject.join target.merge({:media => :bridge, :direction => :recv})
1339
1334
 
1340
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1341
- subject << Punchblock::Event::Unjoined.new(call_uri: uri)
1335
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1336
+ subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
1342
1337
 
1343
- subject << Punchblock::Event::End.new
1338
+ subject << Adhearsion::Event::End.new
1344
1339
  end
1345
1340
 
1346
1341
  it "should not error if multiple joined events are received for the same join" do
1347
1342
  expect_join_with_options :call_id => uri, :media => :bridge, :direction => :recv
1348
1343
  result = subject.join target.merge({:media => :bridge, :direction => :recv})
1349
1344
 
1350
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1351
- subject << Punchblock::Event::Joined.new(call_uri: uri)
1345
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1346
+ subject << Adhearsion::Event::Joined.new(call_uri: uri)
1352
1347
 
1353
1348
  expect(subject).to be_alive
1354
1349
  end
@@ -1373,7 +1368,7 @@ module Adhearsion
1373
1368
  it "should return the command" do
1374
1369
  expect_join_with_options :mixer_name => mixer_name, :media => :bridge, :direction => :recv
1375
1370
  result = subject.join target.merge({:media => :bridge, :direction => :recv})
1376
- expect(result[:command]).to be_a Punchblock::Command::Join
1371
+ expect(result[:command]).to be_a Adhearsion::Rayo::Command::Join
1377
1372
  expect(result[:command].mixer_name).to eql(mixer_name)
1378
1373
  expect(result[:command].media).to eql(:bridge)
1379
1374
  expect(result[:command].direction).to eql(:recv)
@@ -1385,7 +1380,7 @@ module Adhearsion
1385
1380
 
1386
1381
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1387
1382
 
1388
- subject << Punchblock::Event::Joined.new(mixer_name: mixer_name)
1383
+ subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
1389
1384
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1390
1385
  end
1391
1386
 
@@ -1395,10 +1390,10 @@ module Adhearsion
1395
1390
 
1396
1391
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1397
1392
 
1398
- subject << Punchblock::Event::Joined.new(mixer_name: mixer_name)
1393
+ subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
1399
1394
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1400
1395
 
1401
- subject << Punchblock::Event::Unjoined.new(mixer_name: mixer_name)
1396
+ subject << Adhearsion::Event::Unjoined.new(mixer_name: mixer_name)
1402
1397
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1403
1398
  end
1404
1399
 
@@ -1409,7 +1404,7 @@ module Adhearsion
1409
1404
  expect(result[:joined_condition].wait(0.5)).to be_falsey
1410
1405
  expect(result[:unjoined_condition].wait(0.5)).to be_falsey
1411
1406
 
1412
- subject << Punchblock::Event::End.new
1407
+ subject << Adhearsion::Event::End.new
1413
1408
  expect(result[:joined_condition].wait(0.5)).to be_truthy
1414
1409
  expect(result[:unjoined_condition].wait(0.5)).to be_truthy
1415
1410
  end
@@ -1418,18 +1413,18 @@ module Adhearsion
1418
1413
  expect_join_with_options :mixer_name => mixer_name, :media => :bridge, :direction => :recv
1419
1414
  result = subject.join target.merge({:media => :bridge, :direction => :recv})
1420
1415
 
1421
- subject << Punchblock::Event::Joined.new(mixer_name: mixer_name)
1422
- subject << Punchblock::Event::Unjoined.new(mixer_name: mixer_name)
1416
+ subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
1417
+ subject << Adhearsion::Event::Unjoined.new(mixer_name: mixer_name)
1423
1418
 
1424
- subject << Punchblock::Event::End.new
1419
+ subject << Adhearsion::Event::End.new
1425
1420
  end
1426
1421
 
1427
1422
  it "should not error if multiple joined events are received for the same join" do
1428
1423
  expect_join_with_options :mixer_name => mixer_name, :media => :bridge, :direction => :recv
1429
1424
  result = subject.join target.merge({:media => :bridge, :direction => :recv})
1430
1425
 
1431
- subject << Punchblock::Event::Joined.new(mixer_name: mixer_name)
1432
- subject << Punchblock::Event::Joined.new(mixer_name: mixer_name)
1426
+ subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
1427
+ subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
1433
1428
 
1434
1429
  expect(subject).to be_alive
1435
1430
  end
@@ -1447,8 +1442,8 @@ module Adhearsion
1447
1442
 
1448
1443
  context "with a failure response" do
1449
1444
  it 'should raise the error but not crash the actor' do
1450
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1451
- expect_message_waiting_for_response Punchblock::Command::Join.new(call_id: 'footransport:foo@rayo.net'), error
1445
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
1446
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Join.new(call_id: 'footransport:foo@rayo.net'), error
1452
1447
  expect { subject.join 'foo' }.to raise_error error
1453
1448
  sleep 0.2
1454
1449
  expect(subject.alive?).to be true
@@ -1458,7 +1453,7 @@ module Adhearsion
1458
1453
 
1459
1454
  describe "#unjoin" do
1460
1455
  def expect_unjoin_with_options(options = {})
1461
- Punchblock::Command::Unjoin.new(options).tap do |unjoin|
1456
+ Adhearsion::Rayo::Command::Unjoin.new(options).tap do |unjoin|
1462
1457
  expect_message_waiting_for_response unjoin
1463
1458
  end
1464
1459
  end
@@ -1525,8 +1520,8 @@ module Adhearsion
1525
1520
 
1526
1521
  context "with a failure response" do
1527
1522
  it 'should raise the error but not crash the actor' do
1528
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1529
- expect_message_waiting_for_response Punchblock::Command::Unjoin.new(call_id: 'footransport:foo@rayo.net'), error
1523
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
1524
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Unjoin.new(call_id: 'footransport:foo@rayo.net'), error
1530
1525
  expect { subject.unjoin 'foo' }.to raise_error error
1531
1526
  sleep 0.2
1532
1527
  expect(subject.alive?).to be true
@@ -1536,14 +1531,14 @@ module Adhearsion
1536
1531
 
1537
1532
  describe "#mute" do
1538
1533
  it 'should send a Mute message' do
1539
- expect_message_waiting_for_response Punchblock::Command::Mute.new
1534
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Mute.new
1540
1535
  subject.mute
1541
1536
  end
1542
1537
 
1543
1538
  context "with a failure response" do
1544
1539
  it 'should raise the error but not crash the actor' do
1545
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1546
- expect_message_waiting_for_response Punchblock::Command::Mute.new, error
1540
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
1541
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Mute.new, error
1547
1542
  expect { subject.mute }.to raise_error error
1548
1543
  sleep 0.2
1549
1544
  expect(subject.alive?).to be true
@@ -1553,14 +1548,14 @@ module Adhearsion
1553
1548
 
1554
1549
  describe "#unmute" do
1555
1550
  it 'should send a Mute message' do
1556
- expect_message_waiting_for_response Punchblock::Command::Unmute.new
1551
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Unmute.new
1557
1552
  subject.unmute
1558
1553
  end
1559
1554
 
1560
1555
  context "with a failure response" do
1561
1556
  it 'should raise the error but not crash the actor' do
1562
- error = Punchblock::ProtocolError.new.setup(:service_unavailable)
1563
- expect_message_waiting_for_response Punchblock::Command::Unmute.new, error
1557
+ error = Adhearsion::ProtocolError.new.setup(:service_unavailable)
1558
+ expect_message_waiting_for_response Adhearsion::Rayo::Command::Unmute.new, error
1564
1559
  expect { subject.unmute }.to raise_error error
1565
1560
  sleep 0.2
1566
1561
  expect(subject.alive?).to be true
@@ -1604,7 +1599,6 @@ module Adhearsion
1604
1599
  end
1605
1600
  subject.execute_controller BrokenController.new(subject), lambda { |call| latch.countdown! }
1606
1601
  expect(latch.wait(3)).to be true
1607
- Adhearsion::Events.clear_handlers :exception
1608
1602
  end
1609
1603
 
1610
1604
  it "should execute a callback after the controller executes" do
@@ -1687,13 +1681,13 @@ module Adhearsion
1687
1681
  describe "#terminate" do
1688
1682
  let :commands do
1689
1683
  [
1690
- Punchblock::Command::Answer.new,
1691
- Punchblock::Command::Answer.new
1684
+ Adhearsion::Rayo::Command::Answer.new,
1685
+ Adhearsion::Rayo::Command::Answer.new
1692
1686
  ]
1693
1687
  end
1694
1688
 
1695
1689
  it "should set each command's response to an instance of Adhearsion::Hangup if it doesn't already have a response" do
1696
- finished_command = Punchblock::Command::Answer.new
1690
+ finished_command = Adhearsion::Rayo::Command::Answer.new
1697
1691
  finished_command.request!
1698
1692
  finished_command.response = :foo
1699
1693
  subject << finished_command