Class: FSR::Cmd::Kill

Inherits:
Command show all
Defined in:
lib/fsr/cmd/kill.rb

Constant Summary

Constants inherited from Command

Command::DEFAULT_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fs_socket = nil, uuid_or_object) ⇒ Kill

Returns a new instance of Kill.



7
8
9
10
11
12
13
14
15
# File 'lib/fsr/cmd/kill.rb', line 7

def initialize(fs_socket = nil, uuid_or_object)
  @fs_socket = fs_socket # FSR::CommandSocket obj
  # Either something that responds to :uuid or a string that is the uuid
  if uuid_or_object.respond_to?(:uuid)
    @uuid = uuid_or_object.uuid
  else
    @uuid = uuid_or_object
  end
end

Instance Attribute Details

#uuidObject (readonly)

Returns the value of attribute uuid.



5
6
7
# File 'lib/fsr/cmd/kill.rb', line 5

def uuid
  @uuid
end

Instance Method Details

#rawObject

This method builds the API command to send to the freeswitch event socket



25
26
27
# File 'lib/fsr/cmd/kill.rb', line 25

def raw
  orig_command = "uuid_kill #{uuid}"
end

#run(api_method = :api) ⇒ Object

Send the command to the event socket, using bgapi by default.



18
19
20
21
22
# File 'lib/fsr/cmd/kill.rb', line 18

def run(api_method = :api)
  orig_command = "%s %s" % [api_method, raw]
  Log.debug "saying #{orig_command}"
  @fs_socket.say(orig_command)
end