punchblock 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/punchblock.rb +1 -0
- data/lib/punchblock/actor_has_guarded_handlers.rb +7 -0
- data/lib/punchblock/translator/asterisk/call.rb +9 -1
- data/lib/punchblock/translator/freeswitch.rb +3 -0
- data/lib/punchblock/translator/freeswitch/call.rb +3 -0
- data/lib/punchblock/translator/freeswitch/component.rb +3 -0
- data/lib/punchblock/version.rb +1 -1
- data/punchblock.gemspec +1 -1
- data/spec/punchblock/translator/asterisk/call_spec.rb +84 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2afefcb37df1adbbdbd78069ace76a6e7a90ff6a
|
4
|
+
data.tar.gz: 19c35819dbc195978dc642e89171e8ce2369cb9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 424af09c594e3ef4f26ae02452ebae5bdaf7b7c1f3df1b2235914e3397360468c9135905bb61e352a0b09097e4958538dec4645778413dcd61d5740a41e6b70b
|
7
|
+
data.tar.gz: 809aa86ad8b9e5c211c774279f27d7f853a05802bb7c52b2c95f5d23477e8ff4f6c708d5f678c3c770821692727375748a2510d6ab284c5d7906910c45539986
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/punchblock)
|
2
2
|
|
3
|
+
# [v1.9.1](https://github.com/adhearsion/punchblock/compare/v1.9.0...v1.9.1) - [2013-05-08](https://rubygems.org/gems/punchblock/versions/1.9.1)
|
4
|
+
* Bugfix: AMI errors indicating dead channels were not being handled correctly
|
5
|
+
* Bugfix: We were broken on Celluloid 0.14 due to changes in block execution semantics between actors
|
6
|
+
|
3
7
|
# [v1.9.0](https://github.com/adhearsion/punchblock/compare/v1.8.2...v1.9.0) - [2013-05-03](https://rubygems.org/gems/punchblock/versions/1.9.0)
|
4
8
|
* Feature: Use RubyAMI 2.0 with a single AMI connection.
|
5
9
|
* Feature: Cache channel variables on Asterisk calls.
|
data/lib/punchblock.rb
CHANGED
@@ -8,6 +8,9 @@ module Punchblock
|
|
8
8
|
include Celluloid
|
9
9
|
include DeadActorSafety
|
10
10
|
|
11
|
+
extend ActorHasGuardedHandlers
|
12
|
+
execute_guarded_handlers_on_receiver
|
13
|
+
|
11
14
|
attr_reader :id, :channel, :translator, :agi_env, :direction
|
12
15
|
|
13
16
|
HANGUP_CAUSE_TO_END_REASON = Hash.new { :error }
|
@@ -215,7 +218,12 @@ module Punchblock
|
|
215
218
|
command.response = ProtocolError.new.setup 'command-not-acceptable', "Did not understand command for call #{id}", id
|
216
219
|
end
|
217
220
|
rescue RubyAMI::Error => e
|
218
|
-
command.response =
|
221
|
+
command.response = case e.message
|
222
|
+
when 'No such channel'
|
223
|
+
ProtocolError.new.setup :item_not_found, "Could not find a call with ID #{id}", id
|
224
|
+
else
|
225
|
+
ProtocolError.new.setup 'error', e.message, id
|
226
|
+
end
|
219
227
|
rescue Celluloid::DeadActorError
|
220
228
|
command.response = ProtocolError.new.setup :item_not_found, "Could not find a component with ID #{command.component_id} for call #{id}", id, command.component_id
|
221
229
|
end
|
data/lib/punchblock/version.rb
CHANGED
data/punchblock.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_runtime_dependency %q<state_machine>, ["~> 1.0"]
|
30
30
|
s.add_runtime_dependency %q<future-resource>, ["~> 1.0"]
|
31
31
|
s.add_runtime_dependency %q<has-guarded-handlers>, ["~> 1.5"]
|
32
|
-
s.add_runtime_dependency %q<celluloid>, ["~> 0.
|
32
|
+
s.add_runtime_dependency %q<celluloid>, ["~> 0.14"]
|
33
33
|
s.add_runtime_dependency %q<ruby_ami>, ["~> 2.0"]
|
34
34
|
s.add_runtime_dependency %q<ruby_fs>, ["~> 1.0"]
|
35
35
|
s.add_runtime_dependency %q<ruby_speech>, ["~> 1.0"]
|
@@ -851,6 +851,27 @@ module Punchblock
|
|
851
851
|
subject.execute_command command
|
852
852
|
command.response(0.5).should be true
|
853
853
|
end
|
854
|
+
|
855
|
+
context "when the AMI commannd raises an error" do
|
856
|
+
let(:message) { 'Some error' }
|
857
|
+
let(:error) { RubyAMI::Error.new.tap { |e| e.message = message } }
|
858
|
+
|
859
|
+
before { subject.wrapped_object.should_receive(:execute_agi_command).and_raise error }
|
860
|
+
|
861
|
+
it "should return an error with the message" do
|
862
|
+
subject.execute_command command
|
863
|
+
command.response(0.5).should be == ProtocolError.new.setup('error', message, subject.id)
|
864
|
+
end
|
865
|
+
|
866
|
+
context "with message 'No such channel'" do
|
867
|
+
let(:message) { 'No such channel' }
|
868
|
+
|
869
|
+
it "should return an :item_not_found event for the call" do
|
870
|
+
subject.execute_command command
|
871
|
+
command.response(0.5).should be == ProtocolError.new.setup(:item_not_found, "Could not find a call with ID #{subject.id}", subject.id)
|
872
|
+
end
|
873
|
+
end
|
874
|
+
end
|
854
875
|
end
|
855
876
|
|
856
877
|
context 'with a reject command' do
|
@@ -876,6 +897,27 @@ module Punchblock
|
|
876
897
|
subject.execute_command command
|
877
898
|
command.response(0.5).should be true
|
878
899
|
end
|
900
|
+
|
901
|
+
context "when the AMI commannd raises an error" do
|
902
|
+
let(:message) { 'Some error' }
|
903
|
+
let(:error) { RubyAMI::Error.new.tap { |e| e.message = message } }
|
904
|
+
|
905
|
+
before { subject.wrapped_object.should_receive(:execute_agi_command).and_raise error }
|
906
|
+
|
907
|
+
it "should return an error with the message" do
|
908
|
+
subject.execute_command command
|
909
|
+
command.response(0.5).should be == ProtocolError.new.setup('error', message, subject.id)
|
910
|
+
end
|
911
|
+
|
912
|
+
context "with message 'No such channel'" do
|
913
|
+
let(:message) { 'No such channel' }
|
914
|
+
|
915
|
+
it "should return an :item_not_found event for the call" do
|
916
|
+
subject.execute_command command
|
917
|
+
command.response(0.5).should be == ProtocolError.new.setup(:item_not_found, "Could not find a call with ID #{subject.id}", subject.id)
|
918
|
+
end
|
919
|
+
end
|
920
|
+
end
|
879
921
|
end
|
880
922
|
|
881
923
|
context 'with an answer command' do
|
@@ -886,6 +928,27 @@ module Punchblock
|
|
886
928
|
subject.execute_command command
|
887
929
|
command.response(0.5).should be true
|
888
930
|
end
|
931
|
+
|
932
|
+
context "when the AMI commannd raises an error" do
|
933
|
+
let(:message) { 'Some error' }
|
934
|
+
let(:error) { RubyAMI::Error.new.tap { |e| e.message = message } }
|
935
|
+
|
936
|
+
before { subject.wrapped_object.should_receive(:execute_agi_command).and_raise error }
|
937
|
+
|
938
|
+
it "should return an error with the message" do
|
939
|
+
subject.execute_command command
|
940
|
+
command.response(0.5).should be == ProtocolError.new.setup('error', message, subject.id)
|
941
|
+
end
|
942
|
+
|
943
|
+
context "with message 'No such channel'" do
|
944
|
+
let(:message) { 'No such channel' }
|
945
|
+
|
946
|
+
it "should return an :item_not_found event for the call" do
|
947
|
+
subject.execute_command command
|
948
|
+
command.response(0.5).should be == ProtocolError.new.setup(:item_not_found, "Could not find a call with ID #{subject.id}", subject.id)
|
949
|
+
end
|
950
|
+
end
|
951
|
+
end
|
889
952
|
end
|
890
953
|
|
891
954
|
context 'with a hangup command' do
|
@@ -896,6 +959,27 @@ module Punchblock
|
|
896
959
|
subject.execute_command command
|
897
960
|
command.response(0.5).should be true
|
898
961
|
end
|
962
|
+
|
963
|
+
context "when the AMI commannd raises an error" do
|
964
|
+
let(:message) { 'Some error' }
|
965
|
+
let(:error) { RubyAMI::Error.new.tap { |e| e.message = message } }
|
966
|
+
|
967
|
+
before { ami_client.should_receive(:send_action).and_raise error }
|
968
|
+
|
969
|
+
it "should return an error with the message" do
|
970
|
+
subject.execute_command command
|
971
|
+
command.response(0.5).should be == ProtocolError.new.setup('error', message, subject.id)
|
972
|
+
end
|
973
|
+
|
974
|
+
context "with message 'No such channel'" do
|
975
|
+
let(:message) { 'No such channel' }
|
976
|
+
|
977
|
+
it "should return an :item_not_found event for the call" do
|
978
|
+
subject.execute_command command
|
979
|
+
command.response(0.5).should be == ProtocolError.new.setup(:item_not_found, "Could not find a call with ID #{subject.id}", subject.id)
|
980
|
+
end
|
981
|
+
end
|
982
|
+
end
|
899
983
|
end
|
900
984
|
|
901
985
|
context 'with an AGI command component' do
|
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.
|
4
|
+
version: 1.9.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-05-
|
13
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: niceogiri
|
@@ -122,14 +122,14 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0.
|
125
|
+
version: '0.14'
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - ~>
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0.
|
132
|
+
version: '0.14'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: ruby_ami
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -316,6 +316,7 @@ files:
|
|
316
316
|
- README.markdown
|
317
317
|
- Rakefile
|
318
318
|
- lib/punchblock.rb
|
319
|
+
- lib/punchblock/actor_has_guarded_handlers.rb
|
319
320
|
- lib/punchblock/client.rb
|
320
321
|
- lib/punchblock/client/component_registry.rb
|
321
322
|
- lib/punchblock/command.rb
|