Class: Signalwire::Relay::Calling::ControlComponent
- Inherits:
-
Component
- Object
- Component
- Signalwire::Relay::Calling::ControlComponent
show all
- Defined in:
- lib/signalwire/relay/calling/control_component.rb
Instance Attribute Summary
Attributes inherited from Component
#blocker, #call, #completed, #event, #execute_result, #state, #successful
Instance Method Summary
collapse
Methods inherited from Component
#after_execute, #check_for_waiting_events, #create_blocker, #event_type, #execute, #execute_params, #handle_execute_result, #has_blocker?, #initialize, #method, #notification_handler, #payload, #setup_waiting_events, #terminate, #unblock, #wait_for, #wait_on_blocker
Methods included from Logger
#level=, #logger, logger
Instance Method Details
#control_id ⇒ Object
7
8
9
|
# File 'lib/signalwire/relay/calling/control_component.rb', line 7
def control_id
@control_id ||= SecureRandom.uuid
end
|
#execute_subcommand(suffix, result_klass, extra_params = {}) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/signalwire/relay/calling/control_component.rb', line 30
def execute_subcommand(suffix, result_klass, = {})
@call.relay_execute execute_params('.stop', ) do |event, outcome|
succeeded = outcome == :success
terminate(event) unless succeeded
return result_klass.new(succeeded)
end
end
|
#inner_params ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/signalwire/relay/calling/control_component.rb', line 11
def inner_params
{
nodeid: @call.node_id,
callid: @call.id,
control_id: control_id,
params: payload
}
end
|
#setup_handlers ⇒ Object
20
21
22
23
24
|
# File 'lib/signalwire/relay/calling/control_component.rb', line 20
def setup_handlers
@call.on :event, event_type: event_type, control_id: control_id do |evt|
notification_handler(evt)
end
end
|