punchblock 2.7.3 → 2.7.5

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: 86410aa568b8fd10b260d97e0e3187834097b550
4
- data.tar.gz: 954ca1896cde21a38f37f5a8739e4d633adb82ca
3
+ metadata.gz: ad809b46c952fab2dde14ff9fa2076444fc3ca1f
4
+ data.tar.gz: 012e3cdd57292c29de4ec7b5b24592d8119e9b29
5
5
  SHA512:
6
- metadata.gz: e289ce672d08483c6c8e5e29e471ad0e4a659546bcc4f5f1f0de8d14ca0a7229bafdafb45e9e2d91f9542df77b6231fd8bfdd4a2350e75cf447cab6197661822
7
- data.tar.gz: a591e599f2457c1829f30e63abd955958fecdf7ec999d61269a7d6c6123c63588e7aa27a7cfa26ff350416b9a9a2cfdda07a833f32f2c529cbe998911e755c8e
6
+ metadata.gz: bb5d7c573f2727bb01dabb7bacfb91dced011bc721e82cc718504f2fc18f5a8884d9e04dd0328323f1ed7bd11670f1f0ae2765a8dda8a5e4cc9ebf672849b1cd
7
+ data.tar.gz: ea88f1bd43911acb79b3684d313aa3c76137fd18e7a38c4e8ffdaa47a85129dcfe0d19113967d470843a3f5fc9db9bda1ab13fff563a145908e9fc47ea20fecc
@@ -1,5 +1,12 @@
1
1
  # [develop](https://github.com/adhearsion/punchblock)
2
2
 
3
+ # [v2.7.5](https://github.com/adhearsion/punchblock/compare/v2.7.4...v2.7.5) - [2015-08-27](https://rubygems.org/gems/punchblock/versions/2.7.5)
4
+ * Bugfix: Alternative fix for "Avoid race conditions in processing calls with interactions between them". The original fix in 2.7.4 introduced crashes relating to creating call actors at high call volume.
5
+
6
+ # [v2.7.4](https://github.com/adhearsion/punchblock/compare/v2.7.3...v2.7.4) - [2015-08-19](https://rubygems.org/gems/punchblock/versions/2.7.4)
7
+ * YANKED
8
+ * Bugfix: Avoid race conditions in processing calls with interactions between them
9
+
3
10
  # [v2.7.3](https://github.com/adhearsion/punchblock/compare/v2.7.2...v2.7.3) - [2015-08-18](https://rubygems.org/gems/punchblock/versions/2.7.3)
4
11
  * Bugfix: Handle correct event for confirming that a component stop was completed on Asterisk 13
5
12
 
@@ -18,7 +18,7 @@ module Punchblock
18
18
  autoload :Channel
19
19
  autoload :Component
20
20
 
21
- attr_reader :ami_client, :connection, :calls, :bridges
21
+ attr_reader :ami_client, :connection, :calls
22
22
 
23
23
  REDIRECT_CONTEXT = 'adhearsion-redirect'
24
24
  REDIRECT_EXTENSION = '1'
@@ -83,10 +83,28 @@ module Punchblock
83
83
  def handle_ami_event(event)
84
84
  return unless event.is_a? RubyAMI::Event
85
85
 
86
- if event.name == 'FullyBooted'
86
+ case event.name
87
+ when 'FullyBooted'
87
88
  handle_pb_event Connection::Connected.new
88
89
  run_at_fully_booted
89
90
  return
91
+ when 'BridgeEnter'
92
+ if other_channel = @bridges.delete(event['BridgeUniqueid'])
93
+ if event['OtherCall'] = call_for_channel(other_channel)
94
+ join_command = event['OtherCall'].pending_joins.delete event['Channel']
95
+ call = call_for_channel(event['Channel'])
96
+ join_command ||= call.pending_joins.delete other_channel if call
97
+ join_command.response = true if join_command
98
+ end
99
+ else
100
+ @bridges[event['BridgeUniqueid']] = event['Channel']
101
+ end
102
+ when 'BridgeLeave'
103
+ if other_channel = @bridges.delete(event['BridgeUniqueid'] + '_leave')
104
+ event['OtherCall'] = call_for_channel(other_channel)
105
+ else
106
+ @bridges[event['BridgeUniqueid'] + '_leave'] = event['Channel']
107
+ end
90
108
  end
