adhearsion 2.5.0 → 2.5.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 +15 -0
- data/adhearsion.gemspec +2 -2
- data/lib/adhearsion.rb +2 -3
- data/lib/adhearsion/call.rb +8 -4
- data/lib/adhearsion/call_controller/dial.rb +4 -4
- data/lib/adhearsion/call_controller/record.rb +2 -2
- data/lib/adhearsion/calls.rb +44 -17
- data/lib/adhearsion/generators/app/templates/Gemfile.erb +4 -3
- data/lib/adhearsion/generators/app/templates/README.md +3 -2
- data/lib/adhearsion/generators/app/templates/routes.erb +6 -7
- data/lib/adhearsion/generators/app/templates/simon_game_spec.rb +1 -0
- data/lib/adhearsion/initializer.rb +11 -2
- data/lib/adhearsion/logging.rb +8 -5
- data/lib/adhearsion/outbound_call.rb +37 -7
- data/lib/adhearsion/plugin.rb +24 -6
- data/lib/adhearsion/punchblock_plugin/initializer.rb +2 -1
- data/lib/adhearsion/router/route.rb +2 -2
- data/lib/adhearsion/rspec.rb +3 -0
- data/lib/adhearsion/tasks.rb +10 -0
- data/lib/adhearsion/tasks/environment.rb +1 -0
- data/lib/adhearsion/version.rb +1 -1
- data/spec/adhearsion/call_controller/dial_spec.rb +114 -114
- data/spec/adhearsion/call_spec.rb +12 -10
- data/spec/adhearsion/calls_spec.rb +2 -0
- data/spec/adhearsion/outbound_call_spec.rb +86 -17
- data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +13 -1
- data/spec/adhearsion_spec.rb +0 -12
- data/spec/spec_helper.rb +1 -0
- metadata +7 -7
data/lib/adhearsion/plugin.rb
CHANGED
@@ -144,15 +144,23 @@ module Adhearsion
|
|
144
144
|
@plugin_name = name
|
145
145
|
end
|
146
146
|
|
147
|
+
# Class method that will be used by subclasses to configure the plugin
|
148
|
+
# @param name Symbol plugin config name
|
147
149
|
def config(name = nil, &block)
|
150
|
+
if name.nil?
|
151
|
+
name = self.plugin_name
|
152
|
+
else
|
153
|
+
self.plugin_name = name
|
154
|
+
end
|
155
|
+
|
148
156
|
if block_given?
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
157
|
+
opts = {}
|
158
|
+
opts[:after] ||= configs.last.name unless configs.empty?
|
159
|
+
::Loquacious::Configuration.defaults_for plugin_name, &Proc.new
|
160
|
+
initializer = Initializer.new(plugin_name, self, opts) do
|
161
|
+
::Loquacious.configuration_for plugin_name, &block
|
153
162
|
end
|
154
|
-
::
|
155
|
-
::Loquacious.configuration_for plugin_name, &block
|
163
|
+
Adhearsion::Plugin.configs << initializer
|
156
164
|
else
|
157
165
|
::Loquacious.configuration_for plugin_name
|
158
166
|
end
|
@@ -162,6 +170,12 @@ module Adhearsion
|
|
162
170
|
::Loquacious::Configuration.help_for plugin_name
|
163
171
|
end
|
164
172
|
|
173
|
+
def configure_plugins(*args)
|
174
|
+
configs.tsort.each do |config|
|
175
|
+
config.run(*args)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
165
179
|
# Recursively initialization of all the loaded plugins
|
166
180
|
def init_plugins(*args)
|
167
181
|
initializers.tsort.each do |initializer|
|
@@ -175,6 +189,10 @@ module Adhearsion
|
|
175
189
|
end
|
176
190
|
end
|
177
191
|
|
192
|
+
def configs
|
193
|
+
@configs ||= Collection.new
|
194
|
+
end
|
195
|
+
|
178
196
|
def initializers
|
179
197
|
@initializers ||= Collection.new
|
180
198
|
end
|
@@ -142,7 +142,8 @@ module Adhearsion
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def dispatch_call_event(event)
|
145
|
-
|
145
|
+
call = Adhearsion.active_calls[event.target_call_id]
|
146
|
+
if call && call.alive?
|
146
147
|
call.async.deliver_message event
|
147
148
|
else
|
148
149
|
logger.warn "Event received for inactive call #{event.target_call_id}: #{event.inspect}"
|
@@ -39,10 +39,10 @@ module Adhearsion
|
|
39
39
|
call.execute_controller controller, lambda { |call_actor|
|
40
40
|
begin
|
41
41
|
if call_actor.auto_hangup
|
42
|
-
logger.info "Call routing completed. Hanging up now
|
42
|
+
logger.info "Call #{call.id} routing completed. Hanging up now."
|
43
43
|
call_actor.hangup
|
44
44
|
else
|
45
|
-
logger.info "Call routing completed
|
45
|
+
logger.info "Call #{call.id} routing completed. Keeping the call alive at controller/router request."
|
46
46
|
end
|
47
47
|
rescue Call::Hangup, Call::ExpiredError
|
48
48
|
end
|
data/lib/adhearsion/rspec.rb
CHANGED
data/lib/adhearsion/tasks.rb
CHANGED
@@ -6,6 +6,16 @@ Dir[File.join(File.dirname(__FILE__), "tasks/*.rb")].each do |file|
|
|
6
6
|
require file
|
7
7
|
end
|
8
8
|
|
9
|
+
initializer = Adhearsion::Initializer.new
|
10
|
+
initializer.configure_plugins
|
11
|
+
initializer.load_lib_folder
|
12
|
+
initializer.load_config_file
|
13
|
+
initializer.load_events_file
|
14
|
+
initializer.load_routes_file
|
15
|
+
initializer.initialize_log_paths
|
16
|
+
initializer.start_logging
|
17
|
+
initializer.init_plugins
|
18
|
+
|
9
19
|
Adhearsion::Plugin.load_tasks
|
10
20
|
|
11
21
|
puts "\nAdhearsion configured environment: #{Adhearsion.config.platform.environment}\n" unless ARGV.empty?
|
data/lib/adhearsion/version.rb
CHANGED
@@ -78,22 +78,22 @@ module Adhearsion
|
|
78
78
|
it "blocks the original controller until the new call ends" do
|
79
79
|
dial_in_thread
|
80
80
|
|
81
|
-
latch.wait(
|
81
|
+
latch.wait(2).should be_false
|
82
82
|
|
83
83
|
other_mock_call << mock_end
|
84
84
|
|
85
|
-
latch.wait(
|
85
|
+
latch.wait(2).should be_true
|
86
86
|
end
|
87
87
|
|
88
88
|
it "unblocks the original controller if the original call ends" do
|
89
89
|
other_mock_call.should_receive(:hangup).once
|
90
90
|
dial_in_thread
|
91
91
|
|
92
|
-
latch.wait(
|
92
|
+
latch.wait(2).should be_false
|
93
93
|
|
94
94
|
call << mock_end
|
95
95
|
|
96
|
-
latch.wait(
|
96
|
+
latch.wait(2).should be_true
|
97
97
|
end
|
98
98
|
|
99
99
|
it "joins the new call to the existing one on answer" do
|
@@ -102,12 +102,12 @@ module Adhearsion
|
|
102
102
|
|
103
103
|
dial_in_thread
|
104
104
|
|
105
|
-
latch.wait(
|
105
|
+
latch.wait(2).should be_false
|
106
106
|
|
107
107
|
other_mock_call << mock_answered
|
108
108
|
other_mock_call << mock_end
|
109
109
|
|
110
|
-
latch.wait(
|
110
|
+
latch.wait(2).should be_true
|
111
111
|
end
|
112
112
|
|
113
113
|
context "with a join target specified" do
|
@@ -120,12 +120,12 @@ module Adhearsion
|
|
120
120
|
|
121
121
|
dial_in_thread
|
122
122
|
|
123
|
-
latch.wait(
|
123
|
+
latch.wait(2).should be_false
|
124
124
|
|
125
125
|
other_mock_call << mock_answered
|
126
126
|
other_mock_call << mock_end
|
127
127
|
|
128
|
-
latch.wait(
|
128
|
+
latch.wait(2).should be_true
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -140,12 +140,12 @@ module Adhearsion
|
|
140
140
|
|
141
141
|
dial_in_thread
|
142
142
|
|
143
|
-
latch.wait(
|
143
|
+
latch.wait(2).should be_false
|
144
144
|
|
145
145
|
other_mock_call << mock_answered
|
146
146
|
other_mock_call << mock_end
|
147
147
|
|
148
|
-
latch.wait(
|
148
|
+
latch.wait(2).should be_true
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -166,12 +166,12 @@ module Adhearsion
|
|
166
166
|
|
167
167
|
dial_in_thread
|
168
168
|
|
169
|
-
latch.wait(
|
169
|
+
latch.wait(2).should be_false
|
170
170
|
|
171
171
|
other_mock_call << mock_answered
|
172
172
|
other_mock_call << mock_end
|
173
173
|
|
174
|
-
latch.wait(
|
174
|
+
latch.wait(2).should be_true
|
175
175
|
end
|
176
176
|
|
177
177
|
context "as a callback" do
|
@@ -186,12 +186,12 @@ module Adhearsion
|
|
186
186
|
|
187
187
|
dial_in_thread
|
188
188
|
|
189
|
-
latch.wait(
|
189
|
+
latch.wait(2).should be_false
|
190
190
|
|
191
191
|
other_mock_call << mock_answered
|
192
192
|
other_mock_call << mock_end
|
193
193
|
|
194
|
-
latch.wait(
|
194
|
+
latch.wait(2).should be_true
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -202,11 +202,11 @@ module Adhearsion
|
|
202
202
|
|
203
203
|
t = dial_in_thread
|
204
204
|
|
205
|
-
latch.wait(
|
205
|
+
latch.wait(2).should be_false
|
206
206
|
|
207
207
|
other_mock_call << mock_end(:reject)
|
208
208
|
|
209
|
-
latch.wait(
|
209
|
+
latch.wait(2).should be_true
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
@@ -218,12 +218,12 @@ module Adhearsion
|
|
218
218
|
|
219
219
|
dial_in_thread
|
220
220
|
|
221
|
-
latch.wait(
|
221
|
+
latch.wait(2).should be_false
|
222
222
|
|
223
223
|
other_mock_call << mock_answered
|
224
224
|
call << mock_end
|
225
225
|
|
226
|
-
latch.wait(
|
226
|
+
latch.wait(2).should be_true
|
227
227
|
end
|
228
228
|
|
229
229
|
context "when the call is rejected" do
|
@@ -274,7 +274,7 @@ module Adhearsion
|
|
274
274
|
other_mock_call << mock_answered
|
275
275
|
other_mock_call << mock_end
|
276
276
|
|
277
|
-
latch.wait(
|
277
|
+
latch.wait(2).should be_true
|
278
278
|
|
279
279
|
t.join
|
280
280
|
status = t.value
|
@@ -303,7 +303,7 @@ module Adhearsion
|
|
303
303
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
304
304
|
other_mock_call << mock_end
|
305
305
|
|
306
|
-
latch.wait(
|
306
|
+
latch.wait(2).should be_true
|
307
307
|
|
308
308
|
t.join
|
309
309
|
status = t.value
|
@@ -329,7 +329,7 @@ module Adhearsion
|
|
329
329
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
330
330
|
other_mock_call << mock_end
|
331
331
|
|
332
|
-
latch.wait(
|
332
|
+
latch.wait(2).should be_true
|
333
333
|
|
334
334
|
t.join
|
335
335
|
end
|
@@ -369,7 +369,7 @@ module Adhearsion
|
|
369
369
|
dial.split
|
370
370
|
other_mock_call << mock_end
|
371
371
|
|
372
|
-
latch.wait(
|
372
|
+
latch.wait(2).should be_true
|
373
373
|
|
374
374
|
waiter_thread.join
|
375
375
|
dial.status.result.should be == :answer
|
@@ -390,11 +390,11 @@ module Adhearsion
|
|
390
390
|
|
391
391
|
dial.split
|
392
392
|
|
393
|
-
latch.wait(
|
393
|
+
latch.wait(2).should be_false
|
394
394
|
|
395
395
|
other_mock_call << mock_end
|
396
396
|
|
397
|
-
latch.wait(
|
397
|
+
latch.wait(2).should be_true
|
398
398
|
|
399
399
|
waiter_thread.join
|
400
400
|
dial.status.result.should be == :answer
|
@@ -424,7 +424,7 @@ module Adhearsion
|
|
424
424
|
Timecop.freeze base_time
|
425
425
|
other_mock_call << mock_end
|
426
426
|
|
427
|
-
latch.wait(
|
427
|
+
latch.wait(2).should be_true
|
428
428
|
|
429
429
|
waiter_thread.join
|
430
430
|
status = dial.status
|
@@ -470,8 +470,8 @@ module Adhearsion
|
|
470
470
|
|
471
471
|
dial.split main: main_split_controller, others: others_split_controller, main_callback: ->(call) { self.callback(call) }, others_callback: ->(call) { self.callback(call) }
|
472
472
|
|
473
|
-
latch.wait(
|
474
|
-
split_latch.wait(
|
473
|
+
latch.wait(2).should be_false
|
474
|
+
split_latch.wait(2).should be_true
|
475
475
|
|
476
476
|
call['hit_split_controller'].should == main_split_controller
|
477
477
|
call['split_controller_metadata']['current_dial'].should be dial
|
@@ -481,7 +481,7 @@ module Adhearsion
|
|
481
481
|
|
482
482
|
other_mock_call << mock_end
|
483
483
|
|
484
|
-
latch.wait(
|
484
|
+
latch.wait(2).should be_true
|
485
485
|
|
486
486
|
waiter_thread.join
|
487
487
|
dial.status.result.should be == :answer
|
@@ -514,7 +514,7 @@ module Adhearsion
|
|
514
514
|
|
515
515
|
other_mock_call << mock_end
|
516
516
|
|
517
|
-
latch.wait(
|
517
|
+
latch.wait(2).should be_true
|
518
518
|
|
519
519
|
waiter_thread.join
|
520
520
|
dial.status.result.should be == :answer
|
@@ -586,7 +586,7 @@ module Adhearsion
|
|
586
586
|
|
587
587
|
other_mock_call << mock_end
|
588
588
|
|
589
|
-
latch.wait(
|
589
|
+
latch.wait(2).should be_true
|
590
590
|
|
591
591
|
waiter_thread.join
|
592
592
|
dial.status.result.should be == :answer
|
@@ -622,7 +622,7 @@ module Adhearsion
|
|
622
622
|
|
623
623
|
other_mock_call << mock_end
|
624
624
|
|
625
|
-
latch.wait(
|
625
|
+
latch.wait(2).should be_true
|
626
626
|
|
627
627
|
waiter_thread.join
|
628
628
|
dial.status.result.should be == :answer
|
@@ -662,7 +662,7 @@ module Adhearsion
|
|
662
662
|
|
663
663
|
other_mock_call << mock_end
|
664
664
|
|
665
|
-
latch.wait(
|
665
|
+
latch.wait(2).should be_true
|
666
666
|
|
667
667
|
waiter_thread.join
|
668
668
|
dial.status.result.should be == :answer
|
@@ -723,7 +723,7 @@ module Adhearsion
|
|
723
723
|
second_root_call.async << mock_end
|
724
724
|
second_other_mock_call.async << mock_end
|
725
725
|
|
726
|
-
latch.wait(
|
726
|
+
latch.wait(2).should be_true
|
727
727
|
|
728
728
|
waiter_thread.join
|
729
729
|
dial.status.result.should be == :answer
|
@@ -761,7 +761,7 @@ module Adhearsion
|
|
761
761
|
second_root_call.async << mock_end
|
762
762
|
second_other_mock_call.async << mock_end
|
763
763
|
|
764
|
-
latch.wait(
|
764
|
+
latch.wait(2).should be_true
|
765
765
|
|
766
766
|
waiter_thread.join
|
767
767
|
dial.status.result.should be == :answer
|
@@ -781,13 +781,13 @@ module Adhearsion
|
|
781
781
|
sleep 0.5
|
782
782
|
|
783
783
|
other_mock_call << mock_end
|
784
|
-
latch.wait(
|
784
|
+
latch.wait(2).should be_false
|
785
785
|
|
786
786
|
second_other_mock_call << mock_end
|
787
|
-
latch.wait(
|
787
|
+
latch.wait(2).should be_false
|
788
788
|
|
789
789
|
second_root_call << mock_end
|
790
|
-
latch.wait(
|
790
|
+
latch.wait(2).should be_true
|
791
791
|
|
792
792
|
waiter_thread.join
|
793
793
|
dial.status.result.should be == :answer
|
@@ -812,7 +812,7 @@ module Adhearsion
|
|
812
812
|
sleep 0.5
|
813
813
|
|
814
814
|
call << mock_end
|
815
|
-
latch.wait(
|
815
|
+
latch.wait(2).should be_true
|
816
816
|
|
817
817
|
waiter_thread.join
|
818
818
|
dial.status.result.should be == :answer
|
@@ -831,7 +831,7 @@ module Adhearsion
|
|
831
831
|
sleep 0.5
|
832
832
|
|
833
833
|
other_mock_call << mock_end
|
834
|
-
latch.wait(
|
834
|
+
latch.wait(2).should be_false
|
835
835
|
|
836
836
|
[call, second_root_call, second_other_mock_call].each do |call|
|
837
837
|
call.should_receive(:unjoin).once.with(mixer_name: mixer).and_return do
|
@@ -867,7 +867,7 @@ module Adhearsion
|
|
867
867
|
second_root_call.async << mock_end
|
868
868
|
second_other_mock_call.async << mock_end
|
869
869
|
|
870
|
-
latch.wait(
|
870
|
+
latch.wait(2).should be_true
|
871
871
|
|
872
872
|
waiter_thread.join
|
873
873
|
dial.status.result.should be == :answer
|
@@ -888,13 +888,13 @@ module Adhearsion
|
|
888
888
|
sleep 0.5
|
889
889
|
|
890
890
|
other_mock_call << mock_end
|
891
|
-
latch.wait(
|
891
|
+
latch.wait(2).should be_true
|
892
892
|
|
893
893
|
second_other_mock_call << mock_end
|
894
|
-
latch.wait(
|
894
|
+
latch.wait(2).should be_true
|
895
895
|
|
896
896
|
second_root_call << mock_end
|
897
|
-
latch.wait(
|
897
|
+
latch.wait(2).should be_true
|
898
898
|
|
899
899
|
waiter_thread.join
|
900
900
|
dial.status.result.should be == :answer
|
@@ -921,7 +921,7 @@ module Adhearsion
|
|
921
921
|
sleep 0.5
|
922
922
|
|
923
923
|
call << mock_end
|
924
|
-
latch.wait(
|
924
|
+
latch.wait(2).should be_true
|
925
925
|
|
926
926
|
waiter_thread.join
|
927
927
|
dial.status.result.should be == :answer
|
@@ -952,7 +952,7 @@ module Adhearsion
|
|
952
952
|
dial.split
|
953
953
|
|
954
954
|
other_mock_call << mock_end
|
955
|
-
latch.wait(
|
955
|
+
latch.wait(2).should be_false
|
956
956
|
|
957
957
|
[call, second_root_call, second_other_mock_call].each do |call|
|
958
958
|
call.should_receive(:join).once.with({mixer_name: mixer}, {}).and_return do
|
@@ -990,7 +990,7 @@ module Adhearsion
|
|
990
990
|
second_root_call.async << mock_end
|
991
991
|
second_other_mock_call.async << mock_end
|
992
992
|
|
993
|
-
latch.wait(
|
993
|
+
latch.wait(2).should be_true
|
994
994
|
|
995
995
|
waiter_thread.join
|
996
996
|
dial.status.result.should be == :answer
|
@@ -1046,7 +1046,7 @@ module Adhearsion
|
|
1046
1046
|
|
1047
1047
|
t = dial_in_thread
|
1048
1048
|
|
1049
|
-
latch.wait(
|
1049
|
+
latch.wait(2).should be_false
|
1050
1050
|
|
1051
1051
|
other_mock_call << mock_answered
|
1052
1052
|
other_mock_call << mock_end
|
@@ -1070,7 +1070,7 @@ module Adhearsion
|
|
1070
1070
|
|
1071
1071
|
t = dial_in_thread
|
1072
1072
|
|
1073
|
-
latch.wait(
|
1073
|
+
latch.wait(2).should be_false
|
1074
1074
|
|
1075
1075
|
other_mock_call << mock_answered
|
1076
1076
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
@@ -1145,9 +1145,9 @@ module Adhearsion
|
|
1145
1145
|
latch.countdown!
|
1146
1146
|
end
|
1147
1147
|
|
1148
|
-
latch.wait(
|
1148
|
+
latch.wait(2).should be_false
|
1149
1149
|
other_mock_call << mock_end
|
1150
|
-
latch.wait(
|
1150
|
+
latch.wait(2).should be_false
|
1151
1151
|
second_other_mock_call << mock_end
|
1152
1152
|
latch.wait(2).should be_true
|
1153
1153
|
t.join
|
@@ -1186,7 +1186,7 @@ module Adhearsion
|
|
1186
1186
|
other_mock_call << mock_answered
|
1187
1187
|
other_mock_call << mock_end
|
1188
1188
|
|
1189
|
-
latch.wait(
|
1189
|
+
latch.wait(2).should be_true
|
1190
1190
|
|
1191
1191
|
t.join
|
1192
1192
|
status = t.value
|
@@ -1293,7 +1293,7 @@ module Adhearsion
|
|
1293
1293
|
|
1294
1294
|
other_mock_call << mock_answered
|
1295
1295
|
|
1296
|
-
confirmation_latch.wait(
|
1296
|
+
confirmation_latch.wait(2).should be_true
|
1297
1297
|
latch.wait(2).should be_true
|
1298
1298
|
|
1299
1299
|
other_mock_call[:foo].should == 'bar'
|
@@ -1318,7 +1318,7 @@ module Adhearsion
|
|
1318
1318
|
|
1319
1319
|
other_mock_call << mock_answered
|
1320
1320
|
|
1321
|
-
confirmation_latch.wait(
|
1321
|
+
confirmation_latch.wait(2).should be_true
|
1322
1322
|
latch.wait(2).should be_true
|
1323
1323
|
end
|
1324
1324
|
|
@@ -1330,7 +1330,7 @@ module Adhearsion
|
|
1330
1330
|
|
1331
1331
|
t = dial_in_thread
|
1332
1332
|
|
1333
|
-
latch.wait(
|
1333
|
+
latch.wait(2).should be_false
|
1334
1334
|
|
1335
1335
|
base_time = Time.local(2008, 9, 1, 12, 0, 0)
|
1336
1336
|
Timecop.freeze base_time
|
@@ -1342,7 +1342,7 @@ module Adhearsion
|
|
1342
1342
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
1343
1343
|
other_mock_call << mock_end
|
1344
1344
|
|
1345
|
-
latch.wait(
|
1345
|
+
latch.wait(2).should be_true
|
1346
1346
|
|
1347
1347
|
t.join
|
1348
1348
|
status = t.value
|
@@ -1363,11 +1363,11 @@ module Adhearsion
|
|
1363
1363
|
|
1364
1364
|
t = dial_in_thread
|
1365
1365
|
|
1366
|
-
latch.wait(
|
1366
|
+
latch.wait(2).should be_false
|
1367
1367
|
|
1368
1368
|
other_mock_call << mock_answered
|
1369
1369
|
|
1370
|
-
latch.wait(
|
1370
|
+
latch.wait(2).should be_true
|
1371
1371
|
|
1372
1372
|
t.join
|
1373
1373
|
status = t.value
|
@@ -1412,10 +1412,10 @@ module Adhearsion
|
|
1412
1412
|
|
1413
1413
|
t = dial_in_thread
|
1414
1414
|
|
1415
|
-
latch.wait(
|
1415
|
+
latch.wait(2).should be_false
|
1416
1416
|
|
1417
1417
|
other_mock_call << mock_answered
|
1418
|
-
confirmation_latch.wait(
|
1418
|
+
confirmation_latch.wait(2).should be_true
|
1419
1419
|
|
1420
1420
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
1421
1421
|
|
@@ -1481,22 +1481,22 @@ module Adhearsion
|
|
1481
1481
|
it "blocks the original controller until the new call ends" do
|
1482
1482
|
dial_in_thread
|
1483
1483
|
|
1484
|
-
latch.wait(
|
1484
|
+
latch.wait(2).should be_false
|
1485
1485
|
|
1486
1486
|
other_mock_call << mock_end
|
1487
1487
|
|
1488
|
-
latch.wait(
|
1488
|
+
latch.wait(2).should be_true
|
1489
1489
|
end
|
1490
1490
|
|
1491
1491
|
it "unblocks the original controller if the original call ends" do
|
1492
1492
|
other_mock_call.should_receive(:hangup).once
|
1493
1493
|
dial_in_thread
|
1494
1494
|
|
1495
|
-
latch.wait(
|
1495
|
+
latch.wait(2).should be_false
|
1496
1496
|
|
1497
1497
|
call << mock_end
|
1498
1498
|
|
1499
|
-
latch.wait(
|
1499
|
+
latch.wait(2).should be_true
|
1500
1500
|
end
|
1501
1501
|
|
1502
1502
|
it "joins the new call to the existing one on answer" do
|
@@ -1505,12 +1505,12 @@ module Adhearsion
|
|
1505
1505
|
|
1506
1506
|
dial_in_thread
|
1507
1507
|
|
1508
|
-
latch.wait(
|
1508
|
+
latch.wait(2).should be_false
|
1509
1509
|
|
1510
1510
|
other_mock_call << mock_answered
|
1511
1511
|
other_mock_call << mock_end
|
1512
1512
|
|
1513
|
-
latch.wait(
|
1513
|
+
latch.wait(2).should be_true
|
1514
1514
|
end
|
1515
1515
|
|
1516
1516
|
context "with a join target specified" do
|
@@ -1523,12 +1523,12 @@ module Adhearsion
|
|
1523
1523
|
|
1524
1524
|
dial_in_thread
|
1525
1525
|
|
1526
|
-
latch.wait(
|
1526
|
+
latch.wait(2).should be_false
|
1527
1527
|
|
1528
1528
|
other_mock_call << mock_answered
|
1529
1529
|
other_mock_call << mock_end
|
1530
1530
|
|
1531
|
-
latch.wait(
|
1531
|
+
latch.wait(2).should be_true
|
1532
1532
|
end
|
1533
1533
|
end
|
1534
1534
|
|
@@ -1543,12 +1543,12 @@ module Adhearsion
|
|
1543
1543
|
|
1544
1544
|
dial_in_thread
|
1545
1545
|
|
1546
|
-
latch.wait(
|
1546
|
+
latch.wait(2).should be_false
|
1547
1547
|
|
1548
1548
|
other_mock_call << mock_answered
|
1549
1549
|
other_mock_call << mock_end
|
1550
1550
|
|
1551
|
-
latch.wait(
|
1551
|
+
latch.wait(2).should be_true
|
1552
1552
|
end
|
1553
1553
|
end
|
1554
1554
|
|
@@ -1569,12 +1569,12 @@ module Adhearsion
|
|
1569
1569
|
|
1570
1570
|
dial_in_thread
|
1571
1571
|
|
1572
|
-
latch.wait(
|
1572
|
+
latch.wait(2).should be_false
|
1573
1573
|
|
1574
1574
|
other_mock_call << mock_answered
|
1575
1575
|
other_mock_call << mock_end
|
1576
1576
|
|
1577
|
-
latch.wait(
|
1577
|
+
latch.wait(2).should be_true
|
1578
1578
|
end
|
1579
1579
|
|
1580
1580
|
context "as a callback" do
|
@@ -1589,12 +1589,12 @@ module Adhearsion
|
|
1589
1589
|
|
1590
1590
|
dial_in_thread
|
1591
1591
|
|
1592
|
-
latch.wait(
|
1592
|
+
latch.wait(2).should be_false
|
1593
1593
|
|
1594
1594
|
other_mock_call << mock_answered
|
1595
1595
|
other_mock_call << mock_end
|
1596
1596
|
|
1597
|
-
latch.wait(
|
1597
|
+
latch.wait(2).should be_true
|
1598
1598
|
end
|
1599
1599
|
end
|
1600
1600
|
|
@@ -1605,11 +1605,11 @@ module Adhearsion
|
|
1605
1605
|
|
1606
1606
|
t = dial_in_thread
|
1607
1607
|
|
1608
|
-
latch.wait(
|
1608
|
+
latch.wait(2).should be_false
|
1609
1609
|
|
1610
1610
|
other_mock_call << mock_end(:reject)
|
1611
1611
|
|
1612
|
-
latch.wait(
|
1612
|
+
latch.wait(2).should be_true
|
1613
1613
|
end
|
1614
1614
|
end
|
1615
1615
|
end
|
@@ -1621,12 +1621,12 @@ module Adhearsion
|
|
1621
1621
|
|
1622
1622
|
dial_in_thread
|
1623
1623
|
|
1624
|
-
latch.wait(
|
1624
|
+
latch.wait(2).should be_false
|
1625
1625
|
|
1626
1626
|
other_mock_call << mock_answered
|
1627
1627
|
call << mock_end
|
1628
1628
|
|
1629
|
-
latch.wait(
|
1629
|
+
latch.wait(2).should be_true
|
1630
1630
|
end
|
1631
1631
|
|
1632
1632
|
context "when the call is rejected" do
|
@@ -1677,7 +1677,7 @@ module Adhearsion
|
|
1677
1677
|
other_mock_call << mock_answered
|
1678
1678
|
other_mock_call << mock_end
|
1679
1679
|
|
1680
|
-
latch.wait(
|
1680
|
+
latch.wait(2).should be_true
|
1681
1681
|
|
1682
1682
|
t.join
|
1683
1683
|
status = t.value
|
@@ -1706,7 +1706,7 @@ module Adhearsion
|
|
1706
1706
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
1707
1707
|
other_mock_call << mock_end
|
1708
1708
|
|
1709
|
-
latch.wait(
|
1709
|
+
latch.wait(2).should be_true
|
1710
1710
|
|
1711
1711
|
t.join
|
1712
1712
|
status = t.value
|
@@ -1732,7 +1732,7 @@ module Adhearsion
|
|
1732
1732
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
1733
1733
|
other_mock_call << mock_end
|
1734
1734
|
|
1735
|
-
latch.wait(
|
1735
|
+
latch.wait(2).should be_true
|
1736
1736
|
|
1737
1737
|
t.join
|
1738
1738
|
end
|
@@ -1772,7 +1772,7 @@ module Adhearsion
|
|
1772
1772
|
dial.split
|
1773
1773
|
other_mock_call << mock_end
|
1774
1774
|
|
1775
|
-
latch.wait(
|
1775
|
+
latch.wait(2).should be_true
|
1776
1776
|
|
1777
1777
|
waiter_thread.join
|
1778
1778
|
dial.status.result.should be == :answer
|
@@ -1793,11 +1793,11 @@ module Adhearsion
|
|
1793
1793
|
|
1794
1794
|
dial.split
|
1795
1795
|
|
1796
|
-
latch.wait(
|
1796
|
+
latch.wait(2).should be_false
|
1797
1797
|
|
1798
1798
|
other_mock_call << mock_end
|
1799
1799
|
|
1800
|
-
latch.wait(
|
1800
|
+
latch.wait(2).should be_true
|
1801
1801
|
|
1802
1802
|
waiter_thread.join
|
1803
1803
|
dial.status.result.should be == :answer
|
@@ -1827,7 +1827,7 @@ module Adhearsion
|
|
1827
1827
|
Timecop.freeze base_time
|
1828
1828
|
other_mock_call << mock_end
|
1829
1829
|
|
1830
|
-
latch.wait(
|
1830
|
+
latch.wait(2).should be_true
|
1831
1831
|
|
1832
1832
|
waiter_thread.join
|
1833
1833
|
status = dial.status
|
@@ -1873,8 +1873,8 @@ module Adhearsion
|
|
1873
1873
|
|
1874
1874
|
dial.split main: main_split_controller, others: others_split_controller, main_callback: ->(call) { self.callback(call) }, others_callback: ->(call) { self.callback(call) }
|
1875
1875
|
|
1876
|
-
latch.wait(
|
1877
|
-
split_latch.wait(
|
1876
|
+
latch.wait(2).should be_false
|
1877
|
+
split_latch.wait(2).should be_true
|
1878
1878
|
|
1879
1879
|
call['hit_split_controller'].should == main_split_controller
|
1880
1880
|
call['split_controller_metadata']['current_dial'].should be dial
|
@@ -1884,7 +1884,7 @@ module Adhearsion
|
|
1884
1884
|
|
1885
1885
|
other_mock_call << mock_end
|
1886
1886
|
|
1887
|
-
latch.wait(
|
1887
|
+
latch.wait(2).should be_true
|
1888
1888
|
|
1889
1889
|
waiter_thread.join
|
1890
1890
|
dial.status.result.should be == :answer
|
@@ -1917,7 +1917,7 @@ module Adhearsion
|
|
1917
1917
|
|
1918
1918
|
other_mock_call << mock_end
|
1919
1919
|
|
1920
|
-
latch.wait(
|
1920
|
+
latch.wait(2).should be_true
|
1921
1921
|
|
1922
1922
|
waiter_thread.join
|
1923
1923
|
dial.status.result.should be == :answer
|
@@ -1989,7 +1989,7 @@ module Adhearsion
|
|
1989
1989
|
|
1990
1990
|
other_mock_call << mock_end
|
1991
1991
|
|
1992
|
-
latch.wait(
|
1992
|
+
latch.wait(2).should be_true
|
1993
1993
|
|
1994
1994
|
waiter_thread.join
|
1995
1995
|
dial.status.result.should be == :answer
|
@@ -2025,7 +2025,7 @@ module Adhearsion
|
|
2025
2025
|
|
2026
2026
|
other_mock_call << mock_end
|
2027
2027
|
|
2028
|
-
latch.wait(
|
2028
|
+
latch.wait(2).should be_true
|
2029
2029
|
|
2030
2030
|
waiter_thread.join
|
2031
2031
|
dial.status.result.should be == :answer
|
@@ -2065,7 +2065,7 @@ module Adhearsion
|
|
2065
2065
|
|
2066
2066
|
other_mock_call << mock_end
|
2067
2067
|
|
2068
|
-
latch.wait(
|
2068
|
+
latch.wait(2).should be_true
|
2069
2069
|
|
2070
2070
|
waiter_thread.join
|
2071
2071
|
dial.status.result.should be == :answer
|
@@ -2126,7 +2126,7 @@ module Adhearsion
|
|
2126
2126
|
second_root_call.async << mock_end
|
2127
2127
|
second_other_mock_call.async << mock_end
|
2128
2128
|
|
2129
|
-
latch.wait(
|
2129
|
+
latch.wait(2).should be_true
|
2130
2130
|
|
2131
2131
|
waiter_thread.join
|
2132
2132
|
dial.status.result.should be == :answer
|
@@ -2164,7 +2164,7 @@ module Adhearsion
|
|
2164
2164
|
second_root_call.async << mock_end
|
2165
2165
|
second_other_mock_call.async << mock_end
|
2166
2166
|
|
2167
|
-
latch.wait(
|
2167
|
+
latch.wait(2).should be_true
|
2168
2168
|
|
2169
2169
|
waiter_thread.join
|
2170
2170
|
dial.status.result.should be == :answer
|
@@ -2184,13 +2184,13 @@ module Adhearsion
|
|
2184
2184
|
sleep 0.5
|
2185
2185
|
|
2186
2186
|
other_mock_call << mock_end
|
2187
|
-
latch.wait(
|
2187
|
+
latch.wait(2).should be_false
|
2188
2188
|
|
2189
2189
|
second_other_mock_call << mock_end
|
2190
|
-
latch.wait(
|
2190
|
+
latch.wait(2).should be_false
|
2191
2191
|
|
2192
2192
|
second_root_call << mock_end
|
2193
|
-
latch.wait(
|
2193
|
+
latch.wait(2).should be_true
|
2194
2194
|
|
2195
2195
|
waiter_thread.join
|
2196
2196
|
dial.status.result.should be == :answer
|
@@ -2215,7 +2215,7 @@ module Adhearsion
|
|
2215
2215
|
sleep 0.5
|
2216
2216
|
|
2217
2217
|
call << mock_end
|
2218
|
-
latch.wait(
|
2218
|
+
latch.wait(2).should be_true
|
2219
2219
|
|
2220
2220
|
waiter_thread.join
|
2221
2221
|
dial.status.result.should be == :answer
|
@@ -2234,7 +2234,7 @@ module Adhearsion
|
|
2234
2234
|
sleep 0.5
|
2235
2235
|
|
2236
2236
|
other_mock_call << mock_end
|
2237
|
-
latch.wait(
|
2237
|
+
latch.wait(2).should be_false
|
2238
2238
|
|
2239
2239
|
[call, second_root_call, second_other_mock_call].each do |call|
|
2240
2240
|
call.should_receive(:unjoin).once.with(mixer_name: mixer).and_return do
|
@@ -2277,7 +2277,7 @@ module Adhearsion
|
|
2277
2277
|
dial.split
|
2278
2278
|
|
2279
2279
|
other_mock_call << mock_end
|
2280
|
-
latch.wait(
|
2280
|
+
latch.wait(2).should be_false
|
2281
2281
|
|
2282
2282
|
[call, second_root_call, second_other_mock_call].each do |call|
|
2283
2283
|
call.should_receive(:join).once.with({mixer_name: mixer}, {}).and_return do
|
@@ -2315,7 +2315,7 @@ module Adhearsion
|
|
2315
2315
|
second_root_call.async << mock_end
|
2316
2316
|
second_other_mock_call.async << mock_end
|
2317
2317
|
|
2318
|
-
latch.wait(
|
2318
|
+
latch.wait(2).should be_true
|
2319
2319
|
|
2320
2320
|
waiter_thread.join
|
2321
2321
|
dial.status.result.should be == :answer
|
@@ -2371,7 +2371,7 @@ module Adhearsion
|
|
2371
2371
|
|
2372
2372
|
t = dial_in_thread
|
2373
2373
|
|
2374
|
-
latch.wait(
|
2374
|
+
latch.wait(2).should be_false
|
2375
2375
|
|
2376
2376
|
other_mock_call << mock_answered
|
2377
2377
|
other_mock_call << mock_end
|
@@ -2395,7 +2395,7 @@ module Adhearsion
|
|
2395
2395
|
|
2396
2396
|
t = dial_in_thread
|
2397
2397
|
|
2398
|
-
latch.wait(
|
2398
|
+
latch.wait(2).should be_false
|
2399
2399
|
|
2400
2400
|
other_mock_call << mock_answered
|
2401
2401
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
@@ -2470,9 +2470,9 @@ module Adhearsion
|
|
2470
2470
|
latch.countdown!
|
2471
2471
|
end
|
2472
2472
|
|
2473
|
-
latch.wait(
|
2473
|
+
latch.wait(2).should be_false
|
2474
2474
|
other_mock_call << mock_end
|
2475
|
-
latch.wait(
|
2475
|
+
latch.wait(2).should be_false
|
2476
2476
|
second_other_mock_call << mock_end
|
2477
2477
|
latch.wait(2).should be_true
|
2478
2478
|
t.join
|
@@ -2511,7 +2511,7 @@ module Adhearsion
|
|
2511
2511
|
other_mock_call << mock_answered
|
2512
2512
|
other_mock_call << mock_end
|
2513
2513
|
|
2514
|
-
latch.wait(
|
2514
|
+
latch.wait(2).should be_true
|
2515
2515
|
|
2516
2516
|
t.join
|
2517
2517
|
status = t.value
|
@@ -2621,7 +2621,7 @@ module Adhearsion
|
|
2621
2621
|
|
2622
2622
|
other_mock_call << mock_answered
|
2623
2623
|
|
2624
|
-
confirmation_latch.wait(
|
2624
|
+
confirmation_latch.wait(2).should be_true
|
2625
2625
|
latch.wait(2).should be_true
|
2626
2626
|
|
2627
2627
|
other_mock_call[:foo].should == 'bar'
|
@@ -2646,7 +2646,7 @@ module Adhearsion
|
|
2646
2646
|
|
2647
2647
|
other_mock_call << mock_answered
|
2648
2648
|
|
2649
|
-
confirmation_latch.wait(
|
2649
|
+
confirmation_latch.wait(2).should be_true
|
2650
2650
|
latch.wait(2).should be_true
|
2651
2651
|
end
|
2652
2652
|
|
@@ -2660,7 +2660,7 @@ module Adhearsion
|
|
2660
2660
|
|
2661
2661
|
t = dial_in_thread
|
2662
2662
|
|
2663
|
-
latch.wait(
|
2663
|
+
latch.wait(2).should be_false
|
2664
2664
|
|
2665
2665
|
base_time = Time.local(2008, 9, 1, 12, 0, 0)
|
2666
2666
|
Timecop.freeze base_time
|
@@ -2671,7 +2671,7 @@ module Adhearsion
|
|
2671
2671
|
Timecop.freeze base_time
|
2672
2672
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
2673
2673
|
|
2674
|
-
latch.wait(
|
2674
|
+
latch.wait(2).should be_true
|
2675
2675
|
|
2676
2676
|
t.join
|
2677
2677
|
status = t.value
|
@@ -2692,11 +2692,11 @@ module Adhearsion
|
|
2692
2692
|
|
2693
2693
|
t = dial_in_thread
|
2694
2694
|
|
2695
|
-
latch.wait(
|
2695
|
+
latch.wait(2).should be_false
|
2696
2696
|
|
2697
2697
|
other_mock_call << mock_answered
|
2698
2698
|
|
2699
|
-
latch.wait(
|
2699
|
+
latch.wait(2).should be_true
|
2700
2700
|
|
2701
2701
|
t.join
|
2702
2702
|
status = t.value
|
@@ -2756,11 +2756,11 @@ module Adhearsion
|
|
2756
2756
|
|
2757
2757
|
t = dial_in_thread
|
2758
2758
|
|
2759
|
-
latch.wait(
|
2759
|
+
latch.wait(2).should be_false
|
2760
2760
|
|
2761
2761
|
other_mock_call.async.deliver_message mock_answered
|
2762
2762
|
second_other_mock_call.async.deliver_message mock_answered
|
2763
|
-
confirmation_latch.wait(
|
2763
|
+
confirmation_latch.wait(2).should be_true
|
2764
2764
|
|
2765
2765
|
sleep 2
|
2766
2766
|
|
@@ -2820,7 +2820,7 @@ module Adhearsion
|
|
2820
2820
|
other_mock_call << mock_answered
|
2821
2821
|
call << mock_end
|
2822
2822
|
|
2823
|
-
latch.wait(
|
2823
|
+
latch.wait(2).should be_true
|
2824
2824
|
end
|
2825
2825
|
end
|
2826
2826
|
end
|