punchblock 1.9.3 → 1.9.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ff3ea16e07ba9b68609f3fd2e92f83042da06b5
4
- data.tar.gz: c165944f3bccf0cdb604106e8378557d7dd9c695
3
+ metadata.gz: 1cb4362475b7ff78950c6a3b6c26079e98f5741a
4
+ data.tar.gz: 6e6bf5c7f14bf24e1ea4ca9cb84b1f8e2365935b
5
5
  SHA512:
6
- metadata.gz: 3d65f082760974940de41c52a9a27cfa539270221e392f7df25865294c12ec80e9ad6a32ebad1b00e991aa808690cf444b1c4ff78ca4f08e86e1bad16132c35b
7
- data.tar.gz: b136fbe1f8647e8298c70bccd148cb662578c3bfab3ac6191149d8f19b4e621138b38ee46143c3bc246198afc804eb72bd753c57d7ebb8854e077634d6b0bad5
6
+ metadata.gz: b5b5d40cd306d3e292b56189f085165c3a39f2e4f069f7b7298cafee1ad65f7b3a597a1db49c79771f1027b3026d0ee6bb9576020b4114c7e08c4ce19aef6b48
7
+ data.tar.gz: 93b07c8cc0bdb8472c4b511008e054068c13a79dfa780fe08a3f09ac4b9dbc76b195e55505128291bdef3262461bfb7fb634ba672a8670589c1c6ca3928f664b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # [develop](https://github.com/adhearsion/punchblock)
2
2
 
3
+ # [v1.9.4](https://github.com/adhearsion/punchblock/compare/v1.9.3...v1.9.4) - [2013-06-08](https://rubygems.org/gems/punchblock/versions/1.9.4)
4
+ * Bugfix: Finish more setup before sending output ref on Asterisk
5
+ * Bugfix: Allow early media TTS on Asterisk in addition to audio playback
6
+ * Bugfix: Correctly mark Asterisk calls as answered after successfully executing an answer command
7
+
3
8
  # [v1.9.3](https://github.com/adhearsion/punchblock/compare/v1.9.2...v1.9.3) - [2013-05-16](https://rubygems.org/gems/punchblock/versions/1.9.3)
4
9
  * Bugfix: Improve error messages when trying to execute stop commands on components in an invalid state
5
10
 
@@ -181,6 +181,7 @@ module Punchblock
181
181
  end
182
182
  when Command::Answer
183
183
  execute_agi_command 'ANSWER'
184
+ @answered = true
184
185
  command.response = true
185
186
  when Command::Hangup
186
187
  send_ami_action 'Hangup', 'Channel' => channel, 'Cause' => 16
@@ -39,8 +39,6 @@ module Punchblock
39
39
 
40
40
  path = filenames.join '&'
41
41
 
42
- send_ref
43
-
44
42
  @call.send_progress if early
45
43
 
46
44
  if interrupt
@@ -50,12 +48,16 @@ module Punchblock
50
48
  end
51
49
  end
52
50
 
51
+ send_ref
52
+
53
53
  opts = early ? "#{path},noanswer" : path
54
54
  @call.execute_agi_command 'EXEC Playback', opts
55
55
  when :unimrcp
56
+ @call.send_progress if early
56
57
  send_ref
57
58
  @call.execute_agi_command 'EXEC MRCPSynth', escape_commas(escaped_doc), mrcpsynth_options
58
59
  when :swift
60
+ @call.send_progress if early
59
61
  send_ref
60
62
  @call.execute_agi_command 'EXEC Swift', swift_doc
61
63
  else
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Punchblock
4
- VERSION = "1.9.3"
4
+ VERSION = "1.9.4"
5
5
  end
@@ -929,6 +929,12 @@ module Punchblock
929
929
  command.response(0.5).should be true
930
930
  end
931
931
 
932
+ it "should be answered" do
933
+ subject.wrapped_object.should_receive(:execute_agi_command)
934
+ subject.execute_command command
935
+ subject.should be_answered
936
+ end
937
+
932
938
  context "when the AMI commannd raises an error" do
933
939
  let(:message) { 'Some error' }
934
940
  let(:error) { RubyAMI::Error.new.tap { |e| e.message = message } }
@@ -940,6 +946,11 @@ module Punchblock
940
946
  command.response(0.5).should be == ProtocolError.new.setup('error', message, subject.id)
941
947
  end
942
948
 
949
+ it "should not be answered" do
950
+ subject.execute_command command
951
+ subject.should_not be_answered
952
+ end
953
+
943
954
  context "with message 'No such channel'" do
