Class: FSR::CommandSocket

Inherits:
EventSocket show all
Includes:
Cmd
Defined in:
lib/fsr/command_socket.rb

Constant Summary

Constants included from Cmd

FSR::Cmd::COMMANDS, FSR::Cmd::LOAD_PATH

Instance Attribute Summary

Attributes inherited from EventSocket

#socket

Instance Method Summary collapse

Methods included from Cmd

#commands, list, load_all, load_command, register

Methods inherited from EventSocket

#<<, #get_header_and_body, #response, #say

Constructor Details

#initialize(args = {}) ⇒ CommandSocket

Returns a new instance of CommandSocket.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fsr/command_socket.rb', line 7

def initialize(args = {})
  @server = args[:server] || "127.0.0.1"
  @port = args[:port] || "8021"
  @auth = args[:auth] || "ClueCon"
  @socket = TCPSocket.new(@server, @port)
  super(@socket)
  # Attempt to login or raise an exception
  unless 
    raise "Unable to login, check your password!"
  end
end

Instance Method Details

#loginObject

login - Method to authenticate to FreeSWITCH



20
21
22
23
24
25
26
27
# File 'lib/fsr/command_socket.rb', line 20

def 
  #Clear buf from initial socket creation/opening
  response 
  # Send auth string to FreeSWITCH
  self << "auth #{@auth}"
  #Return response, clear buf for rest of commands
  response 
end