Class: SignalWire::Relay::CallReceiveEvent

Inherits:
RelayEvent
  • Object
show all
Defined in:
lib/signalwire/relay/relay_event.rb

Overview

calling.call.receive

Instance Attribute Summary collapse

Attributes inherited from RelayEvent

#call_id, #event_type, #params, #timestamp

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(call_state: '', direction: '', device: {}, node_id: '', project_id: '', context: '', segment_id: '', tag: '', **base) ⇒ CallReceiveEvent

Returns a new instance of CallReceiveEvent.



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/signalwire/relay/relay_event.rb', line 77

def initialize(call_state: '', direction: '', device: {}, node_id: '',
               project_id: '', context: '', segment_id: '', tag: '', **base)
  super(**base)
  @call_state = call_state
  @direction  = direction
  @device     = device
  @node_id    = node_id
  @project_id = project_id
  @context    = context
  @segment_id = segment_id
  @tag        = tag
end

Instance Attribute Details

#call_stateObject (readonly)

Returns the value of attribute call_state.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def call_state
  @call_state
end

#contextObject (readonly)

Returns the value of attribute context.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def context
  @context
end

#deviceObject (readonly)

Returns the value of attribute device.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def device
  @device
end

#directionObject (readonly)

Returns the value of attribute direction.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def direction
  @direction
end

#node_idObject (readonly)

Returns the value of attribute node_id.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def node_id
  @node_id
end

#project_idObject (readonly)

Returns the value of attribute project_id.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def project_id
  @project_id
end

#segment_idObject (readonly)

Returns the value of attribute segment_id.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def segment_id
  @segment_id
end

#tagObject (readonly)

Returns the value of attribute tag.



57
58
59
# File 'lib/signalwire/relay/relay_event.rb', line 57

def tag
  @tag
end

Class Method Details

.from_payload(payload) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/signalwire/relay/relay_event.rb', line 60

def self.from_payload(payload)
  base = RelayEvent.from_payload(payload)
  p = base.params
  new(
    event_type: base.event_type, params: base.params,
    call_id: base.call_id, timestamp: base.timestamp,
    call_state: p['call_state'] || '',
    direction:  p['direction'] || '',
    device:     p['device'] || {},
    node_id:    p['node_id'] || '',
    project_id: p['project_id'] || '',
    context:    p['context'] || p['protocol'] || '',
    segment_id: p['segment_id'] || '',
    tag:        p['tag'] || ''
  )
end