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

Returns the direction of media to be recorded.

Returns:

  • (Symbol)

    the direction of media to be recorded.



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

Returns Controls the length of a period of silence after callers have spoken to conclude they finished.

Returns:

  • (Integer)

    Controls the length of a period of silence after callers have spoken to conclude they finished.



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

attribute :final_timeout, Integer

#formatString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



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

attribute :format

#initial_timeoutInteger

Returns Controls how long the recognizer should wait after the end of the prompt for the caller to speak before sending a Recorder event.

Returns:

  • (Integer)

    Controls how long the recognizer should wait after the end of the prompt for the caller to speak before sending a Recorder event.



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

attribute :initial_timeout, Integer

#max_durationInteger

Returns Indicates the maximum duration for the recording.

Returns:

  • (Integer)

    Indicates the maximum duration for the recording.



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

attribute :max_duration, Integer

#mixtrue, false

Returns wether to mix audio down or not.

Returns:

  • (true, false)

    wether to mix audio down or not



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"/>

Returns:

  • (Command::Record::Pause)

    an Rayo pause message for the current Record



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

Returns:



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

Returns:

  • (String)

    The recording URI



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"/>

Returns:

  • (Command::Record::Resume)

    an Rayo resume message



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

Returns Indicates whether record will be preceded with a beep.

Returns:

  • (true, false)

    Indicates whether record will be preceded with a beep.



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

attribute :start_beep, Boolean

#start_pausedtrue, false

Returns Whether subsequent record will start in PAUSE mode.

Returns:

  • (true, false)

    Whether subsequent record will start in PAUSE mode.



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

attribute :start_paused, Boolean

#stop_beeptrue, false

Returns Indicates whether record will be followed by a beep.

Returns:

  • (true, false)

    Indicates whether record will be followed by a beep.



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

attribute :stop_beep, Boolean