class Signalwire::Relay::Calling::BaseFax

Attributes

direction[R]
document[R]
identity[R]
pages[R]
remote_identity[R]

Public Instance Methods

broadcast_event(event) click to toggle source
# File lib/signalwire/relay/calling/component/base_fax.rb, line 35
def broadcast_event(event)
  @call.broadcast "fax_#{@state}".to_sym, event
  @call.broadcast :fax_state_change, event
end
event_type() click to toggle source
# File lib/signalwire/relay/calling/component/base_fax.rb, line 7
def event_type
  Relay::CallNotification::FAX
end
notification_handler(event) click to toggle source
# File lib/signalwire/relay/calling/component/base_fax.rb, line 11
def notification_handler(event)
  fax_state = event.call_params[:fax]
  fax_params = fax_state[:params]
  @state = fax_state[:type]

  @completed = @state != Relay::CallFaxState::PAGE

  if @completed
    if fax_params[:success]
      @successful = true
      @direction = fax_params[:direction]
      @identity = fax_params[:identity]
      @remote_identity = fax_params[:remote_identity]
      @document = fax_params[:document]
      @pages = fax_params[:pages]
    end

    @event = event
  end

  broadcast_event(event)
  check_for_waiting_events
end