adhearsion 3.0.0.beta2 → 3.0.0.rc1

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: b3cc409522daab633c1bc664407fdfc6a5108694
4
- data.tar.gz: 5c9a537a64f4a571916f1fd90bce584b9ea4ab95
3
+ metadata.gz: 58bfea2313c16c16cb6cf6ee34738c67e5ade786
4
+ data.tar.gz: 9f44a7a42185fa285372829b26d157dab2e22c99
5
5
  SHA512:
6
- metadata.gz: 5a1567863c4da74228af44de62df55dc68cc4d2dca383e9c3719b7d079131035462c42a8687b956459115f514a59edf6a5affd7059c34a3199aaa1a856538a3d
7
- data.tar.gz: 2de7f4d8e52804198127af271104a7c52335c67a4bf3a20b613a3bef858afd6b4bb9d6b2135ef267c535d77701ad09e2c0968fe12036c80de24b83f72d4f5275
6
+ metadata.gz: e9aa1a8e2ed989b75d65196457652da368a0d50cf1368ba6817f5e48a88d47afcc7703b1340c555f0a41c9abca44b584aabf1d376ca01afcbbd5317a55dde0d4
7
+ data.tar.gz: b05beee7c6cf383718cb4c94323dc652667ca2468ef7345a5f5cb87780a952964b67aeb7f8c50cc0f6a795ebb59089e663559f2440eb625ae5c24edbe0320ce0
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
4
- - 2.2.1
5
3
  - 2.2.2
6
- - jruby-9.0.0.0
4
+ - 2.3.0
5
+ - jruby-9.0.4.0
7
6
  - ruby-head
8
7
  jdk:
9
8
  - openjdk7 # for jruby
@@ -1,5 +1,9 @@
1
1
  # [develop](https://github.com/adhearsion/adhearsion)
2
2
 
