Class: Signalwire::Relay::Calling::Answer

Inherits:
Component
  • Object
show all
Defined in:
lib/signalwire/relay/calling/component/answer.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, #execute, #execute_params, #handle_execute_result, #has_blocker?, #initialize, #inner_params, #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



9
10
11
# File 'lib/signalwire/relay/calling/component/answer.rb', line 9

def event_type
  Relay::CallNotification::STATE
end

#methodObject



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

def method
  Relay::ComponentMethod::ANSWER
end

#notification_handler(event) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/signalwire/relay/calling/component/answer.rb', line 13

def notification_handler(event)
  @state = event.call_params[:call_state]

  ended_events = [Relay::CallState::ANSWERED]

  if ended_events.include?(@state)
    @completed = true
    @successful = true
    @event = event
  end

  check_for_waiting_events
end