punchblock 2.4.2 → 2.5.0
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/CHANGELOG.md +4 -0
- data/Guardfile +10 -6
- data/lib/punchblock/connection/asterisk.rb +4 -0
- data/lib/punchblock/translator/asterisk.rb +5 -0
- data/lib/punchblock/translator/asterisk/call.rb +5 -0
- data/lib/punchblock/translator/asterisk/component/mrcp_recog_prompt.rb +3 -0
- data/lib/punchblock/version.rb +1 -1
- data/spec/punchblock/connection/asterisk_spec.rb +7 -0
- data/spec/punchblock/translator/asterisk/call_spec.rb +16 -0
- data/spec/punchblock/translator/asterisk/component/mrcp_native_prompt_spec.rb +51 -3
- data/spec/punchblock/translator/asterisk/component/mrcp_prompt_spec.rb +51 -3
- data/spec/punchblock/translator/asterisk_spec.rb +25 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b468b4ccd6ae157d9309dd8daf2462f6a3c83a26
|
|
4
|
+
data.tar.gz: 2c60dd9989e3116bb0e3a57271fe813db7ab746a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d67fd215f169976483231ed2228ed7f6005142a10c686eebe6ee6968f84e813cea80675921e5c66dc59e2aef2024502782adbe766204803849295bc21221030
|
|
7
|
+
data.tar.gz: 37f3f5f6083f2e1123246a7324c9612bd8245b25470adf4024144f9478421d27a65ab9cb23fd89cfa24c96990ae0af6ae64c1e7a335aa71b01c3e5200a153e26
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# [develop](https://github.com/adhearsion/punchblock)
|
|
2
2
|
|
|
3
|
+
# [v2.5.0](https://github.com/adhearsion/punchblock/compare/v2.4.2...v2.5.0) - [2014-03-05](https://rubygems.org/gems/punchblock/versions/2.5.0)
|
|
4
|
+
* Feature: Support language, sensitivity and minimum confidence on UniMRCP-based ASR on Asterisk
|
|
5
|
+
* Feature: Support sending messages to calls (eg SIP MESSAGE) on Asterisk
|
|
6
|
+
|
|
3
7
|
# [v2.4.2](https://github.com/adhearsion/punchblock/compare/v2.4.0...v2.4.2) - [2014-03-04](https://rubygems.org/gems/punchblock/versions/2.4.2)
|
|
4
8
|
* Bugfix: Rayo events should not include their timestamp in comparison. This is not useful in applications, and makes testing more difficult.
|
|
5
9
|
|
data/Guardfile
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
group 'rspec' do
|
|
2
|
+
guard 'rspec', :cli => '--format documentation' do
|
|
3
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
4
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
5
|
+
watch('spec/spec_helper.rb') { "spec/" }
|
|
6
|
+
end
|
|
5
7
|
end
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
group 'benchmarks' do
|
|
10
|
+
guard 'rake', task: 'benchmark', run_on_start: false do
|
|
11
|
+
watch(/benchmarks\/*/)
|
|
12
|
+
end
|
|
9
13
|
end
|
|
@@ -98,6 +98,11 @@ module Punchblock
|
|
|
98
98
|
connection.handle_event event
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
def send_message(call_id, domain, body, options = {})
|
|
102
|
+
call = call_with_id call_id
|
|
103
|
+
call.send_message body if call
|
|
104
|
+
end
|
|
105
|
+
|
|
101
106
|
def execute_command(command, options = {})
|
|
102
107
|
command.request!
|
|
103
108
|
|
|
@@ -159,6 +159,11 @@ module Punchblock
|
|
|
159
159
|
trigger_handler :ami, ami_event
|
|
160
160
|
end
|
|
161
161
|
|
|
162
|
+
def send_message(body)
|
|
163
|
+
execute_agi_command 'EXEC SendText', body
|
|
164
|
+
rescue
|
|
165
|
+
end
|
|
166
|
+
|
|
162
167
|
def execute_command(command)
|
|
163
168
|
if @block_commands
|
|
164
169
|
command.response = ProtocolError.new.setup :item_not_found, "Could not find a call with ID #{id}", id
|
|
@@ -46,6 +46,9 @@ module Punchblock
|
|
|
46
46
|
opts[:nit] = @initial_timeout if @initial_timeout > -1
|
|
47
47
|
opts[:dit] = @inter_digit_timeout if @inter_digit_timeout > -1
|
|
48
48
|
opts[:dttc] = input_node.terminator if input_node.terminator
|
|
49
|
+
opts[:spl] = input_node.language if input_node.language
|
|
50
|
+
opts[:ct] = input_node.min_confidence if input_node.min_confidence
|
|
51
|
+
opts[:sl] = input_node.sensitivity if input_node.sensitivity
|
|
49
52
|
yield opts
|
|
50
53
|
end
|
|
51
54
|
end
|
data/lib/punchblock/version.rb
CHANGED
|
@@ -97,6 +97,13 @@ module Punchblock
|
|
|
97
97
|
subject.new_call_uri.should == 'foobar'
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
|
+
|
|
101
|
+
describe '#send_message' do
|
|
102
|
+
it 'passes the message to the translator for dispatch' do
|
|
103
|
+
subject.translator.should_receive(:send_message).once.with(:foo)
|
|
104
|
+
subject.send_message :foo
|
|
105
|
+
end
|
|
106
|
+
end
|
|
100
107
|
end
|
|
101
108
|
end
|
|
102
109
|
end
|
|
@@ -1099,6 +1099,22 @@ module Punchblock
|
|
|
1099
1099
|
end
|
|
1100
1100
|
end
|
|
1101
1101
|
|
|
1102
|
+
describe '#send_message' do
|
|
1103
|
+
let(:body) { 'Hello world' }
|
|
1104
|
+
|
|
1105
|
+
it "should invoke SendText" do
|
|
1106
|
+
subject.should_receive(:execute_agi_command).with('EXEC SendText', body).and_return code: 200
|
|
1107
|
+
subject.send_message body
|
|
1108
|
+
end
|
|
1109
|
+
|
|
1110
|
+
context "when an AMI error is received" do
|
|
1111
|
+
it "is silently ignored" do
|
|
1112
|
+
subject.should_receive(:execute_agi_command).with('EXEC SendText', body).and_raise RubyAMI::Error.new.tap { |e| e.message = 'Call not found' }
|
|
1113
|
+
subject.send_message body
|
|
1114
|
+
end
|
|
1115
|
+
end
|
|
1116
|
+
end
|
|
1117
|
+
|
|
1102
1118
|
describe '#execute_command' do
|
|
1103
1119
|
before do
|
|
1104
1120
|
command.request!
|
|
@@ -576,11 +576,43 @@ module Punchblock
|
|
|
576
576
|
end
|
|
577
577
|
|
|
578
578
|
describe 'Input#sensitivity' do
|
|
579
|
-
|
|
579
|
+
context 'a string' do
|
|
580
|
+
let(:input_command_opts) { { sensitivity: '0.2' } }
|
|
581
|
+
|
|
582
|
+
it 'should pass the sl option to MRCPRecog' do
|
|
583
|
+
expect_mrcprecog_with_options(/sl=0.2/)
|
|
584
|
+
subject.execute
|
|
585
|
+
end
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
context 'unset' do
|
|
589
|
+
let(:input_command_opts) { { sensitivity: nil } }
|
|
590
|
+
|
|
591
|
+
it 'should not pass any options to MRCPRecog' do
|
|
592
|
+
expect_mrcprecog_with_options(//)
|
|
593
|
+
subject.execute
|
|
594
|
+
end
|
|
595
|
+
end
|
|
580
596
|
end
|
|
581
597
|
|
|
582
598
|
describe 'Input#min-confidence' do
|
|
583
|
-
|
|
599
|
+
context 'a string' do
|
|
600
|
+
let(:input_command_opts) { { min_confidence: '0.5' } }
|
|
601
|
+
|
|
602
|
+
it 'should pass the ct option to MRCPRecog' do
|
|
603
|
+
expect_mrcprecog_with_options(/ct=0.5/)
|
|
604
|
+
subject.execute
|
|
605
|
+
end
|
|
606
|
+
end
|
|
607
|
+
|
|
608
|
+
context 'unset' do
|
|
609
|
+
let(:input_command_opts) { { min_confidence: nil } }
|
|
610
|
+
|
|
611
|
+
it 'should not pass any options to MRCPRecog' do
|
|
612
|
+
expect_mrcprecog_with_options(//)
|
|
613
|
+
subject.execute
|
|
614
|
+
end
|
|
615
|
+
end
|
|
584
616
|
end
|
|
585
617
|
|
|
586
618
|
describe 'Input#max-silence' do
|
|
@@ -592,7 +624,23 @@ module Punchblock
|
|
|
592
624
|
end
|
|
593
625
|
|
|
594
626
|
describe 'Input#language' do
|
|
595
|
-
|
|
627
|
+
context 'a string' do
|
|
628
|
+
let(:input_command_opts) { { language: 'en-GB' } }
|
|
629
|
+
|
|
630
|
+
it 'should pass the spl option to MRCPRecog' do
|
|
631
|
+
expect_mrcprecog_with_options(/spl=en-GB/)
|
|
632
|
+
subject.execute
|
|
633
|
+
end
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
context 'unset' do
|
|
637
|
+
let(:input_command_opts) { { language: nil } }
|
|
638
|
+
|
|
639
|
+
it 'should not pass any options to MRCPRecog' do
|
|
640
|
+
expect_mrcprecog_with_options(//)
|
|
641
|
+
subject.execute
|
|
642
|
+
end
|
|
643
|
+
end
|
|
596
644
|
end
|
|
597
645
|
|
|
598
646
|
describe "#execute_command" do
|
|
@@ -568,11 +568,43 @@ module Punchblock
|
|
|
568
568
|
end
|
|
569
569
|
|
|
570
570
|
describe 'Input#sensitivity' do
|
|
571
|
-
|
|
571
|
+
context 'a string' do
|
|
572
|
+
let(:input_command_opts) { { sensitivity: '0.2' } }
|
|
573
|
+
|
|
574
|
+
it 'should pass the sl option to SynthAndRecog' do
|
|
575
|
+
expect_synthandrecog_with_options(/sl=0.2/)
|
|
576
|
+
subject.execute
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
context 'unset' do
|
|
581
|
+
let(:input_command_opts) { { sensitivity: nil } }
|
|
582
|
+
|
|
583
|
+
it 'should not pass any options to SynthAndRecog' do
|
|
584
|
+
expect_synthandrecog_with_options(//)
|
|
585
|
+
subject.execute
|
|
586
|
+
end
|
|
587
|
+
end
|
|
572
588
|
end
|
|
573
589
|
|
|
574
590
|
describe 'Input#min-confidence' do
|
|
575
|
-
|
|
591
|
+
context 'a string' do
|
|
592
|
+
let(:input_command_opts) { { min_confidence: '0.5' } }
|
|
593
|
+
|
|
594
|
+
it 'should pass the ct option to SynthAndRecog' do
|
|
595
|
+
expect_synthandrecog_with_options(/ct=0.5/)
|
|
596
|
+
subject.execute
|
|
597
|
+
end
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
context 'unset' do
|
|
601
|
+
let(:input_command_opts) { { min_confidence: nil } }
|
|
602
|
+
|
|
603
|
+
it 'should not pass any options to SynthAndRecog' do
|
|
604
|
+
expect_synthandrecog_with_options(//)
|
|
605
|
+
subject.execute
|
|
606
|
+
end
|
|
607
|
+
end
|
|
576
608
|
end
|
|
577
609
|
|
|
578
610
|
describe 'Input#max-silence' do
|
|
@@ -584,7 +616,23 @@ module Punchblock
|
|
|
584
616
|
end
|
|
585
617
|
|
|
586
618
|
describe 'Input#language' do
|
|
587
|
-
|
|
619
|
+
context 'a string' do
|
|
620
|
+
let(:input_command_opts) { { language: 'en-GB' } }
|
|
621
|
+
|
|
622
|
+
it 'should pass the spl option to SynthAndRecog' do
|
|
623
|
+
expect_synthandrecog_with_options(/spl=en-GB/)
|
|
624
|
+
subject.execute
|
|
625
|
+
end
|
|
626
|
+
end
|
|
627
|
+
|
|
628
|
+
context 'unset' do
|
|
629
|
+
let(:input_command_opts) { { language: nil } }
|
|
630
|
+
|
|
631
|
+
it 'should not pass any options to SynthAndRecog' do
|
|
632
|
+
expect_synthandrecog_with_options(//)
|
|
633
|
+
subject.execute
|
|
634
|
+
end
|
|
635
|
+
end
|
|
588
636
|
end
|
|
589
637
|
|
|
590
638
|
describe "#execute_command" do
|
|
@@ -59,6 +59,29 @@ module Punchblock
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
describe '#send_message' do
|
|
63
|
+
let(:call_id) { 'abc123' }
|
|
64
|
+
let(:body) { 'hello world' }
|
|
65
|
+
let(:call) { Translator::Asterisk::Call.new 'SIP/foo', subject, ami_client, connection }
|
|
66
|
+
|
|
67
|
+
before do
|
|
68
|
+
call.stub(:id).and_return call_id
|
|
69
|
+
subject.register_call call
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'sends the command to the call for execution' do
|
|
73
|
+
call.should_receive(:send_message).once.with body
|
|
74
|
+
subject.send_message call_id, 'example.com', body, subject: 'stuff'
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
context "when the call doesn't exist" do
|
|
78
|
+
it "should not crash the translator" do
|
|
79
|
+
subject.send_message 'oops', 'example.com', body, subject: 'stuff'
|
|
80
|
+
subject.should be_alive
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
62
85
|
describe '#register_call' do
|
|
63
86
|
let(:call_id) { 'abc123' }
|
|
64
87
|
let(:channel) { 'SIP/foo' }
|
|
@@ -235,10 +258,11 @@ module Punchblock
|
|
|
235
258
|
subject.execute_global_command earlier_command
|
|
236
259
|
|
|
237
260
|
@first_call = subject.call_with_id(requested_uri)
|
|
261
|
+
|
|
262
|
+
subject.execute_global_command command
|
|
238
263
|
end
|
|
239
264
|
|
|
240
265
|
it "should set the command response to a conflict error" do
|
|
241
|
-
subject.execute_global_command command
|
|
242
266
|
command.response(0.1).should == ProtocolError.new.setup(:conflict, 'Call ID already in use')
|
|
243
267
|
end
|
|
244
268
|
|
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.
|
|
4
|
+
version: 2.5.0
|
|
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: 2014-03-
|
|
13
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: nokogiri
|