Class: Signalwire::Relay::Calling::Await

Inherits:
Component
  • Object
show all
Defined in:
lib/signalwire/relay/calling/component/await.rb

Overview

A special component that only waits for call events

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, #execute_params, #handle_execute_result, #has_blocker?, #initialize, #inner_params, #method, #payload, #setup_handlers, #setup_waiting_events, #terminate, #unblock, #wait_for, #wait_on_blocker

Methods included from Logger

#level=, #logger, logger

Constructor Details

This class inherits a constructor from Signalwire::Relay::Calling::Component

Instance Method Details

#event_typeObject



5
6
7
# File 'lib/signalwire/relay/calling/component/await.rb', line 5

def event_type
  Relay::CallNotification::STATE
end

#executeObject



16
17
18
# File 'lib/signalwire/relay/calling/component/await.rb', line 16

def execute
  setup_handlers
end

#notification_handler(event) ⇒ Object



9
10
11
12
13
14
# File 'lib/signalwire/relay/calling/component/await.rb', line 9

def notification_handler(event)
  @state = event.call_params[:call_state]
  @event = event
  @successful = true if @events_waiting.include?(@state)
  check_for_waiting_events
end