Module: OverSIP::SIP::Tags

Defined in:
lib/oversip/sip/tags.rb

Constant Summary collapse

PREFIX_FOR_TOTAG_SL_REPLIED =
::SecureRandom.hex(4) + "."
REGEX_PREFIX_FOR_TOTAG_SL_REPLIED =
/^#{PREFIX_FOR_TOTAG_SL_REPLIED}/
ROUTE_OVID_VALUE =
::SecureRandom.hex(4)
ROUTE_OVID_VALUE_HASH =
ROUTE_OVID_VALUE.hash
ANTILOOP_CONST =
::SecureRandom.hex(1)

Class Method Summary collapse

Class Method Details

.check_totag_for_sl_reply(totag) ⇒ Object



18
19
20
21
# File 'lib/oversip/sip/tags.rb', line 18

def self.check_totag_for_sl_reply totag
  return nil unless totag
  totag =~ REGEX_PREFIX_FOR_TOTAG_SL_REPLIED
end

.check_value_for_route_ovid(value) ⇒ Object



27
28
29
30
# File 'lib/oversip/sip/tags.rb', line 27

def self.check_value_for_route_ovid value
  return nil unless value
  value.hash == ROUTE_OVID_VALUE_HASH
end

.create_antiloop_id(request) ⇒ Object



32
33
34
35
# File 'lib/oversip/sip/tags.rb', line 32

def self.create_antiloop_id request
  # It produces a 32 chars string.
  ::Digest::MD5.hexdigest "#{ANTILOOP_CONST}#{request.ruri.to_s}#{request.call_id}#{request.routes[0].uri if request.routes}"
end

.totag_for_sl_replyObject



14
15
16
# File 'lib/oversip/sip/tags.rb', line 14

def self.totag_for_sl_reply
  PREFIX_FOR_TOTAG_SL_REPLIED + ::SecureRandom.hex(4)
end

.value_for_route_ovidObject



23
24
25
# File 'lib/oversip/sip/tags.rb', line 23

def self.value_for_route_ovid
  ROUTE_OVID_VALUE
end