punchblock 2.0.0 → 2.0.1

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: f10d1a6318fae48550e671b7ad0a640894efb2c6
4
- data.tar.gz: ae3dbdd141ef0c7d87ff9a447424e88ae698071e
3
+ metadata.gz: 6fd9d8e6a3b698f31b5807e789454fc7231ed468
4
+ data.tar.gz: 4128a656a2bbbba2a1dedf0cb9a8a7269a8f73be
5
5
  SHA512:
6
- metadata.gz: ccb4bc2c83d83264172a5c544a710c7d74ad09ff14eea994fb3e6611991d9f9cdfe2e216570b287d55f5d204c3495c0e8276ba71a0e6ffe0c73946ca106434a9
7
- data.tar.gz: d8cce27023aa8319c78c0e8202e9202c8def91adf799a8b46df38e33552a7a5055630cdc6bac77d8d312b2eba3427b35c6b9a5915a63126715a9615236912d3b
6
+ metadata.gz: a89def0af7a9299fe9278115c9495694c7092d34b54d6a20148e00761999b484a21682b9ed867dd3880e5720177a7e8341f5487677f0aa9d38df28d268d17f9d
7
+ data.tar.gz: 9a6a06392dc2c41a29f55443c2093d1505be65974f2796308ce9ea3b3b1e02b5b6b198ff634e7794d27d89319ceede8d73dcd1de157b4b2aeae01e3645b50bff
data/.travis.yml CHANGED
@@ -8,6 +8,7 @@ rvm:
8
8
  - ruby-head
9
9
  matrix:
10
10
  allow_failures:
11
+ - rvm: 1.9.2
11
12
  - rvm: ruby-head
12
13
  - rvm: rbx-19mode
13
14
  notifications:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # [develop](https://github.com/adhearsion/punchblock)
2
2
 
3
+ # [v2.0.1](https://github.com/adhearsion/punchblock/compare/v2.0.0...v2.0.1) - [2013-09-17](https://rubygems.org/gems/punchblock/versions/2.0.1)
4
+ * Bugfix: Allow audio file URIs with file extensions on Asterisk
5
+ * Bugfix: Input timers were being started before output finished on Asterisk composed prompts
6
+ * Bugfix: Input initial timers were being started on Asterisk composed prompts even if the prompt was barged
7
+ * Bugfix: Output was being interrupted on Asterisk composed prompts at every DTMF keypress, even if the output was already finished
8
+
3
9
  # [v2.0.0](https://github.com/adhearsion/punchblock/compare/v1.9.4...v2.0.0) - [2013-08-29](https://rubygems.org/gems/punchblock/versions/2.0.0)
