Class: Punchblock::Component::Record

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

Defined Under Namespace

Classes: Complete, Pause, Recording, Resume

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name

Class Method Summary (collapse)

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 Punchblock::CommandNode

#initialize, #response, #response=, #write_attr

Methods inherited from RayoNode

class_from_registration, #eql?, import, #inspect, register, #source

Constructor Details

This class inherits a constructor from Punchblock::Component::ComponentNode

Class Method Details

+ (Command::Record) new(options = {})

Creates an Rayo Record command

Examples:

record :text => 'Hello brown cow.'

returns:
  <record xmlns="urn:xmpp:rayo:record:1">Hello brown cow.</record>

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :text (String, Optional)

    to speak back

  • :voice (String, Optional)

    with which to render TTS

  • :ssml (String, Optional)

    document to render TTS

Returns:

  • (Command::Record)

    an Rayo “record” command



24
25
26
27
28
# File 'lib/punchblock/component/record.rb', line 24

def self.new(options = {})
  super().tap do |new_node|
    options.each_pair { |k,v| new_node.send :#{k}=", v }
  end
end

Instance Method Details

- (String) final_timeout

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



33
34
35
# File 'lib/punchblock/component/record.rb', line 33

def final_timeout
  read_attr :final-timeout', :to_i
end

- (Object) final_timeout=(timeout)

Parameters:

  • codec (String)

    to use for recording



40
41
42
# File 'lib/punchblock/component/record.rb', line 40

def final_timeout=(timeout)
  write_attr :final-timeout', timeout
end

- (String) format

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



47
48
49
# File 'lib/punchblock/component/record.rb', line 47

def format
  read_attr :format
end

- (Object) format=(format)

Parameters:

  • codec (String)

    to use for recording



54
55
56
# File 'lib/punchblock/component/record.rb', line 54

def format=(format)
  write_attr :format, format
end

- (String) initial_timeout

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



61
62
63
# File 'lib/punchblock/component/record.rb', line 61

def initial_timeout
  read_attr :initial-timeout', :to_i
end

- (Object) initial_timeout=(timeout)

Parameters:

  • codec (String)

    to use for recording



68
69
70
# File 'lib/punchblock/component/record.rb', line 68

def initial_timeout=(timeout)
  write_attr :initial-timeout', timeout
end

- (Object) inspect_attributes

:nodoc:



128
129
130
# File 'lib/punchblock/component/record.rb', line 128

def inspect_attributes # :nodoc:
  [:final_timeout, :format, :initial_timeout, :max_duration, :start_beep, :start_paused, :stop_beep] + super
end

- (String) max_duration

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



75
76
77
# File 'lib/punchblock/component/record.rb', line 75

def max_duration
  read_attr :max-duration', :to_i
end

- (Object) max_duration=(other)

Parameters:

  • codec (String)

    to use for recording



82
83
84
# File 'lib/punchblock/component/record.rb', line 82

def max_duration=(other)
  write_attr :max-duration', other
end

- (Object) pause!

Sends an Rayo pause message for the current Record

Raises:



158
159
160
161
162
163
164
# File 'lib/punchblock/component/record.rb', line 158

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

- (Command::Record::Pause) pause_action

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



151
152
153
# File 'lib/punchblock/component/record.rb', line 151

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

- (Object) resume!

Sends an Rayo resume message for the current Record

Raises:



183
184
185
186
187
188
189
# File 'lib/punchblock/component/record.rb', line 183

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

- (Command::Record::Resume) resume_action

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



176
177
178
# File 'lib/punchblock/component/record.rb', line 176

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

- (String) start_beep

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



89
90
91
# File 'lib/punchblock/component/record.rb', line 89

def start_beep
  read_attr(:start-beep') == 'true'
end

- (Object) start_beep=(sb)

Parameters:

  • codec (String)

    to use for recording



96
97
98
# File 'lib/punchblock/component/record.rb', line 96

def start_beep=(sb)
  write_attr :start-beep', sb
end

- (String) start_paused

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



117
118
119
# File 'lib/punchblock/component/record.rb', line 117

def start_paused
  read_attr(:start-paused') == 'true'
end

- (Object) start_paused=(other)

Parameters:

  • codec (String)

    to use for recording



124
125
126
# File 'lib/punchblock/component/record.rb', line 124

def start_paused=(other)
  write_attr :start-paused', other
end

- (String) stop_beep

The codec to use for recording

Returns:

  • (String)

    the codec to use for recording



103
104
105
# File 'lib/punchblock/component/record.rb', line 103

def stop_beep
  read_attr(:stop-beep') == 'true'
end

- (Object) stop_beep=(sb)

Parameters:

  • codec (String)

    to use for recording



110
111
112
# File 'lib/punchblock/component/record.rb', line 110

def stop_beep=(sb)
  write_attr :stop-beep', sb
end