punchblock 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 -0
- data/README.markdown +2 -1
- data/lib/punchblock/translator/asterisk/call.rb +3 -3
- data/lib/punchblock/translator/asterisk/component/mrcp_recog_prompt.rb +15 -9
- data/lib/punchblock/translator/asterisk/component/output.rb +8 -1
- data/lib/punchblock/translator/input_component.rb +2 -0
- data/lib/punchblock/version.rb +1 -1
- data/punchblock.gemspec +1 -1
- data/spec/punchblock/client/component_registry_spec.rb +3 -3
- data/spec/punchblock/client_spec.rb +22 -15
- data/spec/punchblock/command/accept_spec.rb +17 -7
- data/spec/punchblock/command/answer_spec.rb +19 -9
- data/spec/punchblock/command/dial_spec.rb +76 -27
- data/spec/punchblock/command/hangup_spec.rb +17 -7
- data/spec/punchblock/command/join_spec.rb +78 -24
- data/spec/punchblock/command/mute_spec.rb +3 -3
- data/spec/punchblock/command/redirect_spec.rb +33 -12
- data/spec/punchblock/command/reject_spec.rb +41 -14
- data/spec/punchblock/command/unjoin_spec.rb +29 -12
- data/spec/punchblock/command/unmute_spec.rb +3 -3
- data/spec/punchblock/command_node_spec.rb +43 -20
- data/spec/punchblock/component/asterisk/agi/command_spec.rb +52 -12
- data/spec/punchblock/component/asterisk/ami/action_spec.rb +69 -21
- data/spec/punchblock/component/component_node_spec.rb +12 -12
- data/spec/punchblock/component/input_spec.rb +304 -87
- data/spec/punchblock/component/output_spec.rb +434 -173
- data/spec/punchblock/component/prompt_spec.rb +63 -20
- data/spec/punchblock/component/receive_fax_spec.rb +43 -14
- data/spec/punchblock/component/record_spec.rb +215 -71
- data/spec/punchblock/component/send_fax_spec.rb +54 -15
- data/spec/punchblock/connection/asterisk_spec.rb +34 -24
- data/spec/punchblock/connection/freeswitch_spec.rb +9 -9
- data/spec/punchblock/connection/xmpp_spec.rb +92 -83
- data/spec/punchblock/event/answered_spec.rb +14 -4
- data/spec/punchblock/event/asterisk/ami/event_spec.rb +34 -12
- data/spec/punchblock/event/complete_spec.rb +36 -16
- data/spec/punchblock/event/dtmf_spec.rb +9 -3
- data/spec/punchblock/event/end_spec.rb +43 -10
- data/spec/punchblock/event/input_timers_started_spec.rb +1 -1
- data/spec/punchblock/event/joined_spec.rb +29 -7
- data/spec/punchblock/event/offer_spec.rb +41 -10
- data/spec/punchblock/event/ringing_spec.rb +14 -4
- data/spec/punchblock/event/started_speaking_spec.rb +9 -3
- data/spec/punchblock/event/stopped_speaking_spec.rb +9 -3
- data/spec/punchblock/event/unjoined_spec.rb +24 -6
- data/spec/punchblock/protocol_error_spec.rb +16 -13
- data/spec/punchblock/ref_spec.rb +90 -26
- data/spec/punchblock/translator/asterisk/call_spec.rb +176 -161
- data/spec/punchblock/translator/asterisk/component/asterisk/agi_command_spec.rb +18 -18
- data/spec/punchblock/translator/asterisk/component/asterisk/ami_action_spec.rb +9 -9
- data/spec/punchblock/translator/asterisk/component/composed_prompt_spec.rb +14 -14
- data/spec/punchblock/translator/asterisk/component/input_spec.rb +57 -36
- data/spec/punchblock/translator/asterisk/component/mrcp_native_prompt_spec.rb +50 -50
- data/spec/punchblock/translator/asterisk/component/mrcp_prompt_spec.rb +59 -48
- data/spec/punchblock/translator/asterisk/component/output_spec.rb +231 -221
- data/spec/punchblock/translator/asterisk/component/record_spec.rb +82 -82
- data/spec/punchblock/translator/asterisk/component/stop_by_redirect_spec.rb +10 -10
- data/spec/punchblock/translator/asterisk/component_spec.rb +4 -4
- data/spec/punchblock/translator/asterisk_spec.rb +89 -82
- data/spec/punchblock/translator/freeswitch/call_spec.rb +114 -99
- data/spec/punchblock/translator/freeswitch/component/flite_output_spec.rb +19 -19
- data/spec/punchblock/translator/freeswitch/component/input_spec.rb +24 -24
- data/spec/punchblock/translator/freeswitch/component/output_spec.rb +23 -23
- data/spec/punchblock/translator/freeswitch/component/record_spec.rb +78 -78
- data/spec/punchblock/translator/freeswitch/component/tts_output_spec.rb +19 -19
- data/spec/punchblock/translator/freeswitch/component_spec.rb +8 -8
- data/spec/punchblock/translator/freeswitch_spec.rb +66 -59
- data/spec/punchblock/uri_list_spec.rb +45 -10
- data/spec/punchblock_spec.rb +13 -13
- data/spec/spec_helper.rb +18 -11
- data/spec/support/mock_connection_with_event_handler.rb +1 -1
- metadata +5 -4
|
@@ -35,7 +35,7 @@ module Punchblock
|
|
|
35
35
|
describe '#execute' do
|
|
36
36
|
before { original_command.request! }
|
|
37
37
|
def expect_playback(voice = :kal, doc = "FOO")
|
|
38
|
-
subject.wrapped_object.
|
|
38
|
+
expect(subject.wrapped_object).to receive(:application).once.with :speak, "flite|#{voice}|#{doc}"
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
let(:command_opts) { {} }
|
|
@@ -54,7 +54,7 @@ module Punchblock
|
|
|
54
54
|
it "should return an error and not execute any actions" do
|
|
55
55
|
execute
|
|
56
56
|
error = ProtocolError.new.setup 'option error', 'An SSML document is required.'
|
|
57
|
-
original_command.response(0.1).
|
|
57
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -68,7 +68,7 @@ module Punchblock
|
|
|
68
68
|
expect_playback
|
|
69
69
|
execute
|
|
70
70
|
subject.handle_es_event RubyFS::Event.new(nil, :event_name => "CHANNEL_EXECUTE_COMPLETE")
|
|
71
|
-
original_command.complete_event(0.1).reason.
|
|
71
|
+
expect(original_command.complete_event(0.1).reason).to be_a Punchblock::Component::Output::Complete::Finish
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -96,7 +96,7 @@ module Punchblock
|
|
|
96
96
|
it "should return an error and not execute any actions" do
|
|
97
97
|
execute
|
|
98
98
|
error = ProtocolError.new.setup 'option error', 'A start_offset value is unsupported.'
|
|
99
|
-
original_command.response(0.1).
|
|
99
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
end
|
|
@@ -115,7 +115,7 @@ module Punchblock
|
|
|
115
115
|
it "should return an error and not execute any actions" do
|
|
116
116
|
execute
|
|
117
117
|
error = ProtocolError.new.setup 'option error', 'A start_paused value is unsupported.'
|
|
118
|
-
original_command.response(0.1).
|
|
118
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
end
|
|
@@ -134,7 +134,7 @@ module Punchblock
|
|
|
134
134
|
it "should return an error and not execute any actions" do
|
|
135
135
|
execute
|
|
136
136
|
error = ProtocolError.new.setup 'option error', 'A repeat_interval value is unsupported.'
|
|
137
|
-
original_command.response(0.1).
|
|
137
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
end
|
|
@@ -153,7 +153,7 @@ module Punchblock
|
|
|
153
153
|
it "should return an error and not execute any actions" do
|
|
154
154
|
execute
|
|
155
155
|
error = ProtocolError.new.setup 'option error', 'A repeat_times value is unsupported.'
|
|
156
|
-
original_command.response(0.1).
|
|
156
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
157
157
|
end
|
|
158
158
|
end
|
|
159
159
|
end
|
|
@@ -172,7 +172,7 @@ module Punchblock
|
|
|
172
172
|
it "should return an error and not execute any actions" do
|
|
173
173
|
execute
|
|
174
174
|
error = ProtocolError.new.setup 'option error', 'A max_time value is unsupported.'
|
|
175
|
-
original_command.response(0.1).
|
|
175
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
176
176
|
end
|
|
177
177
|
end
|
|
178
178
|
end
|
|
@@ -209,7 +209,7 @@ module Punchblock
|
|
|
209
209
|
it "should return an error and not execute any actions" do
|
|
210
210
|
execute
|
|
211
211
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of any is unsupported.'
|
|
212
|
-
original_command.response(0.1).
|
|
212
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
213
213
|
end
|
|
214
214
|
end
|
|
215
215
|
|
|
@@ -218,7 +218,7 @@ module Punchblock
|
|
|
218
218
|
it "should return an error and not execute any actions" do
|
|
219
219
|
execute
|
|
220
220
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of dtmf is unsupported.'
|
|
221
|
-
original_command.response(0.1).
|
|
221
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
222
222
|
end
|
|
223
223
|
end
|
|
224
224
|
|
|
@@ -227,7 +227,7 @@ module Punchblock
|
|
|
227
227
|
it "should return an error and not execute any actions" do
|
|
228
228
|
execute
|
|
229
229
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of voice is unsupported.'
|
|
230
|
-
original_command.response(0.1).
|
|
230
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
231
231
|
end
|
|
232
232
|
end
|
|
233
233
|
end
|
|
@@ -241,7 +241,7 @@ module Punchblock
|
|
|
241
241
|
|
|
242
242
|
it "returns a ProtocolError response" do
|
|
243
243
|
subject.execute_command command
|
|
244
|
-
command.response(0.1).
|
|
244
|
+
expect(command.response(0.1)).to be_a ProtocolError
|
|
245
245
|
end
|
|
246
246
|
end
|
|
247
247
|
|
|
@@ -256,21 +256,21 @@ module Punchblock
|
|
|
256
256
|
end
|
|
257
257
|
|
|
258
258
|
it "sets the command response to true" do
|
|
259
|
-
subject.wrapped_object.
|
|
259
|
+
expect(subject.wrapped_object).to receive(:application)
|
|
260
260
|
subject.execute_command command
|
|
261
|
-
command.response(0.1).
|
|
261
|
+
expect(command.response(0.1)).to eq(true)
|
|
262
262
|
end
|
|
263
263
|
|
|
264
264
|
it "sends the correct complete event" do
|
|
265
|
-
subject.wrapped_object.
|
|
266
|
-
original_command.
|
|
265
|
+
expect(subject.wrapped_object).to receive(:application)
|
|
266
|
+
expect(original_command).not_to be_complete
|
|
267
267
|
subject.execute_command command
|
|
268
|
-
reason.
|
|
269
|
-
original_command.
|
|
268
|
+
expect(reason).to be_a Punchblock::Event::Complete::Stop
|
|
269
|
+
expect(original_command).to be_complete
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
it "breaks the current dialplan application" do
|
|
273
|
-
subject.wrapped_object.
|
|
273
|
+
expect(subject.wrapped_object).to receive(:application).once.with 'break'
|
|
274
274
|
subject.execute_command command
|
|
275
275
|
end
|
|
276
276
|
end
|
|
@@ -88,11 +88,11 @@ module Punchblock
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
it "should send a success complete event with the relevant data" do
|
|
91
|
-
reason.
|
|
91
|
+
expect(reason).to eq(expected_event)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "should not process further dtmf events" do
|
|
95
|
-
subject.async.
|
|
95
|
+
expect(subject.async).to receive(:process_dtmf).never
|
|
96
96
|
send_dtmf 3
|
|
97
97
|
end
|
|
98
98
|
end
|
|
@@ -108,7 +108,7 @@ module Punchblock
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
it "should send a nomatch complete event" do
|
|
111
|
-
reason.
|
|
111
|
+
expect(reason).to eq(expected_event)
|
|
112
112
|
end
|
|
113
113
|
end
|
|
114
114
|
end
|
|
@@ -119,7 +119,7 @@ module Punchblock
|
|
|
119
119
|
it "should return an error and not execute any actions" do
|
|
120
120
|
subject.execute
|
|
121
121
|
error = ProtocolError.new.setup 'option error', 'A grammar document is required.'
|
|
122
|
-
original_command.response(0.1).
|
|
122
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -146,7 +146,7 @@ module Punchblock
|
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
it "should use RubySpeech builtin grammar" do
|
|
149
|
-
reason.
|
|
149
|
+
expect(reason).to eq(expected_event)
|
|
150
150
|
end
|
|
151
151
|
end
|
|
152
152
|
|
|
@@ -173,7 +173,7 @@ module Punchblock
|
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
it "should use RubySpeech builtin grammar" do
|
|
176
|
-
reason.
|
|
176
|
+
expect(reason).to eq(expected_event)
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
@@ -183,7 +183,7 @@ module Punchblock
|
|
|
183
183
|
it "should return an error and not execute any actions" do
|
|
184
184
|
subject.execute
|
|
185
185
|
error = ProtocolError.new.setup 'option error', 'foobar is an invalid builtin grammar'
|
|
186
|
-
original_command.response(0.1).
|
|
186
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
187
187
|
end
|
|
188
188
|
end
|
|
189
189
|
|
|
@@ -192,7 +192,7 @@ module Punchblock
|
|
|
192
192
|
it "should return an error and not execute any actions" do
|
|
193
193
|
subject.execute
|
|
194
194
|
error = ProtocolError.new.setup 'option error', 'Only a single grammar is supported.'
|
|
195
|
-
original_command.response(0.1).
|
|
195
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
196
196
|
end
|
|
197
197
|
end
|
|
198
198
|
end
|
|
@@ -203,7 +203,7 @@ module Punchblock
|
|
|
203
203
|
it "should return an error and not execute any actions" do
|
|
204
204
|
subject.execute
|
|
205
205
|
error = ProtocolError.new.setup 'option error', 'A mode value other than DTMF is unsupported.'
|
|
206
|
-
original_command.response(0.1).
|
|
206
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
207
207
|
end
|
|
208
208
|
end
|
|
209
209
|
|
|
@@ -212,7 +212,7 @@ module Punchblock
|
|
|
212
212
|
it "should return an error and not execute any actions" do
|
|
213
213
|
subject.execute
|
|
214
214
|
error = ProtocolError.new.setup 'option error', 'A mode value other than DTMF is unsupported.'
|
|
215
|
-
original_command.response(0.1).
|
|
215
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
216
216
|
end
|
|
217
217
|
end
|
|
218
218
|
|
|
@@ -221,7 +221,7 @@ module Punchblock
|
|
|
221
221
|
it "should return an error and not execute any actions" do
|
|
222
222
|
subject.execute
|
|
223
223
|
error = ProtocolError.new.setup 'option error', 'A mode value other than DTMF is unsupported.'
|
|
224
|
-
original_command.response(0.1).
|
|
224
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
225
225
|
end
|
|
226
226
|
end
|
|
227
227
|
end
|
|
@@ -243,7 +243,7 @@ module Punchblock
|
|
|
243
243
|
send_dtmf 1
|
|
244
244
|
sleep 1.5
|
|
245
245
|
send_dtmf 2
|
|
246
|
-
reason.
|
|
246
|
+
expect(reason).to be_a Punchblock::Component::Input::Complete::Match
|
|
247
247
|
end
|
|
248
248
|
|
|
249
249
|
it "should cause a NoInput complete event to be sent after the timeout" do
|
|
@@ -251,7 +251,7 @@ module Punchblock
|
|
|
251
251
|
sleep 1.5
|
|
252
252
|
send_dtmf 1
|
|
253
253
|
send_dtmf 2
|
|
254
|
-
reason.
|
|
254
|
+
expect(reason).to be_a Punchblock::Component::Input::Complete::NoInput
|
|
255
255
|
end
|
|
256
256
|
end
|
|
257
257
|
|
|
@@ -259,7 +259,7 @@ module Punchblock
|
|
|
259
259
|
let(:original_command_opts) { { :initial_timeout => -1 } }
|
|
260
260
|
|
|
261
261
|
it "should not start a timer" do
|
|
262
|
-
subject.wrapped_object.
|
|
262
|
+
expect(subject.wrapped_object).to receive(:begin_initial_timer).never
|
|
263
263
|
subject.execute
|
|
264
264
|
end
|
|
265
265
|
end
|
|
@@ -268,7 +268,7 @@ module Punchblock
|
|
|
268
268
|
let(:original_command_opts) { { :initial_timeout => nil } }
|
|
269
269
|
|
|
270
270
|
it "should not start a timer" do
|
|
271
|
-
subject.wrapped_object.
|
|
271
|
+
expect(subject.wrapped_object).to receive(:begin_initial_timer).never
|
|
272
272
|
subject.execute
|
|
273
273
|
end
|
|
274
274
|
end
|
|
@@ -279,7 +279,7 @@ module Punchblock
|
|
|
279
279
|
it "should return an error and not execute any actions" do
|
|
280
280
|
subject.execute
|
|
281
281
|
error = ProtocolError.new.setup 'option error', 'An initial timeout value that is negative (and not -1) is invalid.'
|
|
282
|
-
original_command.response(0.1).
|
|
282
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
283
283
|
end
|
|
284
284
|
end
|
|
285
285
|
end
|
|
@@ -294,7 +294,7 @@ module Punchblock
|
|
|
294
294
|
send_dtmf 1
|
|
295
295
|
sleep 0.5
|
|
296
296
|
send_dtmf 2
|
|
297
|
-
reason.
|
|
297
|
+
expect(reason).to be_a Punchblock::Component::Input::Complete::Match
|
|
298
298
|
end
|
|
299
299
|
|
|
300
300
|
it "should cause a InterDigitTimeout complete event to be sent after the timeout" do
|
|
@@ -303,7 +303,7 @@ module Punchblock
|
|
|
303
303
|
send_dtmf 1
|
|
304
304
|
sleep 1.5
|
|
305
305
|
send_dtmf 2
|
|
306
|
-
reason.
|
|
306
|
+
expect(reason).to be_a Punchblock::Component::Input::Complete::NoMatch
|
|
307
307
|
end
|
|
308
308
|
end
|
|
309
309
|
|
|
@@ -311,7 +311,7 @@ module Punchblock
|
|
|
311
311
|
let(:original_command_opts) { { :inter_digit_timeout => -1 } }
|
|
312
312
|
|
|
313
313
|
it "should not start a timer" do
|
|
314
|
-
subject.wrapped_object.
|
|
314
|
+
expect(subject.wrapped_object).to receive(:begin_inter_digit_timer).never
|
|
315
315
|
subject.execute
|
|
316
316
|
end
|
|
317
317
|
end
|
|
@@ -320,7 +320,7 @@ module Punchblock
|
|
|
320
320
|
let(:original_command_opts) { { :inter_digit_timeout => nil } }
|
|
321
321
|
|
|
322
322
|
it "should not start a timer" do
|
|
323
|
-
subject.wrapped_object.
|
|
323
|
+
expect(subject.wrapped_object).to receive(:begin_inter_digit_timer).never
|
|
324
324
|
subject.execute
|
|
325
325
|
end
|
|
326
326
|
end
|
|
@@ -331,7 +331,7 @@ module Punchblock
|
|
|
331
331
|
it "should return an error and not execute any actions" do
|
|
332
332
|
subject.execute
|
|
333
333
|
error = ProtocolError.new.setup 'option error', 'An inter-digit timeout value that is negative (and not -1) is invalid.'
|
|
334
|
-
original_command.response(0.1).
|
|
334
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
335
335
|
end
|
|
336
336
|
end
|
|
337
337
|
end
|
|
@@ -357,7 +357,7 @@ module Punchblock
|
|
|
357
357
|
|
|
358
358
|
it "returns a ProtocolError response" do
|
|
359
359
|
subject.execute_command command
|
|
360
|
-
command.response(0.1).
|
|
360
|
+
expect(command.response(0.1)).to be_a ProtocolError
|
|
361
361
|
end
|
|
362
362
|
end
|
|
363
363
|
|
|
@@ -373,8 +373,8 @@ module Punchblock
|
|
|
373
373
|
|
|
374
374
|
it "sets the command response to true" do
|
|
375
375
|
subject.execute_command command
|
|
376
|
-
command.response(0.1).
|
|
377
|
-
reason.
|
|
376
|
+
expect(command.response(0.1)).to eq(true)
|
|
377
|
+
expect(reason).to be_a Punchblock::Event::Complete::Stop
|
|
378
378
|
end
|
|
379
379
|
end
|
|
380
380
|
end
|
|
@@ -31,7 +31,7 @@ module Punchblock
|
|
|
31
31
|
describe '#execute' do
|
|
32
32
|
before { original_command.request! }
|
|
33
33
|
def expect_playback(filename = audio_filename)
|
|
34
|
-
subject.wrapped_object.
|
|
34
|
+
expect(subject.wrapped_object).to receive(:application).once.with 'playback', "file_string://#{filename}"
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
let(:audio_filename) { 'http://foo.com/bar.mp3' }
|
|
@@ -59,7 +59,7 @@ module Punchblock
|
|
|
59
59
|
it "should return an error and not execute any actions" do
|
|
60
60
|
subject.execute
|
|
61
61
|
error = ProtocolError.new.setup 'option error', 'An SSML document is required.'
|
|
62
|
-
original_command.response(0.1).
|
|
62
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -78,7 +78,7 @@ module Punchblock
|
|
|
78
78
|
expect_playback
|
|
79
79
|
subject.execute
|
|
80
80
|
subject.handle_es_event RubyFS::Event.new(nil, :event_name => "CHANNEL_EXECUTE_COMPLETE", :application_response => 'FILE PLAYED')
|
|
81
|
-
original_command.complete_event(0.1).reason.
|
|
81
|
+
expect(original_command.complete_event(0.1).reason).to be_a Punchblock::Component::Output::Complete::Finish
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
context "when playback returns an error" do
|
|
@@ -89,8 +89,8 @@ module Punchblock
|
|
|
89
89
|
expect_playback
|
|
90
90
|
subject.execute
|
|
91
91
|
subject.handle_es_event fs_event
|
|
92
|
-
complete_reason.
|
|
93
|
-
complete_reason.details.
|
|
92
|
+
expect(complete_reason).to be_a Punchblock::Event::Complete::Error
|
|
93
|
+
expect(complete_reason.details).to eq('Engine error: PLAYBACK ERROR')
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
end
|
|
@@ -114,7 +114,7 @@ module Punchblock
|
|
|
114
114
|
expect_playback([audio_filename1, audio_filename2].join('!'))
|
|
115
115
|
subject.execute
|
|
116
116
|
subject.handle_es_event RubyFS::Event.new(nil, :event_name => "CHANNEL_EXECUTE_COMPLETE", :application_response => "FILE PLAYED")
|
|
117
|
-
original_command.complete_event(0.1).reason.
|
|
117
|
+
expect(original_command.complete_event(0.1).reason).to be_a Punchblock::Component::Output::Complete::Finish
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
|
|
@@ -128,7 +128,7 @@ module Punchblock
|
|
|
128
128
|
it "should return an unrenderable document error" do
|
|
129
129
|
subject.execute
|
|
130
130
|
error = ProtocolError.new.setup 'unrenderable document error', 'The provided document could not be rendered. See http://adhearsion.com/docs/common_problems#unrenderable-document-error for details.'
|
|
131
|
-
original_command.response(0.1).
|
|
131
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
@@ -160,7 +160,7 @@ module Punchblock
|
|
|
160
160
|
it "should return an error and not execute any actions" do
|
|
161
161
|
subject.execute
|
|
162
162
|
error = ProtocolError.new.setup 'option error', 'A start_offset value is unsupported.'
|
|
163
|
-
original_command.response(0.1).
|
|
163
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
end
|
|
@@ -179,7 +179,7 @@ module Punchblock
|
|
|
179
179
|
it "should return an error and not execute any actions" do
|
|
180
180
|
subject.execute
|
|
181
181
|
error = ProtocolError.new.setup 'option error', 'A start_paused value is unsupported.'
|
|
182
|
-
original_command.response(0.1).
|
|
182
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
185
|
end
|
|
@@ -198,7 +198,7 @@ module Punchblock
|
|
|
198
198
|
it "should return an error and not execute any actions" do
|
|
199
199
|
subject.execute
|
|
200
200
|
error = ProtocolError.new.setup 'option error', 'A repeat_interval value is unsupported.'
|
|
201
|
-
original_command.response(0.1).
|
|
201
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
202
202
|
end
|
|
203
203
|
end
|
|
204
204
|
end
|
|
@@ -217,7 +217,7 @@ module Punchblock
|
|
|
217
217
|
it "should return an error and not execute any actions" do
|
|
218
218
|
subject.execute
|
|
219
219
|
error = ProtocolError.new.setup 'option error', 'A repeat_times value is unsupported.'
|
|
220
|
-
original_command.response(0.1).
|
|
220
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
221
221
|
end
|
|
222
222
|
end
|
|
223
223
|
end
|
|
@@ -236,7 +236,7 @@ module Punchblock
|
|
|
236
236
|
it "should return an error and not execute any actions" do
|
|
237
237
|
subject.execute
|
|
238
238
|
error = ProtocolError.new.setup 'option error', 'A max_time value is unsupported.'
|
|
239
|
-
original_command.response(0.1).
|
|
239
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
240
240
|
end
|
|
241
241
|
end
|
|
242
242
|
end
|
|
@@ -273,7 +273,7 @@ module Punchblock
|
|
|
273
273
|
it "should return an error and not execute any actions" do
|
|
274
274
|
subject.execute
|
|
275
275
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of any is unsupported.'
|
|
276
|
-
original_command.response(0.1).
|
|
276
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
277
277
|
end
|
|
278
278
|
end
|
|
279
279
|
|
|
@@ -282,7 +282,7 @@ module Punchblock
|
|
|
282
282
|
it "should return an error and not execute any actions" do
|
|
283
283
|
subject.execute
|
|
284
284
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of dtmf is unsupported.'
|
|
285
|
-
original_command.response(0.1).
|
|
285
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
286
286
|
end
|
|
287
287
|
end
|
|
288
288
|
|
|
@@ -291,7 +291,7 @@ module Punchblock
|
|
|
291
291
|
it "should return an error and not execute any actions" do
|
|
292
292
|
subject.execute
|
|
293
293
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of voice is unsupported.'
|
|
294
|
-
original_command.response(0.1).
|
|
294
|
+
expect(original_command.response(0.1)).to eq(error)
|
|
295
295
|
end
|
|
296
296
|
end
|
|
297
297
|
end
|
|
@@ -305,7 +305,7 @@ module Punchblock
|
|
|
305
305
|
|
|
306
306
|
it "returns a ProtocolError response" do
|
|
307
307
|
subject.execute_command command
|
|
308
|
-
command.response(0.1).
|
|
308
|
+
expect(command.response(0.1)).to be_a ProtocolError
|
|
309
309
|
end
|
|
310
310
|
end
|
|
311
311
|
|
|
@@ -320,21 +320,21 @@ module Punchblock
|
|
|
320
320
|
end
|
|
321
321
|
|
|
322
322
|
it "sets the command response to true" do
|
|
323
|
-
subject.wrapped_object.
|
|
323
|
+
expect(subject.wrapped_object).to receive(:application)
|
|
324
324
|
subject.execute_command command
|
|
325
|
-
command.response(0.1).
|
|
325
|
+
expect(command.response(0.1)).to eq(true)
|
|
326
326
|
end
|
|
327
327
|
|
|
328
328
|
it "sends the correct complete event" do
|
|
329
|
-
subject.wrapped_object.
|
|
330
|
-
original_command.
|
|
329
|
+
expect(subject.wrapped_object).to receive(:application)
|
|
330
|
+
expect(original_command).not_to be_complete
|
|
331
331
|
subject.execute_command command
|
|
332
|
-
reason.
|
|
333
|
-
original_command.
|
|
332
|
+
expect(reason).to be_a Punchblock::Event::Complete::Stop
|
|
333
|
+
expect(original_command).to be_complete
|
|
334
334
|
end
|
|
335
335
|
|
|
336
336
|
it "breaks the current dialplan application" do
|
|
337
|
-
subject.wrapped_object.
|
|
337
|
+
expect(subject.wrapped_object).to receive(:application).once.with 'break'
|
|
338
338
|
subject.execute_command command
|
|
339
339
|
end
|
|
340
340
|
end
|