Class: FSR::App::Read

Inherits:
Application show all
Defined in:
lib/fsr/app/read.rb

Constant Summary collapse

SENDMSG_METHOD =
%q|
  def read(*args, &block)
    me = super(*args)
    @read_var = "variable_#{me.chan_var}"
    sendmsg me
    @queue.unshift Proc.new { update_session } 
    @queue.unshift(block_given? ? block : lambda {})
  end
|

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Application

#app_name, #raw, #to_s

Constructor Details

#initialize(sound_file, min = 0, max = 10, chan_var = "fsr_read_dtmf", timeout = 10000, terminators = ["#"]) ⇒ Read

Returns a new instance of Read.



7
8
9
# File 'lib/fsr/app/read.rb', line 7

def initialize(sound_file, min = 0, max = 10, chan_var = "fsr_read_dtmf", timeout = 10000, terminators = ["#"])
  @sound_file, @min, @max, @chan_var, @timeout, @terminators = sound_file, min, max, chan_var, timeout, terminators
end

Instance Attribute Details

#chan_varObject (readonly)

Returns the value of attribute chan_var.



6
7
8
# File 'lib/fsr/app/read.rb', line 6

def chan_var
  @chan_var
end

Instance Method Details

#argumentsObject



11
12
13
# File 'lib/fsr/app/read.rb', line 11

def arguments
  [@min, @max, @sound_file, @chan_var, @timeout, @terminators.join(",")]
end

#sendmsgObject



15
16
17
# File 'lib/fsr/app/read.rb', line 15

def sendmsg
  "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments.join(" ")]
end