Class: FSR::CommandSocket
- Inherits:
-
EventSocket
- Object
- EventSocket
- FSR::CommandSocket
- 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
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ CommandSocket
constructor
A new instance of CommandSocket.
-
#login ⇒ Object
login - Method to authenticate to FreeSWITCH.
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 login raise "Unable to login, check your password!" end end |
Instance Method Details
#login ⇒ Object
login - Method to authenticate to FreeSWITCH
20 21 22 23 24 25 26 27 |
# File 'lib/fsr/command_socket.rb', line 20 def login #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 |