class Punchblock::Translator::Freeswitch::Component::AbstractOutput

Constants

UnrenderableDocError

Public Instance Methods

execute() click to toggle source
# File lib/punchblock/translator/freeswitch/component/abstract_output.rb, line 10
def execute
  validate
  send_ref
  do_output
rescue UnrenderableDocError => e
  with_error 'unrenderable document error', e.message
rescue OptionError => e
  with_error 'option error', e.message
end
execute_command(command) click to toggle source
# File lib/punchblock/translator/freeswitch/component/abstract_output.rb, line 20
def execute_command(command)
  case command
  when Punchblock::Component::Stop
    command.response = true
    application 'break'
    send_complete_event Punchblock::Event::Complete::Stop.new
  else
    super
  end
end

Private Instance Methods

concatenated_render_doc() click to toggle source
# File lib/punchblock/translator/freeswitch/component/abstract_output.rb, line 50
def concatenated_render_doc
  @component_node.render_documents.inject RubySpeech::SSML.draw do |doc, argument|
    doc + argument.value
  end
end
do_output() click to toggle source
# File lib/punchblock/translator/freeswitch/component/abstract_output.rb, line 33
def do_output
  raise 'Not Implemented'
end
finish_reason() click to toggle source
# File lib/punchblock/translator/freeswitch/component/abstract_output.rb, line 56
def finish_reason
  Punchblock::Component::Output::Complete::Finish.new
end
validate() click to toggle source
# File lib/punchblock/translator/freeswitch/component/abstract_output.rb, line 37
def validate
  raise OptionError, 'An SSML document is required.' unless @component_node.render_documents.first.value

  [:start_offset, :start_paused, :repeat_interval, :repeat_times, :max_time].each do |opt|
    raise OptionError, "A #{opt} value is unsupported." if @component_node.send opt
  end

  case @component_node.interrupt_on
  when :voice, :dtmf, :any
    raise OptionError, "An interrupt-on value of #{@component_node.interrupt_on} is unsupported."
  end
end