91
109
 
92
110
  handle_varset_ami_event event
@@ -137,34 +137,22 @@ module Punchblock
137
137
  send_pb_event Event::Ringing.new(timestamp: ami_event.best_time)
138
138
  end
139
139
  when 'BridgeEnter'
140
- if other_call_channel = translator.bridges.delete(ami_event['BridgeUniqueid'])
141
- if other_call = translator.call_for_channel(other_call_channel)
142
- join_command = @pending_joins.delete other_call_channel
143
- join_command ||= other_call.pending_joins.delete channel
144
- join_command.response = true if join_command
145
-
146
- event = Event::Joined.new call_uri: other_call.id, timestamp: ami_event.best_time
147
- send_pb_event event
148
-
149
- other_call_event = Event::Joined.new call_uri: id, timestamp: ami_event.best_time
150
- other_call_event.target_call_id = other_call.id
151
- translator.handle_pb_event other_call_event
152
- end
153
- else
154
- translator.bridges[ami_event['BridgeUniqueid']] = ami_event['Channel']
140
+ if other_call = ami_event['OtherCall']
141
+ event = Event::Joined.new call_uri: other_call.id, timestamp: ami_event.best_time
142
+ send_pb_event event
143
+
144
+ other_call_event = Event::Joined.new call_uri: id, timestamp: ami_event.best_time
145
+ other_call_event.target_call_id = other_call.id
146
+ translator.handle_pb_event other_call_event
155
147
  end
156
148
  when 'BridgeLeave'
157
- if other_call_channel = translator.bridges.delete(ami_event['BridgeUniqueid'] + '_leave')
158
- if other_call = translator.call_for_channel(other_call_channel)
159
- event = Event::Unjoined.new call_uri: other_call.id, timestamp: ami_event.best_time
160
- send_pb_event event
161
-
162
- other_call_event = Event::Unjoined.new call_uri: id, timestamp: ami_event.best_time
163
- other_call_event.target_call_id = other_call.id
164
- translator.handle_pb_event other_call_event
165
- end
166
- else
167
- translator.bridges[ami_event['BridgeUniqueid'] + '_leave'] = ami_event['Channel']
149
+ if other_call = ami_event['OtherCall']
150
+ event = Event::Unjoined.new call_uri: other_call.id, timestamp: ami_event.best_time
151
+ send_pb_event event
152
+
153
+ other_call_event = Event::Unjoined.new call_uri: id, timestamp: ami_event.best_time
154
+ other_call_event.target_call_id = other_call.id
155
+ translator.handle_pb_event other_call_event
168
156
  end
169
157
  when 'OriginateResponse'
170
158
  if ami_event['Response'] == 'Failure' && ami_event['Uniqueid'] == '<null>'
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Punchblock
4
- VERSION = "2.7.3"
4
+ VERSION = "2.7.5"
5
5
  end
@@ -818,13 +818,6 @@ module Punchblock
818
818
  'Channel' => call_channel
819
819
  end
820
820
 
821
- context 'when the event is received the first time' do
822
- it 'sets an entry in translator.bridges' do
823
- subject.process_ami_event ami_event
824
- expect(translator.bridges[bridge_uniqueid]).to eq call_channel
825
- end
826
- end
827
-
828
821
  context 'when the event is received a second time for the same BridgeUniqueid' do
829
822
  let(:other_channel) { 'SIP/5678-00000000' }
830
823
  let :other_call do
@@ -904,13 +897,6 @@ module Punchblock
904
897
  'Channel' => call_channel
905
898
  end
906
899
 
907
- context 'when the event is received the first time' do
908
- it 'sets an entry in translator.bridges' do
909
- subject.process_ami_event ami_event
910
- expect(translator.bridges[bridge_uniqueid + '_leave']).to eq call_channel
911
- end
912
- end
913
-
914
900
  context 'when the event is received a second time for the same BridgeUniqueid' do
915
901
  let(:other_channel) { 'SIP/5678-00000000' }
916
902
  let :other_call 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: 2.7.3
4
+ version: 2.7.5
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: 2015-08-19 00:00:00.000000000 Z
13
+ date: 2015-08-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri