Module: OverSIP::Modules::UserAssertion
- Extended by:
- Logger
- Defined in:
- lib/oversip/modules/user_assertion.rb
Class Method Summary
collapse
Methods included from Logger
fg_system_msg2str, load_methods, log_id
Class Method Details
.add_pai(request) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/oversip/modules/user_assertion.rb', line 45
def self.add_pai request
if request.cvars[:asserted_user] == request.from.uri
unless request.["P-Preferred-Identity"]
log_system_debug "user asserted, adding P-Asserted-Identity for #{request.log_id}" if $oversip_debug
request. "P-Asserted-Identity", "<" << request.cvars[:asserted_user] << ">"
return true
else
log_system_debug "user asserted but P-Preferred-Identity header present, P-Asserted-Identity not added for #{request.log_id}" if $oversip_debug
request..delete "P-Asserted-Identity"
return nil
end
else
request..delete "P-Asserted-Identity"
return false
end
end
|
.assert_connection(message) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/oversip/modules/user_assertion.rb', line 9
def self.assert_connection message
case message
when ::OverSIP::SIP::Request
request = message
when ::OverSIP::SIP::Response
request = message.request
else
raise ::OverSIP::RuntimeError, "message must be a OverSIP::SIP::Request or OverSIP::SIP::Response"
end
return false unless request.connection.class.reliable_transport_listener?
return request.cvars[:asserted_user] if request.cvars[:asserted_user]
return false if request.["P-Preferred-Identity"]
log_system_debug "user #{request.from.uri} asserted to connection" if $oversip_debug
request.cvars[:asserted_user] = request.from.uri
end
|
.revoke_assertion(message) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/oversip/modules/user_assertion.rb', line 31
def self.revoke_assertion message
case message
when ::OverSIP::SIP::Request
request = message
when ::OverSIP::SIP::Response
request = message.request
else
raise ::OverSIP::RuntimeError, "message must be a OverSIP::SIP::Request or OverSIP::SIP::Response"
end
request.cvars.delete :asserted_user
true
end
|