adhearsion 2.3.1 → 2.3.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/adhearsion.gemspec +2 -2
- data/features/cli_create.feature +1 -1
- data/features/step_definitions/cli_steps.rb +0 -8
- data/lib/adhearsion/call_controller.rb +12 -1
- data/lib/adhearsion/call_controller/output/formatter.rb +2 -5
- data/lib/adhearsion/generators/app/templates/README.md +2 -0
- data/lib/adhearsion/punchblock_plugin/initializer.rb +1 -1
- data/lib/adhearsion/router/route.rb +2 -2
- data/lib/adhearsion/version.rb +1 -1
- data/spec/adhearsion/call_controller/input_spec.rb +7 -7
- data/spec/adhearsion/call_controller_spec.rb +43 -0
- data/spec/adhearsion/outbound_call_spec.rb +2 -3
- data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +2 -1
- data/spec/adhearsion/router/route_spec.rb +38 -1
- data/spec/support/call_controller_test_helpers.rb +2 -1
- metadata +8 -10
- data/features/support/aruba_helper.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab3c831d82fb4d801c196646eb3fd399637c26b3
|
4
|
+
data.tar.gz: 690e4fbb38d071cd8eb46458301c66324a9b340b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4319a75bd1f3b55a629231e4aa5db96d69f0584f8288a29eb691278dc577eff0d186a56203df6b73c324f9835365b271f8af2368c585cdbc6f4b017e0e3d286
|
7
|
+
data.tar.gz: 8b1de59e7c0db84375687fd91ac2e2d1af2cdd4e715b1e4b3fa3902c70eaf6b6bdf8569ce166af2792f98f4d96a46b946582bc7531cc314c7f2b11c788d88fb5
|
data/.travis.yml
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
language: ruby
|
2
|
-
script: bundle exec rake --trace
|
3
2
|
rvm:
|
4
3
|
- 1.9.2
|
5
4
|
- 1.9.3
|
@@ -11,6 +10,7 @@ matrix:
|
|
11
10
|
allow_failures:
|
12
11
|
- rvm: rbx-19mode
|
13
12
|
- rvm: ruby-head
|
13
|
+
- rvm: jruby-19mode
|
14
14
|
env: ARUBA_TIMEOUT=120 RAILS_ENV=development AHN_ENV=development
|
15
15
|
notifications:
|
16
16
|
irc: "irc.freenode.org#adhearsion"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/adhearsion)
|
2
2
|
|
3
|
+
# [2.3.2](https://github.com/adhearsion/adhearsion/compare/v2.3.1...v2.3.2) - [2013-05-03](https://rubygems.org/gems/adhearsion/versions/2.3.2)
|
4
|
+
* Bugfix: Correctly register readiness to handle calls with VoIP platform.
|
5
|
+
* Bugfix: Don't raise when the router tries to clear up after a CallController which outlived its Call actor.
|
6
|
+
* Bugfix: Don't share metadata between all controllers invoked by a route. This was causing concurrent mutation bugs and all sorts of weirdness.
|
7
|
+
* Bugfix: Ensure that a CallController can still log safely even if its Call (and therefore scoped logger) is gone.
|
8
|
+
* Bugfix: Fix some spec false positives and failures due to dependency changes.
|
9
|
+
|
3
10
|
# [2.3.1](https://github.com/adhearsion/adhearsion/compare/v2.3.0...v2.3.1) - [2013-03-28](https://rubygems.org/gems/adhearsion/versions/2.3.1)
|
4
11
|
* Bugfix: Fix a leftover Celluloid deprecation warning
|
5
12
|
|
data/adhearsion.gemspec
CHANGED
@@ -33,9 +33,9 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_runtime_dependency 'punchblock', ["~> 1.4"]
|
34
34
|
s.add_runtime_dependency 'rake'
|
35
35
|
s.add_runtime_dependency 'ruby_speech', ["~> 1.0"]
|
36
|
-
s.add_runtime_dependency 'thor'
|
36
|
+
s.add_runtime_dependency 'thor', "~> 0.18.0"
|
37
37
|
|
38
|
-
s.add_development_dependency 'aruba', "~> 0.
|
38
|
+
s.add_development_dependency 'aruba', "~> 0.5"
|
39
39
|
s.add_development_dependency 'ci_reporter'
|
40
40
|
s.add_development_dependency 'cucumber'
|
41
41
|
s.add_development_dependency 'guard-cucumber'
|
data/features/cli_create.feature
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'timeout'
|
4
|
-
|
5
3
|
Then /^I should see the usage message$/ do
|
6
4
|
steps %Q{
|
7
|
-
Then the output should contain "Tasks:"
|
8
5
|
Then the output should contain "ahn create"
|
9
6
|
Then the output should contain "ahn start"
|
10
7
|
Then the output should contain "ahn daemon"
|
@@ -13,11 +10,6 @@ Then /^I should see the usage message$/ do
|
|
13
10
|
}
|
14
11
|
end
|
15
12
|
|
16
|
-
# TODO: Remove after pull request is merged in cucumber.rb from Aruba
|
17
|
-
When /^I terminate the interactive process$/ do
|
18
|
-
terminate_processes!
|
19
|
-
end
|
20
|
-
|
21
13
|
When /^I wait (\d+) seconds?$/ do |arg1|
|
22
14
|
sleep arg1.to_i
|
23
15
|
end
|
@@ -60,7 +60,7 @@ module Adhearsion
|
|
60
60
|
attr_reader :block
|
61
61
|
|
62
62
|
delegate :[], :[]=, :to => :@metadata
|
63
|
-
delegate :variables, :
|
63
|
+
delegate :variables, :to => :call
|
64
64
|
|
65
65
|
#
|
66
66
|
# Create a new instance
|
@@ -269,5 +269,16 @@ module Adhearsion
|
|
269
269
|
def inspect
|
270
270
|
"#<#{self.class} call=#{call.alive? ? call.id : ''}, metadata=#{metadata.inspect}>"
|
271
271
|
end
|
272
|
+
|
273
|
+
def eql?(other)
|
274
|
+
other.instance_of?(self.class) && call == other.call && metadata == other.metadata
|
275
|
+
end
|
276
|
+
alias :== :eql?
|
277
|
+
|
278
|
+
def logger
|
279
|
+
call.logger
|
280
|
+
rescue Celluloid::DeadActorError
|
281
|
+
super
|
282
|
+
end
|
272
283
|
end#class
|
273
284
|
end
|
@@ -36,11 +36,8 @@ module Adhearsion
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def uri?(string)
|
39
|
-
|
40
|
-
|
41
|
-
rescue URI::BadURIError
|
42
|
-
false
|
43
|
-
rescue URI::InvalidURIError
|
39
|
+
!! URI.parse(string).scheme
|
40
|
+
rescue URI::BadURIError, URI::InvalidURIError
|
44
41
|
false
|
45
42
|
end
|
46
43
|
|
@@ -23,6 +23,8 @@ If you are using Asterisk 1.8, you will need to add an additional context with t
|
|
23
23
|
```xml
|
24
24
|
<extension name='Adhearsion'>
|
25
25
|
<condition field="destination_number" expression="^10$">
|
26
|
+
<action application="set" data="hangup_after_bridge=false"/>
|
27
|
+
<action application="set" data="park_after_bridge=true"/>
|
26
28
|
<action application='park'/>
|
27
29
|
</condition>
|
28
30
|
</extension>
|
@@ -43,7 +43,7 @@ module Adhearsion
|
|
43
43
|
self.client = Punchblock::Client.new :connection => connection
|
44
44
|
|
45
45
|
# Tell the Punchblock connection that we are ready to process calls.
|
46
|
-
Events.register_callback :
|
46
|
+
Events.register_callback :after_initialized do
|
47
47
|
connection.ready!
|
48
48
|
end
|
49
49
|
|
@@ -18,7 +18,7 @@ module Adhearsion
|
|
18
18
|
@target, @guards = target, guards
|
19
19
|
end
|
20
20
|
@guards.compact!
|
21
|
-
@controller_metadata =
|
21
|
+
@controller_metadata = nil
|
22
22
|
end
|
23
23
|
|
24
24
|
def match?(call)
|
@@ -43,7 +43,7 @@ module Adhearsion
|
|
43
43
|
else
|
44
44
|
call_actor.hangup
|
45
45
|
end
|
46
|
-
rescue Call::Hangup
|
46
|
+
rescue Call::Hangup, Call::ExpiredError
|
47
47
|
end
|
48
48
|
callback.call if callback
|
49
49
|
}
|
data/lib/adhearsion/version.rb
CHANGED
@@ -310,13 +310,13 @@ module Adhearsion
|
|
310
310
|
end
|
311
311
|
|
312
312
|
context "with a block passed" do
|
313
|
-
it "
|
314
|
-
|
315
|
-
subject.
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
313
|
+
it "validates the buffer using that block, terminating on something truthy" do
|
314
|
+
subject.should_receive(:play_sound_files_for_menu).twice.and_return("1")
|
315
|
+
result = subject.ask sound_files, limit: 3 do |buffer|
|
316
|
+
buffer == '11'
|
317
|
+
end
|
318
|
+
result.status.should == :validator_terminated
|
319
|
+
result.response.should == '11'
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
@@ -28,6 +28,15 @@ module Adhearsion
|
|
28
28
|
its(:logger) { should be call.logger }
|
29
29
|
its(:variables) { should be call.variables }
|
30
30
|
|
31
|
+
context "when the call is dead" do
|
32
|
+
before { call.terminate }
|
33
|
+
|
34
|
+
it "should use an unnamed logger" do
|
35
|
+
subject.logger.should be_a ::Logging::Logger
|
36
|
+
subject.logger.name.should == "Adhearsion::CallController"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
31
40
|
describe "execution on a call" do
|
32
41
|
before do
|
33
42
|
subject.stub :execute_component_and_await_completion => nil
|
@@ -381,6 +390,40 @@ module Adhearsion
|
|
381
390
|
(Time.now - starting_time).should > 0.5
|
382
391
|
end
|
383
392
|
end
|
393
|
+
|
394
|
+
describe "equality" do
|
395
|
+
context "when of the same type, operating on the same call, with the same metadata" do
|
396
|
+
let(:other) { CallController.new call, metadata }
|
397
|
+
|
398
|
+
it "should be equal" do
|
399
|
+
subject.should == other
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
context "when of a different type" do
|
404
|
+
let(:other) { Class.new(CallController).new call, metadata }
|
405
|
+
|
406
|
+
it "should not be equal" do
|
407
|
+
subject.should_not == other
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
context "when operating on a different call" do
|
412
|
+
let(:other) { CallController.new Call.new, metadata }
|
413
|
+
|
414
|
+
it "should not be equal" do
|
415
|
+
subject.should_not == other
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
context "with different metadata" do
|
420
|
+
let(:other) { CallController.new call, something: 'else' }
|
421
|
+
|
422
|
+
it "should not be equal" do
|
423
|
+
subject.should_not == other
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
384
427
|
end
|
385
428
|
end
|
386
429
|
|
@@ -62,9 +62,8 @@ module Adhearsion
|
|
62
62
|
context "with controller metadata specified" do
|
63
63
|
it "should set the metadata on the controller" do
|
64
64
|
mock_call.should_receive(:dial).once.with(to, {})
|
65
|
-
mock_call
|
66
|
-
|
67
|
-
end
|
65
|
+
expected_controller = controller.new mock_call, foo: 'bar'
|
66
|
+
mock_call.should_receive(:execute_controller).with(expected_controller, kind_of(Proc)).once
|
68
67
|
call = OutboundCall.originate to, :controller => controller, :controller_metadata => {:foo => 'bar'}
|
69
68
|
call << Punchblock::Event::Answered.new
|
70
69
|
end
|
@@ -54,6 +54,7 @@ module Adhearsion
|
|
54
54
|
|
55
55
|
before do
|
56
56
|
mock_call.stub :id => call_id
|
57
|
+
mock_client.as_null_object
|
57
58
|
mock_client.stub :event_handler= => true
|
58
59
|
Events.refresh!
|
59
60
|
Adhearsion::Process.stub :fqdn => 'hostname'
|
@@ -190,7 +191,7 @@ module Adhearsion
|
|
190
191
|
describe 'using FreeSWITCH' do
|
191
192
|
let(:overrides) { {:username => 'test', :password => '123', :host => 'foo.bar.com', :port => 200, :connection_timeout => 20, :root_domain => 'foo.com', :calls_domain => 'call.foo.com', :mixers_domain => 'mixer.foo.com', :media_engine => :swift, :default_voice => :hal} }
|
192
193
|
|
193
|
-
it 'should start
|
194
|
+
it 'should start a FreeSWITCH PB connection' do
|
194
195
|
Punchblock::Connection::Freeswitch.should_receive(:new).once.with(overrides).and_return mock_client
|
195
196
|
initialize_punchblock overrides.merge(:platform => :freeswitch)
|
196
197
|
end
|
@@ -109,7 +109,7 @@ module Adhearsion
|
|
109
109
|
|
110
110
|
let(:latch) { CountDownLatch.new 1 }
|
111
111
|
|
112
|
-
before { call.wrapped_object.
|
112
|
+
before { call.wrapped_object.stub :write_and_await_response }
|
113
113
|
|
114
114
|
context "via a call controller" do
|
115
115
|
let(:controller) { CallController }
|
@@ -139,6 +139,26 @@ module Adhearsion
|
|
139
139
|
latch.wait(2).should be true
|
140
140
|
end
|
141
141
|
|
142
|
+
context "when the CallController mutates its metadata" do
|
143
|
+
let :controller do
|
144
|
+
Class.new CallController do
|
145
|
+
def run
|
146
|
+
metadata[:foo] = 'bar'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
before do
|
152
|
+
route.dispatch call
|
153
|
+
end
|
154
|
+
|
155
|
+
it "gives the next call fresh metadata" do
|
156
|
+
expected_controller = controller.new call, nil
|
157
|
+
call.should_receive(:execute_controller).once.with expected_controller, kind_of(Proc)
|
158
|
+
route.dispatch call
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
142
162
|
context 'with the :ahn_prevent_hangup call variable set' do
|
143
163
|
before { call[:ahn_prevent_hangup] = true }
|
144
164
|
|
@@ -159,6 +179,23 @@ module Adhearsion
|
|
159
179
|
end.should_not raise_error
|
160
180
|
end
|
161
181
|
end
|
182
|
+
|
183
|
+
context "if the call is dead when trying to clear it up" do
|
184
|
+
let :controller do
|
185
|
+
Class.new CallController do
|
186
|
+
def run
|
187
|
+
call.terminate
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should not raise an exception" do
|
193
|
+
lambda do
|
194
|
+
route.dispatch call, lambda { latch.countdown! }
|
195
|
+
latch.wait(2).should be true
|
196
|
+
end.should_not raise_error
|
197
|
+
end
|
198
|
+
end
|
162
199
|
end
|
163
200
|
|
164
201
|
context "via a block" do
|
@@ -5,6 +5,7 @@ module CallControllerTestHelpers
|
|
5
5
|
test_case.let(:call_id) { new_uuid }
|
6
6
|
test_case.let(:call) { Adhearsion::Call.new }
|
7
7
|
test_case.let(:block) { nil }
|
8
|
+
test_case.let(:metadata) { {doo: :dah} }
|
8
9
|
test_case.let(:controller) { new_controller test_case.describes }
|
9
10
|
|
10
11
|
test_case.subject { controller }
|
@@ -21,7 +22,7 @@ module CallControllerTestHelpers
|
|
21
22
|
target
|
22
23
|
when Module, nil
|
23
24
|
Class.new Adhearsion::CallController
|
24
|
-
end.new call,
|
25
|
+
end.new call, metadata, &block
|
25
26
|
end
|
26
27
|
|
27
28
|
def expect_message_waiting_for_response(message = nil, fail = false, &block)
|
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: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Phillips
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -227,30 +227,30 @@ dependencies:
|
|
227
227
|
name: thor
|
228
228
|
requirement: !ruby/object:Gem::Requirement
|
229
229
|
requirements:
|
230
|
-
- -
|
230
|
+
- - ~>
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
version:
|
232
|
+
version: 0.18.0
|
233
233
|
type: :runtime
|
234
234
|
prerelease: false
|
235
235
|
version_requirements: !ruby/object:Gem::Requirement
|
236
236
|
requirements:
|
237
|
-
- -
|
237
|
+
- - ~>
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
239
|
+
version: 0.18.0
|
240
240
|
- !ruby/object:Gem::Dependency
|
241
241
|
name: aruba
|
242
242
|
requirement: !ruby/object:Gem::Requirement
|
243
243
|
requirements:
|
244
244
|
- - ~>
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version: '0.
|
246
|
+
version: '0.5'
|
247
247
|
type: :development
|
248
248
|
prerelease: false
|
249
249
|
version_requirements: !ruby/object:Gem::Requirement
|
250
250
|
requirements:
|
251
251
|
- - ~>
|
252
252
|
- !ruby/object:Gem::Version
|
253
|
-
version: '0.
|
253
|
+
version: '0.5'
|
254
254
|
- !ruby/object:Gem::Dependency
|
255
255
|
name: ci_reporter
|
256
256
|
requirement: !ruby/object:Gem::Requirement
|
@@ -410,7 +410,6 @@ files:
|
|
410
410
|
- features/plugin_generator.feature
|
411
411
|
- features/step_definitions/app_generator_steps.rb
|
412
412
|
- features/step_definitions/cli_steps.rb
|
413
|
-
- features/support/aruba_helper.rb
|
414
413
|
- features/support/env.rb
|
415
414
|
- features/support/utils.rb
|
416
415
|
- lib/adhearsion.rb
|
@@ -584,7 +583,6 @@ test_files:
|
|
584
583
|
- features/plugin_generator.feature
|
585
584
|
- features/step_definitions/app_generator_steps.rb
|
586
585
|
- features/step_definitions/cli_steps.rb
|
587
|
-
- features/support/aruba_helper.rb
|
588
586
|
- features/support/env.rb
|
589
587
|
- features/support/utils.rb
|
590
588
|
- spec/adhearsion/call_controller/dial_spec.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Aruba
|
4
|
-
module Api
|
5
|
-
# output() blocks for stderr and stdout it seems
|
6
|
-
def assert_partial_output_interactive(expected)
|
7
|
-
unescape(_read_interactive).include?(unescape(expected)) ? true : false
|
8
|
-
end
|
9
|
-
|
10
|
-
def _read_interactive
|
11
|
-
@interactive.read_stdout(@aruba_keep_ansi)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class Process
|
16
|
-
def read_stdout(keep_ansi)
|
17
|
-
wait_for_io do
|
18
|
-
@process.io.stdout.flush
|
19
|
-
content = filter_ansi(open(@out.path).read, keep_ansi)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|