punchblock 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -24,7 +24,7 @@ module Punchblock
|
|
24
24
|
|
25
25
|
before do
|
26
26
|
mock_stream.as_null_object
|
27
|
-
mock_call.
|
27
|
+
allow(mock_call).to receive(:uuid_foo)
|
28
28
|
end
|
29
29
|
|
30
30
|
subject { Record.new original_command, mock_call }
|
@@ -39,12 +39,12 @@ module Punchblock
|
|
39
39
|
|
40
40
|
it "sets command response to a reference to the component" do
|
41
41
|
subject.execute
|
42
|
-
original_command.response(0.1).
|
43
|
-
original_command.component_id.
|
42
|
+
expect(original_command.response(0.1)).to be_a Ref
|
43
|
+
expect(original_command.component_id).to eq(subject.id)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "starts a recording via uuid_record, using the component ID as the filename" do
|
47
|
-
mock_call.
|
47
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, "start #{filename}")
|
48
48
|
subject.execute
|
49
49
|
end
|
50
50
|
|
@@ -56,37 +56,37 @@ module Punchblock
|
|
56
56
|
:record_file_path => filename
|
57
57
|
}
|
58
58
|
mock_call.handle_es_event record_stop_event
|
59
|
-
reason.
|
60
|
-
recording.uri.
|
61
|
-
original_command.
|
59
|
+
expect(reason).to be_a Punchblock::Component::Record::Complete::MaxDuration
|
60
|
+
expect(recording.uri).to eq(full_filename)
|
61
|
+
expect(original_command).to be_complete
|
62
62
|
end
|
63
63
|
|
64
64
|
describe 'start_paused' do
|
65
65
|
context "set to nil" do
|
66
66
|
let(:command_options) { { :start_paused => nil } }
|
67
67
|
it "should execute normally" do
|
68
|
-
mock_call.
|
68
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/)
|
69
69
|
subject.execute
|
70
|
-
original_command.response(0.1).
|
70
|
+
expect(original_command.response(0.1)).to be_a Ref
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
context "set to false" do
|
75
75
|
let(:command_options) { { :start_paused => false } }
|
76
76
|
it "should execute normally" do
|
77
|
-
mock_call.
|
77
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/)
|
78
78
|
subject.execute
|
79
|
-
original_command.response(0.1).
|
79
|
+
expect(original_command.response(0.1)).to be_a Ref
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
context "set to true" do
|
84
84
|
let(:command_options) { { :start_paused => true } }
|
85
85
|
it "should return an error and not execute any actions" do
|
86
|
-
mock_call.
|
86
|
+
expect(mock_call).to receive(:uuid_foo).never
|
87
87
|
subject.execute
|
88
88
|
error = ProtocolError.new.setup 'option error', 'A start-paused value of true is unsupported.'
|
89
|
-
original_command.response(0.1).
|
89
|
+
expect(original_command.response(0.1)).to eq(error)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -95,30 +95,30 @@ module Punchblock
|
|
95
95
|
context "set to nil" do
|
96
96
|
let(:command_options) { { :initial_timeout => nil } }
|
97
97
|
it "should setvar RECORD_INITIAL_TIMEOUT_MS with a 0 value" do
|
98
|
-
mock_call.
|
99
|
-
mock_call.
|
98
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_INITIAL_TIMEOUT_MS 0").ordered
|
99
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
100
100
|
subject.execute
|
101
|
-
original_command.response(0.1).
|
101
|
+
expect(original_command.response(0.1)).to be_a Ref
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
context "set to -1" do
|
106
106
|
let(:command_options) { { :initial_timeout => -1 } }
|
107
107
|
it "should setvar RECORD_INITIAL_TIMEOUT_MS with a 0 value" do
|
108
|
-
mock_call.
|
109
|
-
mock_call.
|
108
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_INITIAL_TIMEOUT_MS 0").ordered
|
109
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
110
110
|
subject.execute
|
111
|
-
original_command.response(0.1).
|
111
|
+
expect(original_command.response(0.1)).to be_a Ref
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
context "set to a positive number" do
|
116
116
|
let(:command_options) { { :initial_timeout => 10 } }
|
117
117
|
it "should setvar RECORD_INITIAL_TIMEOUT_MS with a value in ms" do
|
118
|
-
mock_call.
|
119
|
-
mock_call.
|
118
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_INITIAL_TIMEOUT_MS 10").ordered
|
119
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
120
120
|
subject.execute
|
121
|
-
original_command.response(0.1).
|
121
|
+
expect(original_command.response(0.1)).to be_a Ref
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -127,30 +127,30 @@ module Punchblock
|
|
127
127
|
context "set to nil" do
|
128
128
|
let(:command_options) { { :final_timeout => nil } }
|
129
129
|
it "should setvar RECORD_FINAL_TIMEOUT_MS with a 0 value" do
|
130
|
-
mock_call.
|
131
|
-
mock_call.
|
130
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_FINAL_TIMEOUT_MS 0").ordered
|
131
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
132
132
|
subject.execute
|
133
|
-
original_command.response(0.1).
|
133
|
+
expect(original_command.response(0.1)).to be_a Ref
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
137
|
context "set to -1" do
|
138
138
|
let(:command_options) { { :final_timeout => -1 } }
|
139
139
|
it "should setvar RECORD_FINAL_TIMEOUT_MS with a 0 value" do
|
140
|
-
mock_call.
|
141
|
-
mock_call.
|
140
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_FINAL_TIMEOUT_MS 0").ordered
|
141
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
142
142
|
subject.execute
|
143
|
-
original_command.response(0.1).
|
143
|
+
expect(original_command.response(0.1)).to be_a Ref
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
context "set to a positive number" do
|
148
148
|
let(:command_options) { { :final_timeout => 10 } }
|
149
149
|
it "should setvar RECORD_FINAL_TIMEOUT_MS with a value in ms" do
|
150
|
-
mock_call.
|
151
|
-
mock_call.
|
150
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_FINAL_TIMEOUT_MS 10").ordered
|
151
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
152
152
|
subject.execute
|
153
|
-
original_command.response(0.1).
|
153
|
+
expect(original_command.response(0.1)).to be_a Ref
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
@@ -159,40 +159,40 @@ module Punchblock
|
|
159
159
|
context "set to nil" do
|
160
160
|
let(:command_options) { { :format => nil } }
|
161
161
|
it "should execute as 'wav'" do
|
162
|
-
mock_call.
|
162
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav/)
|
163
163
|
subject.execute
|
164
|
-
original_command.response(0.1).
|
164
|
+
expect(original_command.response(0.1)).to be_a Ref
|
165
165
|
end
|
166
166
|
|
167
167
|
it "provides the correct filename in the recording" do
|
168
|
-
mock_call.
|
168
|
+
expect(mock_call).to receive(:uuid_foo)
|
169
169
|
subject.execute
|
170
170
|
record_stop_event = RubyFS::Event.new nil, {
|
171
171
|
:event_name => 'RECORD_STOP',
|
172
172
|
:record_file_path => "#{Record::RECORDING_BASE_PATH}/#{subject.id}.wav"
|
173
173
|
}
|
174
174
|
mock_call.handle_es_event record_stop_event
|
175
|
-
recording.uri.
|
175
|
+
expect(recording.uri).to match(/.*\.wav$/)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
179
|
context "set to 'mp3'" do
|
180
180
|
let(:command_options) { { :format => 'mp3' } }
|
181
181
|
it "should execute as 'mp3'" do
|
182
|
-
mock_call.
|
182
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.mp3/)
|
183
183
|
subject.execute
|
184
|
-
original_command.response(0.1).
|
184
|
+
expect(original_command.response(0.1)).to be_a Ref
|
185
185
|
end
|
186
186
|
|
187
187
|
it "provides the correct filename in the recording" do
|
188
|
-
mock_call.
|
188
|
+
expect(mock_call).to receive(:uuid_foo)
|
189
189
|
subject.execute
|
190
190
|
record_stop_event = RubyFS::Event.new nil, {
|
191
191
|
:event_name => 'RECORD_STOP',
|
192
192
|
:record_file_path => "#{Record::RECORDING_BASE_PATH}/#{subject.id}.mp3"
|
193
193
|
}
|
194
194
|
mock_call.handle_es_event record_stop_event
|
195
|
-
recording.uri.
|
195
|
+
expect(recording.uri).to match(/.*\.mp3$/)
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
@@ -201,18 +201,18 @@ module Punchblock
|
|
201
201
|
context "set to nil" do
|
202
202
|
let(:command_options) { { :start_beep => nil } }
|
203
203
|
it "should execute normally" do
|
204
|
-
mock_call.
|
204
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/)
|
205
205
|
subject.execute
|
206
|
-
original_command.response(0.1).
|
206
|
+
expect(original_command.response(0.1)).to be_a Ref
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
210
|
context "set to false" do
|
211
211
|
let(:command_options) { { :start_beep => false } }
|
212
212
|
it "should execute normally" do
|
213
|
-
mock_call.
|
213
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/)
|
214
214
|
subject.execute
|
215
|
-
original_command.response(0.1).
|
215
|
+
expect(original_command.response(0.1)).to be_a Ref
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
@@ -220,10 +220,10 @@ module Punchblock
|
|
220
220
|
let(:command_options) { { :start_beep => true } }
|
221
221
|
|
222
222
|
it "should return an error and not execute any actions" do
|
223
|
-
mock_call.
|
223
|
+
expect(mock_call).to receive(:uuid_foo).never
|
224
224
|
subject.execute
|
225
225
|
error = ProtocolError.new.setup 'option error', 'A start-beep value of true is unsupported.'
|
226
|
-
original_command.response(0.1).
|
226
|
+
expect(original_command.response(0.1)).to eq(error)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
@@ -232,18 +232,18 @@ module Punchblock
|
|
232
232
|
context "set to nil" do
|
233
233
|
let(:command_options) { { :max_duration => nil } }
|
234
234
|
it "should execute normally" do
|
235
|
-
mock_call.
|
235
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/)
|
236
236
|
subject.execute
|
237
|
-
original_command.response(0.1).
|
237
|
+
expect(original_command.response(0.1)).to be_a Ref
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
241
|
context "set to -1" do
|
242
242
|
let(:command_options) { { :max_duration => -1 } }
|
243
243
|
it "should execute normally" do
|
244
|
-
mock_call.
|
244
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/)
|
245
245
|
subject.execute
|
246
|
-
original_command.response(0.1).
|
246
|
+
expect(original_command.response(0.1)).to be_a Ref
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
@@ -253,7 +253,7 @@ module Punchblock
|
|
253
253
|
it "should return an error and not execute any actions" do
|
254
254
|
subject.execute
|
255
255
|
error = ProtocolError.new.setup 'option error', 'A max-duration value that is negative (and not -1) is invalid.'
|
256
|
-
original_command.response(0.1).
|
256
|
+
expect(original_command.response(0.1)).to eq(error)
|
257
257
|
end
|
258
258
|
end
|
259
259
|
|
@@ -263,9 +263,9 @@ module Punchblock
|
|
263
263
|
let(:command_options) { { :max_duration => 1000 } }
|
264
264
|
|
265
265
|
it "executes the recording with a time limit" do
|
266
|
-
mock_call.
|
266
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav 1$/)
|
267
267
|
subject.execute
|
268
|
-
original_command.response(0.1).
|
268
|
+
expect(original_command.response(0.1)).to be_a Ref
|
269
269
|
end
|
270
270
|
end
|
271
271
|
end
|
@@ -274,37 +274,37 @@ module Punchblock
|
|
274
274
|
context "with nil" do
|
275
275
|
let(:command_options) { { :direction => nil } }
|
276
276
|
it "should execute the setvar application with duplex options before recording" do
|
277
|
-
mock_call.
|
278
|
-
mock_call.
|
277
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_STEREO true").ordered
|
278
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
279
279
|
subject.execute
|
280
|
-
original_command.response(0.1).
|
280
|
+
expect(original_command.response(0.1)).to be_a Ref
|
281
281
|
end
|
282
282
|
end
|
283
283
|
context "with :duplex" do
|
284
284
|
let(:command_options) { { :direction => :duplex } }
|
285
285
|
it "should execute the setvar application with duplex options before recording" do
|
286
|
-
mock_call.
|
287
|
-
mock_call.
|
286
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_STEREO true").ordered
|
287
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
288
288
|
subject.execute
|
289
|
-
original_command.response(0.1).
|
289
|
+
expect(original_command.response(0.1)).to be_a Ref
|
290
290
|
end
|
291
291
|
end
|
292
292
|
context "with :send" do
|
293
293
|
let(:command_options) { { :direction => :send } }
|
294
294
|
it "should execute the setvar application with send options before recording" do
|
295
|
-
mock_call.
|
296
|
-
mock_call.
|
295
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_WRITE_ONLY true").ordered
|
296
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
297
297
|
subject.execute
|
298
|
-
original_command.response(0.1).
|
298
|
+
expect(original_command.response(0.1)).to be_a Ref
|
299
299
|
end
|
300
300
|
end
|
301
301
|
context "with :recv" do
|
302
302
|
let(:command_options) { { :direction => :recv } }
|
303
303
|
it "should execute the setvar application with recv options before recording" do
|
304
|
-
mock_call.
|
305
|
-
mock_call.
|
304
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:setvar, "RECORD_READ_ONLY true").ordered
|
305
|
+
expect(mock_call).to receive(:uuid_foo).once.with(:record, /.wav$/).ordered
|
306
306
|
subject.execute
|
307
|
-
original_command.response(0.1).
|
307
|
+
expect(original_command.response(0.1)).to be_a Ref
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
@@ -320,7 +320,7 @@ module Punchblock
|
|
320
320
|
before { command.request! }
|
321
321
|
it "returns a ProtocolError response" do
|
322
322
|
subject.execute_command command
|
323
|
-
command.response(0.1).
|
323
|
+
expect(command.response(0.1)).to be_a ProtocolError
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
@@ -342,24 +342,24 @@ module Punchblock
|
|
342
342
|
end
|
343
343
|
|
344
344
|
it "sets the command response to true" do
|
345
|
-
mock_call.
|
345
|
+
expect(mock_call).to receive :uuid_foo
|
346
346
|
subject.execute_command command
|
347
347
|
send_stop_event
|
348
|
-
command.response(0.1).
|
348
|
+
expect(command.response(0.1)).to eq(true)
|
349
349
|
end
|
350
350
|
|
351
351
|
it "executes a uuid_record stop command" do
|
352
|
-
mock_call.
|
352
|
+
expect(mock_call).to receive(:uuid_foo).with(:record, "stop #{filename}")
|
353
353
|
subject.execute_command command
|
354
354
|
end
|
355
355
|
|
356
356
|
it "sends the correct complete event" do
|
357
|
-
mock_call.
|
357
|
+
expect(mock_call).to receive(:uuid_foo).with(:record, "stop #{filename}")
|
358
358
|
subject.execute_command command
|
359
359
|
send_stop_event
|
360
|
-
reason.
|
361
|
-
recording.uri.
|
362
|
-
original_command.
|
360
|
+
expect(reason).to be_a Punchblock::Event::Complete::Stop
|
361
|
+
expect(recording.uri).to eq("file://#{filename}")
|
362
|
+
expect(original_command).to be_complete
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
@@ -368,7 +368,7 @@ module Punchblock
|
|
368
368
|
|
369
369
|
before do
|
370
370
|
pending
|
371
|
-
mock_call.
|
371
|
+
expect(mock_call).to receive :uuid_foo
|
372
372
|
command.request!
|
373
373
|
original_command.request!
|
374
374
|
subject.execute
|
@@ -376,11 +376,11 @@ module Punchblock
|
|
376
376
|
|
377
377
|
it "sets the command response to true" do
|
378
378
|
subject.execute_command command
|
379
|
-
command.response(0.1).
|
379
|
+
expect(command.response(0.1)).to eq(true)
|
380
380
|
end
|
381
381
|
|
382
382
|
it "pauses the recording via AMI" do
|
383
|
-
mock_call.
|
383
|
+
expect(mock_call).to receive(:uuid_foo).once.with('PauseMonitor', 'Channel' => channel)
|
384
384
|
subject.execute_command command
|
385
385
|
end
|
386
386
|
end
|
@@ -390,7 +390,7 @@ module Punchblock
|
|
390
390
|
|
391
391
|
before do
|
392
392
|
pending
|
393
|
-
mock_call.
|
393
|
+
expect(mock_call).to receive :uuid_foo
|
394
394
|
command.request!
|
395
395
|
original_command.request!
|
396
396
|
subject.execute
|
@@ -398,11 +398,11 @@ module Punchblock
|
|
398
398
|
|
399
399
|
it "sets the command response to true" do
|
400
400
|
subject.execute_command command
|
401
|
-
command.response(0.1).
|
401
|
+
expect(command.response(0.1)).to eq(true)
|
402
402
|
end
|
403
403
|
|
404
404
|
it "resumes the recording via AMI" do
|
405
|
-
mock_call.
|
405
|
+
expect(mock_call).to receive(:uuid_foo).once.with('ResumeMonitor', 'Channel' => channel)
|
406
406
|
subject.execute_command command
|
407
407
|
end
|
408
408
|
end
|
@@ -35,7 +35,7 @@ module Punchblock
|
|
35
35
|
describe '#execute' do
|
36
36
|
before { original_command.request! }
|
37
37
|
def expect_playback(voice = :kal, renderer = :flite, doc = ssml_doc)
|
38
|
-
subject.wrapped_object.
|
38
|
+
expect(subject.wrapped_object).to receive(:application).once.with :speak, "#{renderer}|#{voice}|#{doc}"
|
39
39
|
end
|
40
40
|
|
41
41
|
let :ssml_doc do
|
@@ -61,7 +61,7 @@ module Punchblock
|
|
61
61
|
it "should return an error and not execute any actions" do
|
62
62
|
execute
|
63
63
|
error = ProtocolError.new.setup 'option error', 'An SSML document is required.'
|
64
|
-
original_command.response(0.1).
|
64
|
+
expect(original_command.response(0.1)).to eq(error)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -75,7 +75,7 @@ module Punchblock
|
|
75
75
|
expect_playback
|
76
76
|
execute
|
77
77
|
subject.handle_es_event RubyFS::Event.new(nil, :event_name => "CHANNEL_EXECUTE_COMPLETE")
|
78
|
-
original_command.complete_event(0.1).reason.
|
78
|
+
expect(original_command.complete_event(0.1).reason).to be_a Punchblock::Component::Output::Complete::Finish
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -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_offset 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 start_paused 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_interval 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 repeat_times 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
|
@@ -191,7 +191,7 @@ module Punchblock
|
|
191
191
|
it "should return an error and not execute any actions" do
|
192
192
|
execute
|
193
193
|
error = ProtocolError.new.setup 'option error', 'A max_time value is unsupported.'
|
194
|
-
original_command.response(0.1).
|
194
|
+
expect(original_command.response(0.1)).to eq(error)
|
195
195
|
end
|
196
196
|
end
|
197
197
|
end
|
@@ -228,7 +228,7 @@ module Punchblock
|
|
228
228
|
it "should return an error and not execute any actions" do
|
229
229
|
execute
|
230
230
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of any is unsupported.'
|
231
|
-
original_command.response(0.1).
|
231
|
+
expect(original_command.response(0.1)).to eq(error)
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
@@ -237,7 +237,7 @@ module Punchblock
|
|
237
237
|
it "should return an error and not execute any actions" do
|
238
238
|
execute
|
239
239
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of dtmf is unsupported.'
|
240
|
-
original_command.response(0.1).
|
240
|
+
expect(original_command.response(0.1)).to eq(error)
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
@@ -246,7 +246,7 @@ module Punchblock
|
|
246
246
|
it "should return an error and not execute any actions" do
|
247
247
|
execute
|
248
248
|
error = ProtocolError.new.setup 'option error', 'An interrupt-on value of voice is unsupported.'
|
249
|
-
original_command.response(0.1).
|
249
|
+
expect(original_command.response(0.1)).to eq(error)
|
250
250
|
end
|
251
251
|
end
|
252
252
|
end
|
@@ -260,7 +260,7 @@ module Punchblock
|
|
260
260
|
|
261
261
|
it "returns a ProtocolError response" do
|
262
262
|
subject.execute_command command
|
263
|
-
command.response(0.1).
|
263
|
+
expect(command.response(0.1)).to be_a ProtocolError
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
@@ -275,21 +275,21 @@ module Punchblock
|
|
275
275
|
end
|
276
276
|
|
277
277
|
it "sets the command response to true" do
|
278
|
-
subject.wrapped_object.
|
278
|
+
expect(subject.wrapped_object).to receive(:application)
|
279
279
|
subject.execute_command command
|
280
|
-
command.response(0.1).
|
280
|
+
expect(command.response(0.1)).to eq(true)
|
281
281
|
end
|
282
282
|
|
283
283
|
it "sends the correct complete event" do
|
284
|
-
subject.wrapped_object.
|
285
|
-
original_command.
|
284
|
+
expect(subject.wrapped_object).to receive(:application)
|
285
|
+
expect(original_command).not_to be_complete
|
286
286
|
subject.execute_command command
|
287
|
-
reason.
|
288
|
-
original_command.
|
287
|
+
expect(reason).to be_a Punchblock::Event::Complete::Stop
|
288
|
+
expect(original_command).to be_complete
|
289
289
|
end
|
290
290
|
|
291
291
|
it "breaks the current dialplan application" do
|
292
|
-
subject.wrapped_object.
|
292
|
+
expect(subject.wrapped_object).to receive(:application).once.with 'break'
|
293
293
|
subject.execute_command command
|
294
294
|
end
|
295
295
|
end
|