signalwire 2.3.3 → 2.3.4
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 +7 -1
- data/lib/signalwire.rb +1 -0
- data/lib/signalwire/blade/connection.rb +22 -13
- data/lib/signalwire/blade/message/connect.rb +2 -1
- data/lib/signalwire/relay/calling/action/connect_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/detect_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/fax_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/play_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/prompt_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/record_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/send_digits_action.rb +1 -1
- data/lib/signalwire/relay/calling/action/tap_action.rb +1 -1
- data/lib/signalwire/relay/calling/call.rb +4 -2
- data/lib/signalwire/relay/calling/component/record.rb +1 -1
- data/lib/signalwire/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31f18c614ab0890b0c3000c45f607b636c8c3a3b7ad51d1e9dffae4c3b30165
|
4
|
+
data.tar.gz: 6ef1eeb8106c935d12beb8edafb67004d14c012761c43c675a9ce4d430c794d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4535d5d33d7d8152ffd349d0fbeb4cb544fc71931fb72f93c2c866eda4957249ace7b5337472193ebd58f0f6a987f546a226edc97618fb8bef03652162b534db
|
7
|
+
data.tar.gz: 6887060feada342534a3b4a365eb058e93276aa50ecd8e88456d1b4495e6aee7aa47be22e26adc22dfb292e24a0291ffe3376e06b6359d27fa6d0aaffeaba457
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,13 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
-
## [Unreleased]
|
6
|
+
## [Unreleased]
|
7
|
+
|
8
|
+
## [2.3.4] - 2020-09-09
|
9
|
+
### Fixed
|
10
|
+
- Correctly ignore non-call events and clear handlers on call end
|
11
|
+
- Async method arguments fixed
|
12
|
+
- Fix ping race condition
|
7
13
|
|
8
14
|
## [2.3.3] - 2020-03-09
|
9
15
|
### Fixed
|
data/lib/signalwire.rb
CHANGED
@@ -4,6 +4,7 @@ require 'has_guarded_handlers'
|
|
4
4
|
require 'eventmachine'
|
5
5
|
require 'faye/websocket'
|
6
6
|
require 'json'
|
7
|
+
require 'concurrent-ruby'
|
7
8
|
|
8
9
|
module Signalwire::Blade
|
9
10
|
class Connection
|
@@ -22,10 +23,14 @@ module Signalwire::Blade
|
|
22
23
|
@log_traffic = options.fetch(:log_traffic, true)
|
23
24
|
@authentication = options.fetch(:authentication, nil)
|
24
25
|
|
26
|
+
|
27
|
+
|
25
28
|
@inbound_queue = EM::Queue.new
|
26
29
|
@outbound_queue = EM::Queue.new
|
27
30
|
|
31
|
+
@pong = Concurrent::AtomicBoolean.new
|
28
32
|
@keep_alive_timer = nil
|
33
|
+
@ping_is_sent = Concurrent::AtomicBoolean.new
|
29
34
|
|
30
35
|
@shutdown_list = []
|
31
36
|
end
|
@@ -48,6 +53,7 @@ module Signalwire::Blade
|
|
48
53
|
|
49
54
|
def main_loop!
|
50
55
|
EM.run do
|
56
|
+
logger.info "CREATING SOCKET"
|
51
57
|
@ws = Faye::WebSocket::Client.new(@url)
|
52
58
|
|
53
59
|
@ws.on(:open) { |event| broadcast :started, event }
|
@@ -71,7 +77,7 @@ module Signalwire::Blade
|
|
71
77
|
begin
|
72
78
|
@connected = true
|
73
79
|
myreq = connect_request
|
74
|
-
@pong
|
80
|
+
@pong.make_false
|
75
81
|
|
76
82
|
write_command(myreq) do |event|
|
77
83
|
@session_id = event.dig(:result, :sessionid) unless @session_id
|
@@ -131,7 +137,9 @@ module Signalwire::Blade
|
|
131
137
|
end
|
132
138
|
|
133
139
|
def ping(&block)
|
134
|
-
|
140
|
+
ping_cmd = Ping.new
|
141
|
+
block_given? ? write_command(ping_cmd, &block) : write_command(ping_cmd)
|
142
|
+
ping_cmd
|
135
143
|
end
|
136
144
|
|
137
145
|
def subscribe(params, &block)
|
@@ -150,7 +158,6 @@ module Signalwire::Blade
|
|
150
158
|
end
|
151
159
|
|
152
160
|
def disconnect!
|
153
|
-
# logger.info 'Stopping Blade event loop'
|
154
161
|
clear_connections
|
155
162
|
EM.stop
|
156
163
|
end
|
@@ -183,19 +190,21 @@ module Signalwire::Blade
|
|
183
190
|
end
|
184
191
|
|
185
192
|
def keep_alive
|
186
|
-
@
|
187
|
-
|
188
|
-
|
189
|
-
|
193
|
+
if @ping_is_sent.false?
|
194
|
+
ping do
|
195
|
+
@pong.make_true
|
196
|
+
end
|
197
|
+
@ping_is_sent.make_true
|
198
|
+
else
|
199
|
+
if @pong.false?
|
200
|
+
logger.error "KEEPALIVE: Ping failed"
|
201
|
+
reconnect! if connected?
|
202
|
+
end
|
203
|
+
@ping_is_sent.make_false
|
190
204
|
end
|
191
205
|
|
192
206
|
@keep_alive_timer = EventMachine::Timer.new(Signalwire::Relay::PING_TIMEOUT) do
|
193
|
-
|
194
|
-
logger.error "Ping failed"
|
195
|
-
reconnect! if connected?
|
196
|
-
else
|
197
|
-
keep_alive
|
198
|
-
end
|
207
|
+
keep_alive
|
199
208
|
end
|
200
209
|
end
|
201
210
|
|
@@ -45,7 +45,7 @@ module Signalwire::Relay::Calling
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def setup_call_event_handlers
|
48
|
-
@client.on(:event, proc { |evt| call_match_event(evt) }) do |event|
|
48
|
+
@call_event_handler = @client.on(:event, proc { |evt| call_match_event(evt) }) do |event|
|
49
49
|
case event.event_type
|
50
50
|
when 'calling.call.connect'
|
51
51
|
change_connect_state(event.call_params[:connect_state])
|
@@ -81,7 +81,8 @@ module Signalwire::Relay::Calling
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def call_match_event(event)
|
84
|
-
event.event_type
|
84
|
+
event.event_type &&
|
85
|
+
event.event_type.match(/calling\.call/) &&
|
85
86
|
!event.event_type.match(/receive/) &&
|
86
87
|
(event.call_id == id || event.call_params[:tag] == tag)
|
87
88
|
end
|
@@ -316,6 +317,7 @@ module Signalwire::Relay::Calling
|
|
316
317
|
end
|
317
318
|
|
318
319
|
def finish_call(params)
|
320
|
+
@client.unregister_handler(:event, @call_event_handler)
|
319
321
|
terminate_components(params)
|
320
322
|
client.calling.end_call(id)
|
321
323
|
@busy = true if params[:reason] == Relay::DisconnectReason::BUSY
|
data/lib/signalwire/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signalwire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SignalWire Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -370,7 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
370
370
|
- !ruby/object:Gem::Version
|
371
371
|
version: '0'
|
372
372
|
requirements: []
|
373
|
-
rubygems_version: 3.
|
373
|
+
rubygems_version: 3.1.2
|
374
374
|
signing_key:
|
375
375
|
specification_version: 4
|
376
376
|
summary: Ruby client for Signalwire
|