adhearsion 2.5.2 → 2.5.3
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/.hound.yml +2 -0
- data/CHANGELOG.md +6 -1
- data/lib/adhearsion/call.rb +1 -1
- data/lib/adhearsion/call_controller/dial.rb +6 -3
- data/lib/adhearsion/call_controller/output.rb +26 -21
- data/lib/adhearsion/process.rb +5 -0
- data/lib/adhearsion/punchblock_plugin/initializer.rb +2 -2
- data/lib/adhearsion/version.rb +1 -1
- data/spec/adhearsion/call_controller/dial_spec.rb +56 -15
- data/spec/adhearsion/call_controller/output_spec.rb +44 -8
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ac84f37abcd4d6065f62cb0cbfbe7221a411467
|
|
4
|
+
data.tar.gz: d383c431622464439af224ddbe10e69f3a527bf2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 386c467d760ee74861f1d4a409ab3f189343e21cdfc43a88649ebd49a0611588876632f6a8ed34ba2b32beb6e1d2e355371fbce3856bbcf0f7bff4f011ef6c9c
|
|
7
|
+
data.tar.gz: 358821502c81b271be52f17ce523bb6cdca04f06388743b0051f0c5eb01a74bcae891c9149023a5c3ca416159fa80d19459c29b282c54a94d60d7fcc7d203bad
|
data/.hound.yml
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# [develop](https://github.com/adhearsion/adhearsion)
|
|
2
2
|
|
|
3
|
+
# [2.5.3](https://github.com/adhearsion/adhearsion/compare/v2.5.2...v2.5.3) - [2014-04-25](https://rubygems.org/gems/adhearsion/versions/2.5.3)
|
|
4
|
+
* Bugfix: Do not quiesce until the second SIGTERM, as per documentation ([#483](https://github.com/adhearsion/adhearsion/issues/483))
|
|
5
|
+
* Bugfix: Consistent support for output options in all output methods ([#481](https://github.com/adhearsion/adhearsion/issues/481))
|
|
6
|
+
* Bugfix: Use engine timestamps for joined timestamps in `#dial` ([#466](https://github.com/adhearsion/adhearsion/issues/466))
|
|
7
|
+
|
|
3
8
|
# [2.5.2](https://github.com/adhearsion/adhearsion/compare/v2.5.1...v2.5.2) - [2014-04-11](https://rubygems.org/gems/adhearsion/versions/2.5.2)
|
|
4
9
|
* All changes from 2.5.1 (re-released)
|
|
5
|
-
* Further fix for outbound call race conditions. When a Rayo server does not support client-supplied outbound call URIs, or refuses a requested URI by silently replacing it with a different one, the behaviour of Adhearsion falls back to the one with a race condition.
|
|
10
|
+
* Bugfix: Further fix for outbound call race conditions. When a Rayo server does not support client-supplied outbound call URIs, or refuses a requested URI by silently replacing it with a different one, the behaviour of Adhearsion falls back to the one with a race condition.
|
|
6
11
|
|
|
7
12
|
# [2.5.1](https://github.com/adhearsion/adhearsion/compare/v2.5.0...v2.5.1) - [2014-04-07](https://rubygems.org/gems/adhearsion/versions/2.5.1) - yanked
|
|
8
13
|
* Bugfix: Avoid race conditions in event delivery for outbound calls. **note: This requires a Rayo server compliant with Rayo v0.4, which includes changes outlined in [rayo/xmpp#89](https://github.com/rayo/xmpp/issues/89). For FreeSWITCH mod_rayo, this means v1.2.23 of FreeSWITCH or the latest v1.2.stable branch.**([#439](https://github.com/adhearsion/adhearsion/issues/444))
|
data/lib/adhearsion/call.rb
CHANGED
|
@@ -329,7 +329,7 @@ module Adhearsion
|
|
|
329
329
|
# @return [Hash] where :command is the issued command, :joined_waiter is a #wait responder which is triggered when the join is complete, and :unjoined_waiter is a #wait responder which is triggered when the entities are unjoined
|
|
330
330
|
#
|
|
331
331
|
def join(target, options = {})
|
|
332
|
-
logger.
|
|
332
|
+
logger.debug "Joining to #{target}"
|
|
333
333
|
|
|
334
334
|
joined_condition = CountDownLatch.new(1)
|
|
335
335
|
on_joined target do
|
|
@@ -162,6 +162,10 @@ module Adhearsion
|
|
|
162
162
|
new_call.on_answer do |event|
|
|
163
163
|
pre_confirmation_tasks new_call
|
|
164
164
|
|
|
165
|
+
new_call.on_joined @call do |joined|
|
|
166
|
+
join_status.started joined.timestamp.to_time
|
|
167
|
+
end
|
|
168
|
+
|
|
165
169
|
new_call.on_unjoined @call do |unjoined|
|
|
166
170
|
join_status.ended unjoined.timestamp.to_time
|
|
167
171
|
unless @splitting
|
|
@@ -182,7 +186,6 @@ module Adhearsion
|
|
|
182
186
|
logger.info "#dial joining call #{new_call.id} to #{@call.id}"
|
|
183
187
|
pre_join_tasks new_call
|
|
184
188
|
@call.answer
|
|
185
|
-
join_status.started
|
|
186
189
|
new_call.join @join_target, @join_options
|
|
187
190
|
unless @join_target == @call
|
|
188
191
|
@call.join @join_target, @join_options
|
|
@@ -515,8 +518,8 @@ module Adhearsion
|
|
|
515
518
|
@result = :lost_confirmation
|
|
516
519
|
end
|
|
517
520
|
|
|
518
|
-
def started
|
|
519
|
-
@start_time =
|
|
521
|
+
def started(time)
|
|
522
|
+
@start_time = time
|
|
520
523
|
@result = :joined
|
|
521
524
|
end
|
|
522
525
|
|
|
@@ -17,7 +17,7 @@ module Adhearsion
|
|
|
17
17
|
# Speak output using text-to-speech (TTS)
|
|
18
18
|
#
|
|
19
19
|
# @param [String, #to_s] text The text to be rendered
|
|
20
|
-
# @param [Hash] options A set of options for output
|
|
20
|
+
# @param [Hash] options A set of options for output. Includes everything in Punchblock::Component::Output.new.
|
|
21
21
|
#
|
|
22
22
|
# @raise [PlaybackError] if the given argument could not be played
|
|
23
23
|
#
|
|
@@ -31,7 +31,7 @@ module Adhearsion
|
|
|
31
31
|
# Speak output using text-to-speech (TTS) and return as soon as it begins
|
|
32
32
|
#
|
|
33
33
|
# @param [String, #to_s] text The text to be rendered
|
|
34
|
-
# @param [Hash] options A set of options for output
|
|
34
|
+
# @param [Hash] options A set of options for output. Includes everything in Punchblock::Component::Output.new.
|
|
35
35
|
#
|
|
36
36
|
# @raise [PlaybackError] if the given argument could not be played
|
|
37
37
|
#
|
|
@@ -48,7 +48,7 @@ module Adhearsion
|
|
|
48
48
|
# say_characters('abc123')
|
|
49
49
|
#
|
|
50
50
|
# @param [String, #to_s] characters The string of characters to be spoken
|
|
51
|
-
# @param [Hash] options A set of options for output
|
|
51
|
+
# @param [Hash] options A set of options for output. Includes everything in Punchblock::Component::Output.new.
|
|
52
52
|
#
|
|
53
53
|
# @raise [PlaybackError] if the given argument could not be played
|
|
54
54
|
#
|
|
@@ -63,7 +63,7 @@ module Adhearsion
|
|
|
63
63
|
# say_characters!('abc123')
|
|
64
64
|
#
|
|
65
65
|
# @param [String, #to_s] characters The string of characters to be spoken
|
|
66
|
-
# @param [Hash] options A set of options for output
|
|
66
|
+
# @param [Hash] options A set of options for output. Includes everything in Punchblock::Component::Output.new.
|
|
67
67
|
#
|
|
68
68
|
# @raise [PlaybackError] if the given argument could not be played
|
|
69
69
|
#
|
|
@@ -77,6 +77,9 @@ module Adhearsion
|
|
|
77
77
|
# pass in as an array with the first parameter as the Date/Time/DateTime object along with a hash with the
|
|
78
78
|
# additional options. See play_time for more information.
|
|
79
79
|
#
|
|
80
|
+
# @param [Array<String, Fixnum, Time, Date>, String, Fixnum, Time, Date] outputs A collection of outputs to render.
|
|
81
|
+
# @param [Hash] options A set of options for output. Includes everything in Punchblock::Component::Output.new.
|
|
82
|
+
#
|
|
80
83
|
# @example Play file hello-world
|
|
81
84
|
# play 'http://www.example.com/hello-world.mp3'
|
|
82
85
|
# play '/path/on/disk/hello-world.wav'
|
|
@@ -108,6 +111,9 @@ module Adhearsion
|
|
|
108
111
|
# pass in as an array with the first parameter as the Date/Time/DateTime object along with a hash with the
|
|
109
112
|
# additional options. See play_time for more information.
|
|
110
113
|
#
|
|
114
|
+
# @param [Array<String, Fixnum, Time, Date>, String, Fixnum, Time, Date] outputs A collection of outputs to render.
|
|
115
|
+
# @param [Hash] options A set of options for output. Includes everything in Punchblock::Component::Output.new.
|
|
116
|
+
#
|
|
111
117
|
# @example Play file hello-world
|
|
112
118
|
# play 'http://www.example.com/hello-world.mp3'
|
|
113
119
|
# play '/path/on/disk/hello-world.wav'
|
|
@@ -139,15 +145,13 @@ module Adhearsion
|
|
|
139
145
|
# The Punchblock backend will have to handle cases like Asterisk where there is a fixed sounds directory.
|
|
140
146
|
#
|
|
141
147
|
# @param [String] file http:// URL or full disk path to the sound file
|
|
142
|
-
# @param [Hash] options Additional options
|
|
148
|
+
# @param [Hash] options Additional options Includes everything in Punchblock::Component::Output.new.
|
|
143
149
|
# @option options [String] :fallback The text to play if the file is not available
|
|
144
|
-
# @option options [Symbol] :renderer The media engine to use for rendering the file
|
|
145
150
|
#
|
|
146
151
|
# @raise [PlaybackError] if (one of) the given argument(s) could not be played
|
|
147
152
|
#
|
|
148
153
|
def play_audio(file, options = {})
|
|
149
|
-
|
|
150
|
-
player.play_ssml(output_formatter.ssml_for_audio(file, options), renderer: renderer)
|
|
154
|
+
player.play_ssml(output_formatter.ssml_for_audio(file, options), options)
|
|
151
155
|
true
|
|
152
156
|
end
|
|
153
157
|
|
|
@@ -157,15 +161,14 @@ module Adhearsion
|
|
|
157
161
|
# The Punchblock backend will have to handle cases like Asterisk where there is a fixed sounds directory.
|
|
158
162
|
#
|
|
159
163
|
# @param [String] file http:// URL or full disk path to the sound file
|
|
160
|
-
# @param [Hash] options Additional options to specify how exactly to say time specified.
|
|
164
|
+
# @param [Hash] options Additional options to specify how exactly to say time specified. Includes everything in Punchblock::Component::Output.new.
|
|
161
165
|
# @option options [String] :fallback The text to play if the file is not available
|
|
162
166
|
#
|
|
163
167
|
# @raise [PlaybackError] if (one of) the given argument(s) could not be played
|
|
164
168
|
# @return [Punchblock::Component::Output]
|
|
165
169
|
#
|
|
166
170
|
def play_audio!(file, options = {})
|
|
167
|
-
|
|
168
|
-
async_player.play_ssml(output_formatter.ssml_for_audio(file, options), renderer: renderer)
|
|
171
|
+
async_player.play_ssml(output_formatter.ssml_for_audio(file, options), options)
|
|
169
172
|
end
|
|
170
173
|
|
|
171
174
|
#
|
|
@@ -173,7 +176,7 @@ module Adhearsion
|
|
|
173
176
|
# using the given timezone and format.
|
|
174
177
|
#
|
|
175
178
|
# @param [Date, Time, DateTime] time Time to be said.
|
|
176
|
-
# @param [Hash] options Additional options to specify how exactly to say time specified.
|
|
179
|
+
# @param [Hash] options Additional options to specify how exactly to say time specified. Includes everything in Punchblock::Component::Output.new.
|
|
177
180
|
# @option options [String] :format This format is used only to disambiguate times that could be interpreted in different ways.
|
|
178
181
|
# For example, 01/06/2011 could mean either the 1st of June or the 6th of January.
|
|
179
182
|
# Please refer to the SSML specification.
|
|
@@ -185,7 +188,7 @@ module Adhearsion
|
|
|
185
188
|
#
|
|
186
189
|
def play_time(time, options = {})
|
|
187
190
|
raise ArgumentError unless [Date, Time, DateTime].include?(time.class) && options.is_a?(Hash)
|
|
188
|
-
player.play_ssml output_formatter.ssml_for_time(time, options)
|
|
191
|
+
player.play_ssml output_formatter.ssml_for_time(time, options), options
|
|
189
192
|
true
|
|
190
193
|
end
|
|
191
194
|
|
|
@@ -194,7 +197,7 @@ module Adhearsion
|
|
|
194
197
|
# using the given timezone and format and returns as soon as it begins.
|
|
195
198
|
#
|
|
196
199
|
# @param [Date, Time, DateTime] time Time to be said.
|
|
197
|
-
# @param [Hash] options Additional options to specify how exactly to say time specified.
|
|
200
|
+
# @param [Hash] options Additional options to specify how exactly to say time specified. Includes everything in Punchblock::Component::Output.new.
|
|
198
201
|
# @option options [String] :format This format is used only to disambiguate times that could be interpreted in different ways.
|
|
199
202
|
# For example, 01/06/2011 could mean either the 1st of June or the 6th of January.
|
|
200
203
|
# Please refer to the SSML specification.
|
|
@@ -207,7 +210,7 @@ module Adhearsion
|
|
|
207
210
|
#
|
|
208
211
|
def play_time!(time, options = {})
|
|
209
212
|
raise ArgumentError unless [Date, Time, DateTime].include?(time.class) && options.is_a?(Hash)
|
|
210
|
-
async_player.play_ssml output_formatter.ssml_for_time(time, options)
|
|
213
|
+
async_player.play_ssml output_formatter.ssml_for_time(time, options), options
|
|
211
214
|
end
|
|
212
215
|
|
|
213
216
|
#
|
|
@@ -216,12 +219,13 @@ module Adhearsion
|
|
|
216
219
|
# is pronounced as "one hundred" instead of "one zero zero".
|
|
217
220
|
#
|
|
218
221
|
# @param [Numeric, String] number Numeric or String containing a valid Numeric, like "321".
|
|
222
|
+
# @param [Hash] options A set of options for output. See Punchblock::Component::Output.new for details.
|
|
219
223
|
#
|
|
220
224
|
# @raise [ArgumentError] if the given argument can not be played
|
|
221
225
|
#
|
|
222
|
-
def play_numeric(number)
|
|
226
|
+
def play_numeric(number, options = {})
|
|
223
227
|
raise ArgumentError unless number.kind_of?(Numeric) || number =~ /^\d+$/
|
|
224
|
-
player.play_ssml output_formatter.ssml_for_numeric(number)
|
|
228
|
+
player.play_ssml output_formatter.ssml_for_numeric(number), options
|
|
225
229
|
true
|
|
226
230
|
end
|
|
227
231
|
|
|
@@ -231,13 +235,14 @@ module Adhearsion
|
|
|
231
235
|
# is pronounced as "one hundred" instead of "one zero zero".
|
|
232
236
|
#
|
|
233
237
|
# @param [Numeric, String] number Numeric or String containing a valid Numeric, like "321".
|
|
238
|
+
# @param [Hash] options A set of options for output. See Punchblock::Component::Output.new for details.
|
|
234
239
|
#
|
|
235
240
|
# @raise [ArgumentError] if the given argument can not be played
|
|
236
241
|
# @return [Punchblock::Component::Output]
|
|
237
242
|
#
|
|
238
|
-
def play_numeric!(number)
|
|
243
|
+
def play_numeric!(number, options = {})
|
|
239
244
|
raise ArgumentError unless number.kind_of?(Numeric) || number =~ /^\d+$/
|
|
240
|
-
async_player.play_ssml output_formatter.ssml_for_numeric(number)
|
|
245
|
+
async_player.play_ssml output_formatter.ssml_for_numeric(number), options
|
|
241
246
|
end
|
|
242
247
|
|
|
243
248
|
#
|
|
@@ -296,12 +301,12 @@ module Adhearsion
|
|
|
296
301
|
|
|
297
302
|
# @private
|
|
298
303
|
def player
|
|
299
|
-
|
|
304
|
+
Player.new(self)
|
|
300
305
|
end
|
|
301
306
|
|
|
302
307
|
# @private
|
|
303
308
|
def async_player
|
|
304
|
-
|
|
309
|
+
AsyncPlayer.new(self)
|
|
305
310
|
end
|
|
306
311
|
|
|
307
312
|
# @private
|
data/lib/adhearsion/process.rb
CHANGED
|
@@ -11,6 +11,7 @@ module Adhearsion
|
|
|
11
11
|
state_machine :initial => :booting do
|
|
12
12
|
before_transition :log_state_change
|
|
13
13
|
after_transition :on => :shutdown, :do => :request_stop
|
|
14
|
+
after_transition any => :rejecting, :do => :quiesce
|
|
14
15
|
after_transition any => :stopped, :do => :final_shutdown
|
|
15
16
|
before_transition any => :force_stopped, :do => :die_now!
|
|
16
17
|
|
|
@@ -72,6 +73,10 @@ module Adhearsion
|
|
|
72
73
|
important_threads << Thread.new { stop_when_zero_calls }
|
|
73
74
|
end
|
|
74
75
|
|
|
76
|
+
def quiesce
|
|
77
|
+
Events.trigger_immediately :quiesced
|
|
78
|
+
end
|
|
79
|
+
|
|
75
80
|
def final_shutdown
|
|
76
81
|
Adhearsion.active_calls.each do |_, call|
|
|
77
82
|
call.hangup
|
|
@@ -37,9 +37,9 @@ module Adhearsion
|
|
|
37
37
|
connection.ready!
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
# When
|
|
40
|
+
# When quiescence is requested, change our status to "Do Not Disturb"
|
|
41
41
|
# This should prevent the telephony engine from sending us any new calls.
|
|
42
|
-
Events.register_callback :
|
|
42
|
+
Events.register_callback :quiesced do
|
|
43
43
|
connection.not_ready! if connection.connected?
|
|
44
44
|
end
|
|
45
45
|
|
data/lib/adhearsion/version.rb
CHANGED
|
@@ -265,7 +265,10 @@ module Adhearsion
|
|
|
265
265
|
context "when the call is answered and joined" do
|
|
266
266
|
it "has an overall dial status of :answer" do
|
|
267
267
|
call.should_receive(:answer).once
|
|
268
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
268
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
269
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
270
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
271
|
+
end
|
|
269
272
|
|
|
270
273
|
t = dial_in_thread
|
|
271
274
|
|
|
@@ -286,7 +289,10 @@ module Adhearsion
|
|
|
286
289
|
|
|
287
290
|
it "records the duration of the join" do
|
|
288
291
|
call.should_receive(:answer).once
|
|
289
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
292
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
293
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
294
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
295
|
+
end
|
|
290
296
|
other_mock_call.stub hangup: true
|
|
291
297
|
|
|
292
298
|
t = dial_in_thread
|
|
@@ -341,7 +347,10 @@ module Adhearsion
|
|
|
341
347
|
|
|
342
348
|
before do
|
|
343
349
|
call.should_receive(:answer).once
|
|
344
|
-
other_mock_call.should_receive(:join).once.with(join_target, join_options)
|
|
350
|
+
other_mock_call.should_receive(:join).once.with(join_target, join_options).and_return do
|
|
351
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
352
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
353
|
+
end
|
|
345
354
|
other_mock_call.stub(:unjoin).and_return do
|
|
346
355
|
call << Punchblock::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
347
356
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
|
@@ -1323,10 +1332,12 @@ module Adhearsion
|
|
|
1323
1332
|
end
|
|
1324
1333
|
|
|
1325
1334
|
it "should join the calls if the call is still active after execution of the call controller" do
|
|
1326
|
-
other_mock_call.should_receive(:hangup).once
|
|
1327
1335
|
other_mock_call['confirm'] = true
|
|
1328
1336
|
call.should_receive(:answer).once
|
|
1329
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
1337
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
1338
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1339
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1340
|
+
end
|
|
1330
1341
|
|
|
1331
1342
|
t = dial_in_thread
|
|
1332
1343
|
|
|
@@ -1398,7 +1409,10 @@ module Adhearsion
|
|
|
1398
1409
|
call.should_receive(:answer).once
|
|
1399
1410
|
|
|
1400
1411
|
other_mock_call.should_receive(:dial).once.with(to, from: nil)
|
|
1401
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
1412
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
1413
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1414
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1415
|
+
end
|
|
1402
1416
|
other_mock_call.should_receive(:hangup).once.and_return do
|
|
1403
1417
|
other_mock_call << mock_end
|
|
1404
1418
|
end
|
|
@@ -1668,7 +1682,10 @@ module Adhearsion
|
|
|
1668
1682
|
context "when the call is answered and joined" do
|
|
1669
1683
|
it "has an overall dial status of :answer" do
|
|
1670
1684
|
call.should_receive(:answer).once
|
|
1671
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
1685
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
1686
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1687
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1688
|
+
end
|
|
1672
1689
|
|
|
1673
1690
|
t = dial_in_thread
|
|
1674
1691
|
|
|
@@ -1689,7 +1706,10 @@ module Adhearsion
|
|
|
1689
1706
|
|
|
1690
1707
|
it "records the duration of the join" do
|
|
1691
1708
|
call.should_receive(:answer).once
|
|
1692
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
1709
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
1710
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1711
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1712
|
+
end
|
|
1693
1713
|
other_mock_call.stub hangup: true
|
|
1694
1714
|
|
|
1695
1715
|
t = dial_in_thread
|
|
@@ -1720,7 +1740,10 @@ module Adhearsion
|
|
|
1720
1740
|
|
|
1721
1741
|
it "joins the calls with those options" do
|
|
1722
1742
|
call.should_receive(:answer).once
|
|
1723
|
-
other_mock_call.should_receive(:join).once.with(call, media: :direct)
|
|
1743
|
+
other_mock_call.should_receive(:join).once.with(call, media: :direct).and_return do
|
|
1744
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1745
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1746
|
+
end
|
|
1724
1747
|
other_mock_call.stub hangup: true
|
|
1725
1748
|
|
|
1726
1749
|
t = dial_in_thread
|
|
@@ -1744,7 +1767,10 @@ module Adhearsion
|
|
|
1744
1767
|
|
|
1745
1768
|
before do
|
|
1746
1769
|
call.should_receive(:answer).once
|
|
1747
|
-
other_mock_call.should_receive(:join).once.with(join_target, join_options)
|
|
1770
|
+
other_mock_call.should_receive(:join).once.with(join_target, join_options).and_return do
|
|
1771
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1772
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1773
|
+
end
|
|
1748
1774
|
other_mock_call.stub(:unjoin).and_return do
|
|
1749
1775
|
call << Punchblock::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
1750
1776
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
|
@@ -1912,7 +1938,10 @@ module Adhearsion
|
|
|
1912
1938
|
|
|
1913
1939
|
dial.split
|
|
1914
1940
|
|
|
1915
|
-
other_mock_call.should_receive(:join).once.ordered.with(call, {})
|
|
1941
|
+
other_mock_call.should_receive(:join).once.ordered.with(call, {}).and_return do
|
|
1942
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1943
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1944
|
+
end
|
|
1916
1945
|
dial.rejoin
|
|
1917
1946
|
|
|
1918
1947
|
other_mock_call << mock_end
|
|
@@ -1936,7 +1965,10 @@ module Adhearsion
|
|
|
1936
1965
|
|
|
1937
1966
|
dial.split
|
|
1938
1967
|
|
|
1939
|
-
other_mock_call.should_receive(:join).once.ordered.with(call, media: :direct)
|
|
1968
|
+
other_mock_call.should_receive(:join).once.ordered.with(call, media: :direct).and_return do
|
|
1969
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1970
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1971
|
+
end
|
|
1940
1972
|
dial.rejoin
|
|
1941
1973
|
end
|
|
1942
1974
|
end
|
|
@@ -1952,7 +1984,10 @@ module Adhearsion
|
|
|
1952
1984
|
|
|
1953
1985
|
dial.split
|
|
1954
1986
|
|
|
1955
|
-
other_mock_call.should_receive(:join).once.ordered.with(call, media: :direct)
|
|
1987
|
+
other_mock_call.should_receive(:join).once.ordered.with(call, media: :direct).and_return do
|
|
1988
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
1989
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
1990
|
+
end
|
|
1956
1991
|
dial.rejoin nil, media: :direct
|
|
1957
1992
|
end
|
|
1958
1993
|
end
|
|
@@ -2656,7 +2691,10 @@ module Adhearsion
|
|
|
2656
2691
|
end
|
|
2657
2692
|
other_mock_call['confirm'] = true
|
|
2658
2693
|
call.should_receive(:answer).once
|
|
2659
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
2694
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
2695
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
2696
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
2697
|
+
end
|
|
2660
2698
|
|
|
2661
2699
|
t = dial_in_thread
|
|
2662
2700
|
|
|
@@ -2743,7 +2781,10 @@ module Adhearsion
|
|
|
2743
2781
|
call.should_receive(:answer).once
|
|
2744
2782
|
|
|
2745
2783
|
other_mock_call.should_receive(:dial).once.with(to, from: nil)
|
|
2746
|
-
other_mock_call.should_receive(:join).once.with(call, {})
|
|
2784
|
+
other_mock_call.should_receive(:join).once.with(call, {}).and_return do
|
|
2785
|
+
call << Punchblock::Event::Joined.new(call_uri: other_mock_call.id)
|
|
2786
|
+
other_mock_call << Punchblock::Event::Joined.new(call_uri: call.id)
|
|
2787
|
+
end
|
|
2747
2788
|
other_mock_call.should_receive(:hangup).once.and_return do
|
|
2748
2789
|
other_mock_call.async.deliver_message mock_end
|
|
2749
2790
|
end
|
|
@@ -22,10 +22,6 @@ module Adhearsion
|
|
|
22
22
|
player.should be_a Output::Player
|
|
23
23
|
player.controller.should be controller
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
it "should return the same player every time" do
|
|
27
|
-
controller.player.should be controller.player
|
|
28
|
-
end
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
describe "#async_player" do
|
|
@@ -34,10 +30,6 @@ module Adhearsion
|
|
|
34
30
|
player.should be_a Output::AsyncPlayer
|
|
35
31
|
player.controller.should be controller
|
|
36
32
|
end
|
|
37
|
-
|
|
38
|
-
it "should return the same player every time" do
|
|
39
|
-
controller.async_player.should be controller.async_player
|
|
40
|
-
end
|
|
41
33
|
end
|
|
42
34
|
|
|
43
35
|
describe "#play_audio" do
|
|
@@ -150,6 +142,16 @@ module Adhearsion
|
|
|
150
142
|
lambda { subject.play_numeric input }.should raise_error(ArgumentError)
|
|
151
143
|
end
|
|
152
144
|
end
|
|
145
|
+
|
|
146
|
+
context "with a renderer" do
|
|
147
|
+
let(:input) { 123 }
|
|
148
|
+
let(:renderer) { :native }
|
|
149
|
+
|
|
150
|
+
it "should use the specified renderer in the SSML" do
|
|
151
|
+
expect_ssml_output ssml, renderer: renderer
|
|
152
|
+
subject.play_numeric(input, renderer: renderer).should be true
|
|
153
|
+
end
|
|
154
|
+
end
|
|
153
155
|
end
|
|
154
156
|
|
|
155
157
|
describe "#play_numeric!" do
|
|
@@ -184,6 +186,16 @@ module Adhearsion
|
|
|
184
186
|
lambda { subject.play_numeric! input }.should raise_error(ArgumentError)
|
|
185
187
|
end
|
|
186
188
|
end
|
|
189
|
+
|
|
190
|
+
context "with a renderer" do
|
|
191
|
+
let(:input) { 123 }
|
|
192
|
+
let(:renderer) { :native }
|
|
193
|
+
|
|
194
|
+
it "should use the specified renderer in the SSML" do
|
|
195
|
+
expect_async_ssml_output ssml, renderer: renderer
|
|
196
|
+
subject.play_numeric!(input, renderer: renderer).should be_a Punchblock::Component::Output
|
|
197
|
+
end
|
|
198
|
+
end
|
|
187
199
|
end
|
|
188
200
|
|
|
189
201
|
describe "#play_time" do
|
|
@@ -251,6 +263,18 @@ module Adhearsion
|
|
|
251
263
|
end
|
|
252
264
|
end
|
|
253
265
|
|
|
266
|
+
context "with a renderer" do
|
|
267
|
+
let(:renderer) { :native }
|
|
268
|
+
let(:input) { Date.parse('2011-01-23') }
|
|
269
|
+
let(:format) { "d-m-y" }
|
|
270
|
+
let(:expected_say_as_options) { {:interpret_as => 'date', :format => format} }
|
|
271
|
+
|
|
272
|
+
it "should use the specified renderer in the SSML" do
|
|
273
|
+
expect_ssml_output ssml, renderer: renderer
|
|
274
|
+
subject.play_time(input, format: format, renderer: renderer).should be true
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
254
278
|
describe "with an object other than Time, DateTime, or Date" do
|
|
255
279
|
let(:input) { "foo" }
|
|
256
280
|
|
|
@@ -325,6 +349,18 @@ module Adhearsion
|
|
|
325
349
|
end
|
|
326
350
|
end
|
|
327
351
|
|
|
352
|
+
context "with a renderer" do
|
|
353
|
+
let(:renderer) { :native }
|
|
354
|
+
let(:input) { Date.parse('2011-01-23') }
|
|
355
|
+
let(:format) { "d-m-y" }
|
|
356
|
+
let(:expected_say_as_options) { {:interpret_as => 'date', :format => format} }
|
|
357
|
+
|
|
358
|
+
it "should use the specified renderer in the SSML" do
|
|
359
|
+
expect_async_ssml_output ssml, renderer: renderer
|
|
360
|
+
subject.play_time!(input, format: format, renderer: renderer).should be_a Punchblock::Component::Output
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
|
|
328
364
|
describe "with an object other than Time, DateTime, or Date" do
|
|
329
365
|
let(:input) { "foo" }
|
|
330
366
|
|
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.5.
|
|
4
|
+
version: 2.5.3
|
|
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: 2014-04-
|
|
14
|
+
date: 2014-04-25 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: activesupport
|
|
@@ -405,6 +405,7 @@ extensions: []
|
|
|
405
405
|
extra_rdoc_files: []
|
|
406
406
|
files:
|
|
407
407
|
- ".gitignore"
|
|
408
|
+
- ".hound.yml"
|
|
408
409
|
- ".rspec"
|
|
409
410
|
- ".travis.yml"
|
|
410
411
|
- ".yardopts"
|