4
10
  * Feature: Compliance with v0.2 of the published Rayo spec (http://xmpp.org/extensions/xep-0327.html)
5
11
  * Feature: Add support for Rayo Prompt component
@@ -13,6 +13,8 @@ module Punchblock
13
13
  output_command.request!
14
14
  setup_dtmf_recognizer
15
15
 
16
+ @output_incomplete = true
17
+
16
18
  output_component = Output.new_link(output_command, @call)
17
19
  call.register_component output_component
18
20
  fut = output_component.future.execute
@@ -24,14 +26,24 @@ module Punchblock
24
26
  set_node_response output_command.response
25
27
  end
26
28
 
27
- fut.value unless @component_node.barge_in # Block until output is complete
28
-
29
- register_dtmf_event_handler
30
- start_timers
29
+ if @component_node.barge_in
30
+ @barged = false
31
+ register_dtmf_event_handler
32
+ fut.value # Block until output is complete before starting timers
33
+ @output_incomplete = false
34
+ start_timers unless @barged
35
+ else
36
+ fut.value # Block until output is complete before allowing input
37
+ register_dtmf_event_handler
38
+ start_timers
39
+ end
31
40
  end
32
41
 
33
42
  def process_dtmf(digit)
34
- call.async.redirect_back if @component_node.barge_in
43
+ if @component_node.barge_in && @output_incomplete
44
+ call.async.redirect_back
45
+ @barged = true
46
+ end
35
47
  super
36
48
  end
37
49
 
@@ -86,7 +86,7 @@ module Punchblock
86
86
  @filenames ||= render_doc.children.map do |node|
87
87
  case node
88
88
  when RubySpeech::SSML::Audio
89
- node.src.sub('file://', '')
89
+ node.src.sub('file://', '').gsub(/\.[^\.]*$/, '')
90
90
  when String
91
91
  raise if node.include?(' ')
92
92
  node
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Punchblock
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
@@ -296,6 +296,7 @@ module Punchblock
296
296
  it "should cause the actor to be terminated" do
297
297
  translator.should_receive(:handle_pb_event).twice
298
298
  subject.process_ami_event ami_event
299
+ Celluloid::Actor.join(subject, 1)
299
300
  subject.should_not be_alive
300
301
  end
301
302
 
@@ -26,7 +26,7 @@ module Punchblock
26
26
 
27
27
  let :ssml_doc do
28
28
  RubySpeech::SSML.draw do
29
- audio src: 'http://foo.com/bar.mp3'
29
+ audio src: 'tt-monkeys'
30
30
  end
31
31
  end
32
32
 
@@ -92,7 +92,7 @@ module Punchblock
92
92
  context '#barge_in' do
93
93
  context 'true' do
94
94
  it "should execute an output component on the call and return a ref" do
95
- call.should_receive(:execute_agi_command).once.with('EXEC Playback', 'http://foo.com/bar.mp3')
95
+ call.should_receive(:execute_agi_command).once.with('EXEC Playback', 'tt-monkeys')
96
96
  subject.execute
97
97
  original_command.response(0.1).should be_a Ref
98
98
  end
@@ -116,7 +116,7 @@ module Punchblock
116
116
 
117
117
  context 'false' do
118
118
  it "should execute an output component on the call" do
119
- call.should_receive(:execute_agi_command).once.with('EXEC Playback', 'http://foo.com/bar.mp3')
119
+ call.should_receive(:execute_agi_command).once.with('EXEC Playback', 'tt-monkeys')
120
120
  subject.execute
121
121
  original_command.response(0.1).should be_a Ref
122
122
  end
@@ -432,7 +432,7 @@ module Punchblock
432
432
  mock_call.should_receive(:execute_agi_command).once.with('EXEC Playback', audio_filename + ',noanswer').and_return code: 200
433
433
  end
434
434
 
435
- let(:audio_filename) { 'http://foo.com/bar.mp3' }
435
+ let(:audio_filename) { 'tt-monkeys' }
436
436
 
437
437
  let :ssml_doc do
438
438
  RubySpeech::SSML.draw do
@@ -494,6 +494,26 @@ module Punchblock
494
494
  end
495
495
  end
496
496
 
497
+ context "when the audio filename has an extension" do
498
+ let(:audio_filename) { 'tt-monkeys.wav' }
499
+
500
+ it 'should playback the audio file using Playback' do
501
+ expect_answered
502
+ expect_playback 'tt-monkeys'
503
+ subject.execute
504
+ end
505
+
506
+ context "when there are other dots in the filename" do
507
+ let(:audio_filename) { 'blue.tt-monkeys.wav' }
508
+
509
+ it 'should playback the audio file using Playback' do
510
+ expect_answered
511
+ expect_playback 'blue.tt-monkeys'
512
+ subject.execute
513
+ end
514
+ end
515
+ end
516
+
497
517
  context "when we get a RubyAMI Error" do
498
518
  it "should send an error complete event" do
499
519
  expect_answered
@@ -591,8 +611,8 @@ module Punchblock
591
611
  end
592
612
 
593
613
  context 'with multiple audio SSML nodes' do
594
- let(:audio_filename1) { 'http://foo.com/bar.mp3' }
595
- let(:audio_filename2) { 'http://foo.com/baz.mp3' }
614
+ let(:audio_filename1) { 'foo' }
615
+ let(:audio_filename2) { 'bar' }
596
616
  let :ssml_doc do
597
617
  RubySpeech::SSML.draw do
598
618
  audio :src => audio_filename1
data/spec/spec_helper.rb CHANGED
@@ -25,7 +25,7 @@ RSpec.configure do |config|
25
25
  end
26
26
 
27
27
  config.after :each do
28
- if Object.const_defined?(:Celluloid)
28
+ if defined?(:Celluloid)
29
29
  Celluloid.shutdown
30
30
  Celluloid.boot
31
31
  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: 2.0.0
4
+ version: 2.0.1
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-08-29 00:00:00.000000000 Z
13
+ date: 2013-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri