Module: OverSIP::Modules::OutboundMangling
- Extended by:
- Logger
- Defined in:
- lib/oversip/modules/outbound_mangling.rb
Class Method Summary
collapse
Methods included from Logger
fg_system_msg2str, load_methods, log_id
Class Method Details
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/oversip/modules/outbound_mangling.rb', line 9
def self.add_outbound_to_contact proxy
unless proxy.is_a? ::OverSIP::SIP::Proxy
raise ::OverSIP::RuntimeError, "proxy must be a OverSIP::SIP::Proxy instance"
end
proxy.on_target do |target|
request = proxy.request
if request.contact and request.connection_outbound_flow_token and not request.contact.has_param? "ov-ob"
log_system_debug "performing Contact mangling (adding ;ov-ob Outbound param) for #{request.log_id}" if $oversip_debug
request.contact.set_param "ov-ob", request.connection_outbound_flow_token
proxy.on_success_response do |response|
if (contacts = response.["Contact"])
log_system_debug "reverting original Contact value (removing ;ov-ob Outbound param) from response" if $oversip_debug
contacts.each { |contact| contact.gsub! /;ov-ob=[_\-0-9A-Za-z]+/, "" }
end
end
end
end
end
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/oversip/modules/outbound_mangling.rb', line 33
def self. request
unless request.incoming_outbound_requested?
if (ov_ob = request.ruri.del_param("ov-ob"))
log_system_debug "incoming Outbound flow token extracted from ;ov-ob param in RURI for #{request.log_id}" if $oversip_debug
request.route_outbound_flow_token = ov_ob
request.incoming_outbound_requested = true
return true
else
return false
end
else
request.ruri.del_param("ov-ob")
return false
end
end
|