module OverSIP::Modules::Callsign
Constants
- VERSION
Public Class Methods
assert_callsign_identity(request)
click to toggle source
# File lib/oversip-mod-callsign.rb, line 36 def assert_callsign_identity(request) x_callsign_token = request.header_top 'X-Callsign-Token' token = token_cache.get(x_callsign_token) || @client.describe_token(x_callsign_token) return false unless token && authorized_token?(token) sip_identity = token.identity.identifier log_system_debug "user asserted, adding P-Asserted-Identity '#{sip_identity}' for '#{request.log_id}'" if $oversip_debug request.set_header 'P-Asserted-Identity', '<' << sip_identity << '>' true end
config()
click to toggle source
# File lib/oversip-mod-callsign.rb, line 17 def config @config ||= {} end
configure(properties)
click to toggle source
# File lib/oversip-mod-callsign.rb, line 21 def configure properties %w[ callsign_client_id callsign_client_secret authorized_callsign_tenants authorized_callsign_scopes ].each do |property| config[property] = properties[property] || raise(OverSIP::ConfigurationError.new("Missing required Callsign configuration property: #{property}")) end @token_cache = TokenCache.new config['callsign_token_ttl'] @client = Client.new config['callsign_client_id'], config['callsign_client_secret'] end
token_cache()
click to toggle source
# File lib/oversip-mod-callsign.rb, line 32 def token_cache @token_cache end