freeswitcher 0.6.18 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/fsr/cmd/kill.rb +32 -0
- data/lib/fsr/version.rb +1 -1
- data/spec/fsr/cmd/kill.rb +28 -0
- data/spec/fsr/loading.rb +1 -1
- metadata +5 -2
data/lib/fsr/cmd/kill.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "fsr/app"
|
2
|
+
module FSR
|
3
|
+
module Cmd
|
4
|
+
class Kill < Command
|
5
|
+
attr_reader :uuid
|
6
|
+
|
7
|
+
def initialize(fs_socket = nil, uuid_or_object)
|
8
|
+
@fs_socket = fs_socket # FSR::CommandSocket obj
|
9
|
+
# Either something that responds to :uuid or a string that is the uuid
|
10
|
+
if uuid_or_object.respond_to?(:uuid)
|
11
|
+
@uuid = uuid_or_object.uuid
|
12
|
+
else
|
13
|
+
@uuid = uuid_or_object
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Send the command to the event socket, using bgapi by default.
|
18
|
+
def run(api_method = :api)
|
19
|
+
orig_command = "%s %s" % [api_method, raw]
|
20
|
+
Log.debug "saying #{orig_command}"
|
21
|
+
@fs_socket.say(orig_command)
|
22
|
+
end
|
23
|
+
|
24
|
+
# This method builds the API command to send to the freeswitch event socket
|
25
|
+
def raw
|
26
|
+
orig_command = "uuid_kill #{uuid}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
register(:kill, Kill)
|
31
|
+
end
|
32
|
+
end
|
data/lib/fsr/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
require "fsr/cmd"
|
3
|
+
|
4
|
+
FSR::Cmd.load_command("kill")
|
5
|
+
|
6
|
+
describe "Testing FSR::Cmd::Kill" do
|
7
|
+
## Kill ##
|
8
|
+
# Kill a channel or call
|
9
|
+
it "FSR::Cmd::Kill a channel as a string" do
|
10
|
+
cmd = FSR::Cmd::Kill.new(nil, "abcd-1234-efgh-5678")
|
11
|
+
cmd.raw.should == "uuid_kill abcd-1234-efgh-5678"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "FSR::Cmd::Kill a call as a Call object" do
|
15
|
+
require "fsr/model/call"
|
16
|
+
call = FSR::Model::Call.new(["uuid"], 'abcd-1234-efgh-5678')
|
17
|
+
cmd = FSR::Cmd::Kill.new(nil, call)
|
18
|
+
cmd.raw.should == "uuid_kill abcd-1234-efgh-5678"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "FSR::Cmd::Kill a call as a Channel object" do
|
22
|
+
require "fsr/model/channel"
|
23
|
+
channel = FSR::Model::Channel.new(["uuid"], 'abcd-1234-efgh-5678')
|
24
|
+
cmd = FSR::Cmd::Kill.new(nil, channel)
|
25
|
+
cmd.raw.should == "uuid_kill abcd-1234-efgh-5678"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/spec/fsr/loading.rb
CHANGED
@@ -16,7 +16,7 @@ describe "Testing FSR module loading methods" do
|
|
16
16
|
|
17
17
|
# When you add commands you must modify the expected cmds_loaded behavior
|
18
18
|
it "Loads all commands" do
|
19
|
-
all_commands = [:uuid_dump, :originate, :sofia, :fsctl, :sofia_contact, :status, :calls, :call_center, :channels, :enum, :sched_hangup, :sched_transfer, :uuid_transfer, :uuid_send_dtmf, :conference, :valet_info] # If you add a command add it to this set
|
19
|
+
all_commands = [:kill, :uuid_dump, :originate, :sofia, :fsctl, :sofia_contact, :status, :calls, :call_center, :channels, :enum, :sched_hangup, :sched_transfer, :uuid_transfer, :uuid_send_dtmf, :conference, :valet_info] # If you add a command add it to this set
|
20
20
|
cmds_loaded = FSR.load_all_commands
|
21
21
|
cmds_loaded.kind_of?(Array).should == true
|
22
22
|
all_commands.each do |cmd|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: freeswitcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.7.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jayson Vaughn
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2012-01-
|
16
|
+
date: 2012-01-12 00:00:00 -06:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/fsr/cmd/conference.rb
|
89
89
|
- lib/fsr/cmd/enum.rb
|
90
90
|
- lib/fsr/cmd/fsctl.rb
|
91
|
+
- lib/fsr/cmd/kill.rb
|
91
92
|
- lib/fsr/cmd/originate.rb
|
92
93
|
- lib/fsr/cmd/sched_hangup.rb
|
93
94
|
- lib/fsr/cmd/sched_transfer.rb
|
@@ -168,6 +169,7 @@ files:
|
|
168
169
|
- spec/fsr/cmd/channels.rb
|
169
170
|
- spec/fsr/cmd/conference.rb
|
170
171
|
- spec/fsr/cmd/enum.rb
|
172
|
+
- spec/fsr/cmd/kill.rb
|
171
173
|
- spec/fsr/cmd/originate.rb
|
172
174
|
- spec/fsr/cmd/sched_hangup.rb
|
173
175
|
- spec/fsr/cmd/sched_transfer.rb
|
@@ -421,6 +423,7 @@ test_files:
|
|
421
423
|
- spec/fsr/cmd/channels.rb
|
422
424
|
- spec/fsr/cmd/conference.rb
|
423
425
|
- spec/fsr/cmd/enum.rb
|
426
|
+
- spec/fsr/cmd/kill.rb
|
424
427
|
- spec/fsr/cmd/originate.rb
|
425
428
|
- spec/fsr/cmd/sched_hangup.rb
|
426
429
|
- spec/fsr/cmd/sched_transfer.rb
|