3
+ # [3.0.0.rc1](https://github.com/adhearsion/adhearsion/compare/v3.0.0.beta2...v3.0.0.rc1) - [2016-01-07](https://rubygems.org/gems/adhearsion/versions/3.0.0.rc1)
4
+ * Bugfix: Concurrent access to call collection should not be permitted. See [#589](https://github.com/adhearsion/adhearsion/issues/589)
5
+ * Bugfix: Reduced log spam inspecting large controller metadata. We now only log controller names internally; any logging of metadata must happen in the app.
6
+
3
7
  # [3.0.0.beta2](https://github.com/adhearsion/adhearsion/compare/v3.0.0.beta1...v3.0.0.beta2) - [2015-12-18](https://rubygems.org/gems/adhearsion/versions/3.0.0.beta2)
4
8
  * Bugfix: Ensure components are deregistered from asterisk translator once the call is ended ([#582](https://github.com/adhearsion/adhearsion/pull/582))
5
9
  * Change: Define configuration per-environment for any environment name and without colliding with plugin names. See [#442](https://github.com/adhearsion/adhearsion/issues/442). Syntax is now `config.env(:development).foo = :bar` instead of `config.development.foo = :bar`.
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_runtime_dependency 'activesupport', [">= 3.0.0", "< 5.0.0"]
25
25
  s.add_runtime_dependency 'adhearsion-loquacious', ["~> 1.9"]
26
- s.add_runtime_dependency 'blather', ["~> 1.0"]
26
+ s.add_runtime_dependency 'blather', ["~> 1.2"]
27
27
  s.add_runtime_dependency 'bundler', ["~> 1.0"]
28
28
  s.add_runtime_dependency 'celluloid', ["~> 0.16.0"]
29
29
  s.add_runtime_dependency 'countdownlatch'
@@ -132,7 +132,7 @@ module Adhearsion
132
132
  raise
133
133
  ensure
134
134
  after
135
- logger.debug "Finished executing controller #{self.inspect}"
135
+ logger.debug "Finished executing controller #{self.class}"
136
136
  end
137
137
 
138
138
  #
@@ -22,26 +22,30 @@ module Adhearsion
22
22
  end
23
23
 
24
24
  def remove_inactive_call(call)
25
- if call_is_dead?(call)
26
- call_id = key call
27
- delete call_id if call_id
28
-
29
- remove_call_uri call
30
- elsif call.respond_to?(:id)
31
- delete call.id
32
- remove_call_uri call
33
- else
34
- call_actor = delete call
35
- remove_call_uri call_actor
25
+ @mutex.synchronize do
26
+ if call_is_dead?(call)
27
+ call_id = key call
28
+ delete call_id if call_id
29
+
30
+ remove_call_uri call
31
+ elsif call.respond_to?(:id)
32
+ delete call.id
33
+ remove_call_uri call
34
+ else
35
+ call_actor = delete call
36
+ remove_call_uri call_actor
37
+ end
36
38
  end
37
39
  end
38
40
 
39
41
  def with_tag(tag)
40
- values.find_all do |call|
41
- begin
42
- call.tagged_with? tag
43
- rescue Call::ExpiredError
44
- false
42
+ @mutex.synchronize do
43
+ values.find_all do |call|
44
+ begin
45
+ call.tagged_with? tag
46
+ rescue Call::ExpiredError
47
+ false
48
+ end
45
49
  end
46
50
  end
47
51
  end
@@ -124,7 +124,9 @@ module Adhearsion
124
124
  begin
125
125
  call.execute_command command
126
126
  rescue => e
127
+ Adhearsion::Events.trigger :exception, [e, logger]
127
128
  deregister_call call.id, call.channel
129
+ command.response = Adhearsion::ProtocolError.new.setup :error, "Unknown error executing command on call #{command.target_call_id}", command.target_call_id
128
130
  end
129
131
  else
130
132
  command.response = Adhearsion::ProtocolError.new.setup :item_not_found, "Could not find a call with ID #{command.target_call_id}", command.target_call_id
@@ -19,6 +19,13 @@ module Adhearsion
19
19
  raise OptionError, 'Only one document is allowed.' if output_node.render_documents.count > 1
20
20
  raise OptionError, 'A grammar is required.' unless input_node.grammars.count > 0
21
21
 
22
+ begin
23
+ render_doc
24
+ rescue => e
25
+ logger.error e
26
+ raise OptionError, 'The requested render document could not be parsed.'
27
+ end
28
+
22
29
  super
23
30
  end
24
31
 
@@ -35,11 +42,13 @@ module Adhearsion
35
42
  end
36
43
 
37
44
  def render_doc
38
- d = output_node.render_documents.first
39
- if d.content_type
40
- d.value.to_doc.to_s
41
- else
42
- d.url
45
+ @render_doc ||= begin
46
+ d = output_node.render_documents.first
47
+ if d.content_type
48
+ d.value.to_doc.to_s
49
+ else
50
+ d.url
51
+ end
43
52
  end
44
53
  end
45
54
 
@@ -53,6 +53,13 @@ module Adhearsion
53
53
  raise OptionError, "A dtmf-terminate-timeout value must be -1, 0, or a positive integer." if @dtmf_terminate_timeout < -1
54
54
  raise OptionError, "An n-best-list-length value must be a positive integer." if @n_best_list_length && @n_best_list_length < 1
55
55
  raise OptionError, "A speed-vs-accuracy value must be a positive integer." if @speed_vs_accuracy && @speed_vs_accuracy < 0
56
+
57
+ begin
58
+ grammars
59
+ rescue => e
60
+ logger.error e
61
+ raise OptionError, 'The requested grammars could not be parsed.'
62
+ end
56
63
  end
57
64
 
58
65
  def execute_app(app, *args)
@@ -111,7 +118,7 @@ module Adhearsion
111
118
  end
112
119
 
113
120
  def grammars
114
- input_node.grammars.map do |d|
121
+ @grammars ||= input_node.grammars.map do |d|
115
122
  if d.content_type
116
123
  d.value.to_doc.to_s
117
124
  else
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Adhearsion
4
- VERSION = '3.0.0.beta2'
4
+ VERSION = '3.0.0.rc1'
5
5
  end
@@ -151,6 +151,16 @@ module Adhearsion
151
151
  end
152
152
  end
153
153
 
154
+ context 'with a document that cannot be parsed' do
155
+ let(:output_command_options) { { render_documents: [{value: 'http://example.com/doc1.ssml'}] } }
156
+
157
+ it "should return an error and not execute any actions" do
158
+ subject.execute
159
+ error = Adhearsion::ProtocolError.new.setup 'option error', 'The requested render document could not be parsed.'
160
+ expect(original_command.response(0.1)).to eq(error)
161
+ end
162
+ end
163
+
154
164
  context 'unset' do
155
165
  let(:output_command_options) { {} }
156
166
 
@@ -485,6 +495,16 @@ module Adhearsion
485
495
  end
486
496
  end
487
497
 
498
+ context 'with a grammar that cannot be parsed' do
499
+ let(:input_command_options) { { grammars: [{value: 'http://example.com/grammar1.grxml'}] } }
500
+
501
+ it "should return an error and not execute any actions" do
502
+ subject.execute
503
+ error = Adhearsion::ProtocolError.new.setup 'option error', 'The requested grammars could not be parsed.'
504
+ expect(original_command.response(0.1)).to eq(error)
505
+ end
506
+ end
507
+
488
508
  context 'unset' do
489
509
  let(:input_command_options) { {} }
490
510
 
@@ -168,6 +168,11 @@ module Adhearsion
168
168
 
169
169
  it 'sends an error in response to the command' do
170
170
  subject.execute_call_command command
171
+ expect(command.response(1)).to eq(Adhearsion::ProtocolError.new.setup(:error, "Unknown error executing command on call #{call_id}", call_id))
172
+ end
173
+
174
+ it 'fails to find the call for later commands' do
175
+ subject.execute_call_command command
171
176
 
172
177
  expect(subject.call_with_id(call_id)).to be_nil
173
178
 
@@ -175,6 +180,21 @@ module Adhearsion
175
180
  subject.execute_call_command other_command
176
181
  expect(other_command.response).to eq(Adhearsion::ProtocolError.new.setup(:item_not_found, "Could not find a call with ID #{call_id}", call_id))
177
182
  end
183
+
184
+ it 'triggers an exception event' do
185
+ latch = CountDownLatch.new 1
186
+ ex = lo = nil
187
+ Events.exception do |e, l|
188
+ ex, lo = e, l
189
+ latch.countdown!
190
+ end
191
+
192
+ subject.execute_call_command command
193
+
194
+ expect(latch.wait(1)).to be true
195
+ expect(ex).to be_a StandardError
196
+ expect(lo).to be subject.logger
197
+ end
178
198
  end
179
199
  end
180
200
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta2
4
+ version: 3.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Phillips
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-12-18 00:00:00.000000000 Z
14
+ date: 2016-01-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -53,14 +53,14 @@ dependencies:
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.0'
56
+ version: '1.2'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '1.0'
63
+ version: '1.2'
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: bundler
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -867,7 +867,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
867
867
  version: 1.3.1
868
868
  requirements: []
869
869
  rubyforge_project:
870
- rubygems_version: 2.4.5
870
+ rubygems_version: 2.5.1
871
871
  signing_key:
872
872
  specification_version: 4
873
873
  summary: Adhearsion, open-source telephony development framework