freeswitcher 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,18 +9,18 @@ module FSR
9
9
  @action, @target, @target_options = args.values_at(:action, :target, :target_options)
10
10
  @digits = args[:digits]
11
11
  @fs_socket = fs_socket
12
- raise(ArgumentError, "Cannot use conference without :conference_name") unless @conference_name
12
+ raise(ArgumentError, "Cannot use conference without :conference_name") unless conference_name
13
13
  case @action
14
14
  when :dial
15
- raise(ArgumentError, "Cannot dial without :target") unless @target
15
+ raise(ArgumentError, "Cannot dial without :target") unless target
16
16
  if @target_options
17
- raise(ArgumentError, ":target_options must be a hash if :target_options is set") unless @orginate_options.kind_of?(Hash)
17
+ raise(ArgumentError, ":target_options must be a hash") unless target_options.kind_of?(Hash)
18
18
  end
19
19
  when :dtmf
20
- raise(ArgumentError, "Cannot send dtmf without :target") unless @target
21
- raise(ArgumentError, "Cannot send dtmf without :digits") unless @digits
20
+ raise(ArgumentError, "Cannot send dtmf without :target") unless target
21
+ raise(ArgumentError, "Cannot send dtmf without :digits") unless digits
22
22
  when :kick
23
- raise(ArgumentError, "Cannot kick without :target") unless @target
23
+ raise(ArgumentError, "Cannot kick without :target") unless target
24
24
  else
25
25
  # go with flow, mate
26
26
  end
@@ -34,12 +34,10 @@ module FSR
34
34
  end
35
35
 
36
36
  def arguments
37
- target_options = target_options.keys.sort { |a,b| a.to_s <=> b.to_s }.map { |k| "%s=%s" % [k, orginate_options[k]] }.join(",") if target_options
37
+ target_options = @target_options.keys.sort { |a,b| a.to_s <=> b.to_s }.map { |k| "%s=%s" % [k, @target_options[k]] }.join(",") if @target_options
38
38
  conference_name << "@#{profile}" if profile
39
- if pin
40
- conference_name << "+#{pin}"
41
- conference_name << "+#{flags}" if flags
42
- end
39
+ conference_name << "+#{pin}" if pin
40
+ conference_name << "+#{flags}" if flags
43
41
  args = [conference_name]
44
42
  args << action if action
45
43
 
@@ -28,11 +28,21 @@ describe "Testing FSR::Cmd::Conference" do
28
28
  message.should.match(/Cannot kick without :target/)
29
29
  end
30
30
 
31
- it "Puts callee into conference" do
31
+ it "Should require target_options to be a hash" do
32
+ lambda { FSR::Cmd::Conference.new(nil, :conference_name => 1001, :action => :dial, :target => "user/1000", :target_options => 1) }.should.raise(ArgumentError).
33
+ message.should.match(/:target_options must be a hash/)
34
+ end
35
+
36
+ it "Dials and puts callee into conference" do
32
37
  conference = FSR::Cmd::Conference.new(nil, :conference_name => 1001, :action => :dial, :target => "user/1000")
33
38
  conference.raw.should == "conference 1001 dial user/1000"
34
39
  end
35
40
 
41
+ it "Dials with :target_option" do
42
+ conference = FSR::Cmd::Conference.new(nil, :conference_name => 1001, :action => :dial, :target => "user/1000", :target_options => {:ignore_early_media => true})
43
+ conference.raw.should == "conference 1001 dial {ignore_early_media=true}user/1000"
44
+ end
45
+
36
46
  it "Kicks member out of conference" do
37
47
  conference = FSR::Cmd::Conference.new(nil, :conference_name => "1001", :action => :kick, :target => 1)
38
48
  conference.raw.should == "conference 1001 kick 1"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 8
9
- version: 0.6.8
8
+ - 9
9
+ version: 0.6.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jayson Vaughn
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-03-09 00:00:00 -06:00
20
+ date: 2011-03-15 00:00:00 -05:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency