Class: Punchblock::Component::Record
- Inherits:
-
ComponentNode
- Object
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Record
- Defined in:
- lib/punchblock/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
-
#direction ⇒ Symbol
The direction of media to be recorded.
- #direction=(direction) ⇒ Object
-
#final_timeout ⇒ Integer
Controls the length of a period of silence after callers have spoken to conclude they finished.
-
#format ⇒ String
The codec to use for recording.
-
#initial_timeout ⇒ Integer
Controls how long the recognizer should wait after the end of the prompt for the caller to speak before sending a Recorder event.
-
#max_duration ⇒ Integer
Indicates the maximum duration for the recording.
-
#mix ⇒ true, false
Wether to mix audio down or not.
-
#pause! ⇒ Object
Sends an Rayo pause message for the current Record.
-
#pause_action ⇒ Command::Record::Pause
Pauses a running Record.
- #rayo_attributes ⇒ Object
-
#recording ⇒ Punchblock::Component::Record::Recording
Directly returns the recording for the component.
-
#recording_uri ⇒ String
Directly returns the recording URI for the component.
-
#resume! ⇒ Object
Sends an Rayo resume message for the current Record.
-
#resume_action ⇒ Command::Record::Resume
Create an Rayo resume message for the current Record.
-
#start_beep ⇒ true, false
Indicates whether record will be preceded with a beep.
-
#start_paused ⇒ true, false
Whether subsequent record will start in PAUSE mode.
-
#stop_beep ⇒ true, false
Indicates whether record will be followed by a beep.
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=
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 Punchblock::Component::ComponentNode
Instance Method Details
#direction ⇒ Symbol
Returns the direction of media to be recorded.
32 |
# File 'lib/punchblock/component/record.rb', line 32 attribute :direction, Symbol |
#direction=(direction) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/punchblock/component/record.rb', line 33 def direction=(direction) if direction && !VALID_DIRECTIONS.include?(direction.to_sym) raise ArgumentError, "Invalid Direction (#{direction}), use: #{VALID_DIRECTIONS*' '}" end super end |
#final_timeout ⇒ Integer
Returns Controls the length of a period of silence after callers have spoken to conclude they finished.
17 |
# File 'lib/punchblock/component/record.rb', line 17 attribute :final_timeout, Integer |
#format ⇒ String
Returns the codec to use for recording.
11 |
# File 'lib/punchblock/component/record.rb', line 11 attribute :format |
#initial_timeout ⇒ Integer
Returns Controls how long the recognizer should wait after the end of the prompt for the caller to speak before sending a Recorder event.
14 |
# File 'lib/punchblock/component/record.rb', line 14 attribute :initial_timeout, Integer |
#max_duration ⇒ Integer
Returns Indicates the maximum duration for the recording.
20 |
# File 'lib/punchblock/component/record.rb', line 20 attribute :max_duration, Integer |
#mix ⇒ true, false
Returns wether to mix audio down or not.
41 |
# File 'lib/punchblock/component/record.rb', line 41 attribute :mix, Boolean |
#pause! ⇒ Object
Sends an Rayo pause message for the current Record
83 84 85 86 87 88 89 |
# File 'lib/punchblock/component/record.rb', line 83 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_action ⇒ Command::Record::Pause
Pauses a running Record
76 77 78 |
# File 'lib/punchblock/component/record.rb', line 76 def pause_action Pause.new :component_id => component_id, :target_call_id => target_call_id end |
#rayo_attributes ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/punchblock/component/record.rb', line 43 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 |
#recording ⇒ Punchblock::Component::Record::Recording
Directly returns the recording for the component
120 121 122 |
# File 'lib/punchblock/component/record.rb', line 120 def recording complete_event.recording end |
#recording_uri ⇒ String
Directly returns the recording URI for the component
128 129 130 |
# File 'lib/punchblock/component/record.rb', line 128 def recording_uri recording.uri end |
#resume! ⇒ Object
Sends an Rayo resume message for the current Record
108 109 110 111 112 113 114 |
# File 'lib/punchblock/component/record.rb', line 108 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_action ⇒ Command::Record::Resume
Create an Rayo resume message for the current Record
101 102 103 |
# File 'lib/punchblock/component/record.rb', line 101 def resume_action Resume.new :component_id => component_id, :target_call_id => target_call_id end |
#start_beep ⇒ true, false
Returns Indicates whether record will be preceded with a beep.
23 |
# File 'lib/punchblock/component/record.rb', line 23 attribute :start_beep, Boolean |
#start_paused ⇒ true, false
Returns Whether subsequent record will start in PAUSE mode.
29 |
# File 'lib/punchblock/component/record.rb', line 29 attribute :start_paused, Boolean |
#stop_beep ⇒ true, false
Returns Indicates whether record will be followed by a beep.
26 |
# File 'lib/punchblock/component/record.rb', line 26 attribute :stop_beep, Boolean |