Sha256: 37c65470b87467cb9328485e7d900e39864beede3791c984444379d37f74df5f
Contents?: true
Size: 1.21 KB
Versions: 64
Compression:
Stored size: 1.21 KB
Contents
require "fsr/app" module FSR module Cmd class Sofia class Status < Command attr_reader :fs_socket def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket object @status = args[:status] # Status type; profile or gateway @name = args[:name] # Name of profile or gateway # If status is given, make sure it's profile or gateway unless @status.nil? raise "status must be profile or gateway" unless @status =~ /profile|gateway/i end if @status raise "must provide a profile or gateway name" unless @name end end # Send the command to the event socket, using api by default. def run(api_method = :api) orig_command = "%s %s" % [api_method, raw] Log.debug "saying #{orig_command}" @fs_socket.say(orig_command) end # This method builds the API command to send to the freeswitch event socket def raw if @status and @name orig_command = "sofia status #{@status} #{@name}" else orig_command = "sofia status" end end end end end end
Version data entries
64 entries across 64 versions & 3 rubygems