Sha256: ebbe40eada026d0b041bcaba87b6e02eff7c61046d58f1a7167c608f711078a1

Contents?: true

Size: 1012 Bytes

Versions: 23

Compression:

Stored size: 1012 Bytes

Contents

require "fsr/app"
module FSR
  module Cmd
    class SchedTransfer < Command
      DEFAULTS = {when: 1, context: "default", dialplan: 'xml'}
      def initialize(fs_socket = nil, args = {})
        @fs_socket = fs_socket # FSR::CommandSocket obj
        args = DEFAULTS.merge(args)
        @when, @uuid, @to, @context, @dialplan = args.values_at(:when, :uuid, :to, :context, :dialplan)
        raise(ArgumentError, "No uuid given") unless @uuid
        raise(ArgumentError, "No to: extension given") unless @to
      end

      # Send the command to the event socket, using bgapi 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
        "sched_transfer +#{@when} #{@uuid} #{@to} #{@dialplan} #{@context}"
      end
    end

    register(:sched_transfer, SchedTransfer)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
freeswitcher-0.8.0 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.7.1 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.7.0 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.18 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.17 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.16 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.15 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.14 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.13 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.12 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.11 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.10 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.9 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.8 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.7 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.6 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.5 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.4 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.3 lib/fsr/cmd/sched_transfer.rb
freeswitcher-0.6.2 lib/fsr/cmd/sched_transfer.rb