freeswitcher 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fsr/listener/inbound.rb +2 -3
- data/lib/fsr/version.rb +1 -1
- data/spec/fsr/listener/inbound.rb +3 -0
- metadata +2 -2
data/lib/fsr/listener/inbound.rb
CHANGED
@@ -40,7 +40,6 @@ module FSR
|
|
40
40
|
if error?
|
41
41
|
reconnect_until_succeeding
|
42
42
|
end
|
43
|
-
before_session
|
44
43
|
end
|
45
44
|
|
46
45
|
def reconnect_until_succeeding
|
@@ -50,7 +49,6 @@ module FSR
|
|
50
49
|
reconnect @host, @port
|
51
50
|
else
|
52
51
|
timer.cancel
|
53
|
-
authorize_and_register_for_events
|
54
52
|
end
|
55
53
|
}
|
56
54
|
end
|
@@ -58,6 +56,7 @@ module FSR
|
|
58
56
|
def authorize_and_register_for_events
|
59
57
|
FSR::Log.info "Connection established. Authorizing..."
|
60
58
|
say("auth #{@auth}")
|
59
|
+
before_session
|
61
60
|
end
|
62
61
|
|
63
62
|
def before_session
|
@@ -75,7 +74,7 @@ module FSR
|
|
75
74
|
when "command/reply"
|
76
75
|
return handle_reply(header, content)
|
77
76
|
when "text/event-plain"
|
78
|
-
hash_content = headers_2_hash(content)
|
77
|
+
hash_content = headers_2_hash(content).merge(:body => content.split("\n\n",2)[1].to_s)
|
79
78
|
when "text/event-json"
|
80
79
|
require "json"
|
81
80
|
hash_content = JSON.parse(content)
|
data/lib/fsr/version.rb
CHANGED
@@ -9,6 +9,9 @@ EM.spec_backend = EventMachine::Spec::Bacon
|
|
9
9
|
class InboundListener < FSR::Listener::Inbound
|
10
10
|
attr_accessor :custom_event
|
11
11
|
|
12
|
+
def post_init
|
13
|
+
before_session
|
14
|
+
end
|
12
15
|
# Stub error? out, do this to force session establishment
|
13
16
|
# Alternatively, you can
|
14
17
|
# InboundListener.new.authorize_and_register_for_events
|