freeswitcher 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -105,7 +105,7 @@ module FSR
105
105
  end
106
106
 
107
107
  def subscribe_to_event(event, sub_events = [])
108
- sub_events = [sub_events] unless sub_events.respond_to?(:each)
108
+ sub_events = [sub_events] unless sub_events.kind_of?(Array)
109
109
  @subscribed_events << event
110
110
  @subscribed_sub_events += sub_events
111
111
  if custom = @subscribed_events.delete(:CUSTOM)
@@ -1,3 +1,3 @@
1
1
  module FSR
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.8"
3
3
  end
@@ -39,6 +39,11 @@ class InboundListener2 < InboundListener
39
39
  end
40
40
  end
41
41
 
42
+ class InboundListener3 < InboundListener2
43
+ def before_session
44
+ add_event(:CUSTOM, "fifo::info") { |e| @custom_event = e }
45
+ end
46
+ end
42
47
  describe "Testing FSR::Listener::Inbound" do
43
48
  it "defines #post_init" do
44
49
  FSR::Listener::Inbound.method_defined?(:post_init).should == true
@@ -72,6 +77,13 @@ EM.describe InboundListener do
72
77
  done
73
78
  end
74
79
 
80
+ should "be able to add custom event hooks with sub events" do
81
+ listener = InboundListener3.new(1234, {:auth => 'SecretPassword'})
82
+ @listener.receive_data("Content-Length: 22\n\nEvent-Name: CUSTOM\n\n")
83
+ @listener.custom_event.should.equal @listener.recvd_event.first
84
+ done
85
+ end
86
+
75
87
  should "be able to add custom event hooks on classes, before instantiation" do
76
88
  FSL::Inbound.add_event_hook(:HANGUP_EVENT) { |instance, event| instance.test_event = event }
77
89
  listener = InboundListener2.new(1234, {:auth => 'SecretPassword'})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freeswitcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayson Vaughn