class Signalwire::Relay::Calling::Hangup

Public Class Methods

new(call:, reason:) click to toggle source
# File lib/signalwire/relay/calling/component/hangup.rb, line 5
def initialize(call:, reason:)
  super(call: call)
  @reason = reason
end

Public Instance Methods

event_type() click to toggle source
# File lib/signalwire/relay/calling/component/hangup.rb, line 14
def event_type
  Relay::CallNotification::STATE
end
inner_params() click to toggle source
# File lib/signalwire/relay/calling/component/hangup.rb, line 18
def inner_params
  {
    node_id: @call.node_id,
    call_id: @call.id,
    reason: @reason
  }
end
method() click to toggle source
# File lib/signalwire/relay/calling/component/hangup.rb, line 10
def method
  Relay::ComponentMethod::HANGUP
end
notification_handler(event) click to toggle source
# File lib/signalwire/relay/calling/component/hangup.rb, line 26
def notification_handler(event)
  @state = event.call_params[:call_state]
  end_reason = event.call_params[:call_state]

  @completed = @state == Relay::CallState::ENDED

  if @completed
    @successful = true
    @reason = end_reason
    @event = event
  end

  check_for_waiting_events
end