Class: Signalwire::Relay::Calling::Connect
- Inherits:
-
Component
- Object
- Component
- Signalwire::Relay::Calling::Connect
show all
- Defined in:
- lib/signalwire/relay/calling/component/connect.rb
Instance Attribute Summary
Attributes inherited from Component
#blocker, #call, #completed, #event, #execute_result, #state, #successful
Instance Method Summary
collapse
Methods inherited from Component
#check_for_waiting_events, #create_blocker, #execute, #execute_params, #handle_execute_result, #payload, #setup_handlers, #setup_waiting_events, #terminate, #unblock, #wait_for, #wait_on_blocker
Constructor Details
#initialize(call:, devices:) ⇒ Connect
Returns a new instance of Connect.
5
6
7
8
|
# File 'lib/signalwire/relay/calling/component/connect.rb', line 5
def initialize(call:, devices:)
super(call: call)
@devices = devices
end
|
Instance Method Details
#broadcast_event(event) ⇒ Object
40
41
42
43
|
# File 'lib/signalwire/relay/calling/component/connect.rb', line 40
def broadcast_event(event)
@call.broadcast "connect_#{@state}".to_sym, event
@call.broadcast :connect_state_change, event
end
|
#event_type ⇒ Object
14
15
16
|
# File 'lib/signalwire/relay/calling/component/connect.rb', line 14
def event_type
Relay::CallNotification::CONNECT
end
|
#inner_params ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/signalwire/relay/calling/component/connect.rb', line 18
def inner_params
{
node_id: @call.node_id,
call_id: @call.id,
devices: @devices
}
end
|
#method ⇒ Object
10
11
12
|
# File 'lib/signalwire/relay/calling/component/connect.rb', line 10
def method
Relay::ComponentMethod::CONNECT
end
|
#notification_handler(event) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/signalwire/relay/calling/component/connect.rb', line 26
def notification_handler(event)
@state = event.call_params[:connect_state]
@completed = @state != Relay::CallConnectState::CONNECTING
if @completed
@successful = @state == Relay::CallConnectState::CONNECTED
@event = event
end
broadcast_event(event)
check_for_waiting_events
end
|