Class: PunchblockConsole::Commands

Inherits:
Object
  • Object
show all
Defined in:
lib/punchblock/console/commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, call_id, queue) ⇒ Commands

:nodoc:



3
4
5
# File 'lib/punchblock/console/commands.rb', line 3

def initialize(client, call_id, queue) # :nodoc:
  @client, @call_id, @queue = client, call_id, queue
end

Instance Method Details

#acceptObject

:nodoc:



7
8
9
# File 'lib/punchblock/console/commands.rb', line 7

def accept # :nodoc:
  write Command::Accept.new
end

#agi(command, params = {}) ⇒ Object



41
42
43
44
45
# File 'lib/punchblock/console/commands.rb', line 41

def agi(command, params = {})
  component = Component::Asterisk::AGI::Command.new :name => command, :params => params
  write component
  component.complete_event
end

#answerObject

:nodoc:



11
12
13
# File 'lib/punchblock/console/commands.rb', line 11

def answer # :nodoc:
  write Command::Answer.new
end

#hangupObject

:nodoc:



15
16
17
# File 'lib/punchblock/console/commands.rb', line 15

def hangup # :nodoc:
  write Command::Hangup.new
end

#output(string, type = :text) ⇒ Object

:nodoc:



35
36
37
38
39
# File 'lib/punchblock/console/commands.rb', line 35

def output(string, type = :text) # :nodoc:
  component = Component::Output.new(type => string)
  write component
  component.complete_event
end

#record(options = {}) ⇒ Object



27
28
29
# File 'lib/punchblock/console/commands.rb', line 27

def record(options = {})
  write Component::Record.new(options)
end

#redirect(dest) ⇒ Object

:nodoc:



23
24
25
# File 'lib/punchblock/console/commands.rb', line 23

def redirect(dest) # :nodoc:
  write Command::Redirect.new(:to => dest)
end

#reject(reason = nil) ⇒ Object

:nodoc:



19
20
21
# File 'lib/punchblock/console/commands.rb', line 19

def reject(reason = nil) # :nodoc:
  write Command::Reject.new(:reason => reason)
end

#say(string) ⇒ Object



31
32
33
# File 'lib/punchblock/console/commands.rb', line 31

def say(string)
  output string, :text
end

#write(command) ⇒ Object

:nodoc:



47
48
49
# File 'lib/punchblock/console/commands.rb', line 47

def write(command) # :nodoc:
  @client.execute_command command, :call_id => @call_id, :async => false
end