Class: Adhearsion::Rayo::Component::Record

Inherits:
ComponentNode show all
Defined in:
lib/adhearsion/rayo/component/record.rb

Defined Under Namespace

Classes: Complete, Pause, Recording, Resume

Constant Summary collapse

VALID_DIRECTIONS =
[:duplex, :send, :recv].freeze

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #connection, #original_component

Instance Method Summary collapse

Methods inherited from ComponentNode

#add_event, #complete_event, #complete_event=, #initialize, #register_event_handler, #register_internal_handlers, #response=, #stop!, #stop_action, #trigger_event_handler, #write_action

Methods inherited from Adhearsion::Rayo::CommandNode

#initialize, #response, #response=

Methods inherited from RayoNode

#==, class_from_registration, from_xml, #inherit, #inspect, #rayo_children, register, #source, #to_rayo, #to_xml

Constructor Details

This class inherits a constructor from Adhearsion::Rayo::Component::ComponentNode

Instance Method Details

#directionSymbol


33
# File 'lib/adhearsion/rayo/component/record.rb', line 33

attribute :direction, Symbol

#direction=(direction) ⇒ Object


34
35
36
37
38
39
# File 'lib/adhearsion/rayo/component/record.rb', line 34

def direction=(direction)
  if direction && !VALID_DIRECTIONS.include?(direction.to_sym)
    raise ArgumentError, "Invalid Direction (#{direction}), use: #{VALID_DIRECTIONS*' '}"
  end
  super
end

#final_timeoutInteger


18
# File 'lib/adhearsion/rayo/component/record.rb', line 18

attribute :final_timeout, Integer

#formatString


12
# File 'lib/adhearsion/rayo/component/record.rb', line 12

attribute :format

#initial_timeoutInteger


15
# File 'lib/adhearsion/rayo/component/record.rb', line 15

attribute :initial_timeout, Integer

#max_durationInteger


21
# File 'lib/adhearsion/rayo/component/record.rb', line 21

attribute :max_duration, Integer

#mixtrue, false


42
# File 'lib/adhearsion/rayo/component/record.rb', line 42

attribute :mix, Boolean

#pause!Object

Sends an Rayo pause message for the current Record

Raises:


84
85
86
87
88
89
90
# File 'lib/adhearsion/rayo/component/record.rb', line 84

def pause!
  raise InvalidActionError, "Cannot pause a Record that is not executing" unless executing?
  pause_action.tap do |action|
    result = write_action action
    paused! if result
  end
end

#pause_actionCommand::Record::Pause

Pauses a running Record

Examples:

record_obj.pause_action.to_xml

returns:
  <pause xmlns="urn:xmpp:rayo:record:1"/>

77
78
79
# File 'lib/adhearsion/rayo/component/record.rb', line 77

def pause_action
  Pause.new :component_id => component_id, :target_call_id => target_call_id
end

#rayo_attributesObject


44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/adhearsion/rayo/component/record.rb', line 44

def rayo_attributes
  {
    'format' => format,
    'initial-timeout' => initial_timeout,
    'final-timeout' => final_timeout,
    'max-duration' => max_duration,
    'start-beep' => start_beep,
    'stop-beep' => stop_beep,
    'start-paused' => start_paused,
    'direction' => direction,
    'mix' => mix
  }
end

#recordingAdhearsion::Rayo::Component::Record::Recording

Directly returns the recording for the component


121
122
123
# File 'lib/adhearsion/rayo/component/record.rb', line 121

def recording
  complete_event.recording
end

#recording_uriString

Directly returns the recording URI for the component


129
130
131
# File 'lib/adhearsion/rayo/component/record.rb', line 129

def recording_uri
  recording.uri
end

#resume!Object

Sends an Rayo resume message for the current Record

Raises:


109
110
111
112
113
114
115
# File 'lib/adhearsion/rayo/component/record.rb', line 109

def resume!
  raise InvalidActionError, "Cannot resume a Record that is not paused." unless paused?
  resume_action.tap do |action|
    result = write_action action
    resumed! if result
  end
end

#resume_actionCommand::Record::Resume

Create an Rayo resume message for the current Record

Examples:

record_obj.resume_action.to_xml

returns:
  <resume xmlns="urn:xmpp:rayo:record:1"/>

102
103
104
# File 'lib/adhearsion/rayo/component/record.rb', line 102

def resume_action
  Resume.new :component_id => component_id, :target_call_id => target_call_id
end

#start_beeptrue, false


24
# File 'lib/adhearsion/rayo/component/record.rb', line 24

attribute :start_beep, Boolean

#start_pausedtrue, false


30
# File 'lib/adhearsion/rayo/component/record.rb', line 30

attribute :start_paused, Boolean

#stop_beeptrue, false


27
# File 'lib/adhearsion/rayo/component/record.rb', line 27

attribute :stop_beep, Boolean