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

Version Path
bougyman-freeswitcher-0.0.9 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.1.0 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.1.1 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.1.2 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.1.3 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.1.4 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.3.0 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.3.1 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.4.0 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.4.1 lib/fsr/cmd/sofia/status.rb
bougyman-freeswitcher-0.4.2 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.7.1 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.7.0 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.18 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.17 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.16 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.15 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.14 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.13 lib/fsr/cmd/sofia/status.rb
freeswitcher-0.6.12 lib/fsr/cmd/sofia/status.rb