Skip to content

Commit

Permalink
Decrease Max-Forwards during forwarding. Insert one if it
Browse files Browse the repository at this point in the history
does not exist.
  • Loading branch information
sobomax committed Jul 26, 2024
1 parent c20a40c commit cc465a3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sippy/StatefulProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def __init__(self, global_config, destination):
self.destination = (destination, 'udp')

def recvRequest(self, req):
try:
max_forwards = req.getHFBody('max-forwards')
mfval = max_forwards.incNum(incr=-1)
if mfval <= 0:
return (req.genResponse(483, 'Too Many Hops'), None, None)
except IndexError:
req.appendHeader(SipHeader(name = 'max-forwards'))
via0 = SipVia()
via0.genBranch()
via1 = req.getHF('via')
Expand Down

0 comments on commit cc465a3

Please sign in to comment.