Module: Adhearsion::CallController::Record

Included in:
Adhearsion::CallController
Defined in:
lib/adhearsion/call_controller/record.rb

Constant Summary

RecordError =

Represents failure to record such as when a file cannot be written.

Class.new StandardError

Instance Method Summary (collapse)

Instance Method Details

- (Object) record(options = {})

Start a recording

Parameters:

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

    to process result of the record method

Options Hash (options):

  • :async (Boolean, Optional)

    Execute asynchronously. Defaults to false

  • :start_beep (Boolean, Optional)

    Indicates whether subsequent record will be preceded with a beep. Default is true.

  • :start_paused (Boolean, Optional)

    Whether subsequent record will start in PAUSE mode. Default is false.

  • :max_duration (String, Optional)

    Indicates the maximum duration (milliseconds) for a recording.

  • :format (String, Optional)

    File format used during recording.

  • :format (String, Optional)

    File format used during recording.

  • :initial_timeout (String, Optional)

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

  • :final_timeout (String, Optional)

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

Returns:

  • Punchblock::Component::Record::Recording



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/adhearsion/call_controller/record.rb', line 24

def record(options = {})
  async = options.delete :async

  component = ::Punchblock::Component::Record.new options
  component.register_event_handler ::Punchblock::Event::Complete do |event|
    catching_standard_errors { yield event if block_given? }
  end

  if async
    write_and_await_response component
  else
    execute_component_and_await_completion component
  end
end