944
955
  let(:message) { 'No such channel' }
945
956
 
@@ -31,7 +31,7 @@ module Punchblock
31
31
  subject { Output.new original_command, mock_call }
32
32
 
33
33
  def expect_answered(value = true)
34
- mock_call.should_receive(:answered?).at_least(:once).and_return(value)
34
+ mock_call.stub(:answered?).and_return(value)
35
35
  end
36
36
 
37
37
  describe '#execute' do
@@ -70,6 +70,8 @@ module Punchblock
70
70
  prefix + base_doc + postfix
71
71
  end
72
72
 
73
+ before { expect_answered }
74
+
73
75
  it "should execute Swift" do
74
76
  mock_call.should_receive(:execute_agi_command).once.with 'EXEC Swift', ssml_with_options
75
77
  subject.execute
@@ -92,6 +94,16 @@ module Punchblock
92
94
  end
93
95
  end
94
96
 
97
+ context "when the call is not answered" do
98
+ before { expect_answered false }
99
+
100
+ it "should send progress" do
101
+ mock_call.should_receive(:send_progress)
102
+ mock_call.should_receive(:execute_agi_command).and_return code: 200, result: 1
103
+ subject.execute
104
+ end
105
+ end
106
+
95
107
  describe 'interrupt_on' do
96
108
  context "set to nil" do
97
109
  let(:command_opts) { { :interrupt_on => nil } }
@@ -104,7 +116,6 @@ module Punchblock
104
116
  context "set to :any" do
105
117
  let(:command_opts) { { :interrupt_on => :any } }
106
118
  it "should add the interrupt options to the argument" do
107
- expect_answered
108
119
  mock_call.should_receive(:execute_agi_command).once.with('EXEC Swift', ssml_with_options('', '|1|1')).and_return code: 200, result: 1
109
120
  subject.execute
110
121
  end
@@ -113,7 +124,6 @@ module Punchblock
113
124
  context "set to :dtmf" do
114
125
  let(:command_opts) { { :interrupt_on => :dtmf } }
115
126
  it "should add the interrupt options to the argument" do
116
- expect_answered
117
127
  mock_call.should_receive(:execute_agi_command).once.with('EXEC Swift', ssml_with_options('', '|1|1')).and_return code: 200, result: 1
118
128
  subject.execute
119
129
  end
@@ -174,6 +184,8 @@ module Punchblock
174
184
  end.and_return code: 200, result: 1
175
185
  end
176
186
 
187
+ before { expect_answered }
188
+
177
189
  it "should execute MRCPSynth" do
178
190
  mock_call.should_receive(:execute_agi_command).once.with('EXEC MRCPSynth', ssml_doc.to_s.squish.gsub(/["\\]/) { |m| "\\#{m}" }, '').and_return code: 200, result: 1
179
191
  subject.execute
@@ -212,6 +224,16 @@ module Punchblock
212
224
  end
213
225
  end
214
226
 
227
+ context "when the call is not answered" do
228
+ before { expect_answered false }
229
+
230
+ it "should send progress" do
231
+ mock_call.should_receive(:send_progress)
232
+ mock_call.should_receive(:execute_agi_command).and_return code: 200, result: 1
233
+ subject.execute
234
+ end
235
+ end
236
+
215
237
  describe 'ssml' do
216
238
  context 'unset' do
217
239
  let(:command_opts) { { :ssml => nil } }
@@ -348,7 +370,6 @@ module Punchblock
348
370
  context "set to :any" do
349
371
  let(:command_opts) { { :interrupt_on => :any } }
350
372
  it "should pass the i option to MRCPSynth" do
351
- expect_answered
352
373
  expect_mrcpsynth_with_options(/i=any/)
353
374
  subject.execute
354
375
  end
@@ -357,7 +378,6 @@ module Punchblock
357
378
  context "set to :dtmf" do
358
379
  let(:command_opts) { { :interrupt_on => :dtmf } }
359
380
  it "should pass the i option to MRCPSynth" do
360
- expect_answered
361
381
  expect_mrcpsynth_with_options(/i=any/)
362
382
  subject.execute
363
383
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punchblock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Goecke
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-16 00:00:00.000000000 Z
13
+ date: 2013-06-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: niceogiri
@@ -476,7 +476,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
476
476
  version: 1.3.7
477
477
  requirements: []
478
478
  rubyforge_project: punchblock
479
- rubygems_version: 2.0.0
479
+ rubygems_version: 2.0.3
480
480
  signing_key:
481
481
  specification_version: 4
482
482
  summary: Punchblock is a telephony middleware library