Skip to content

Commit

Permalink
Use remote address in From and To headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
husam212 committed Dec 11, 2020
1 parent 226f79b commit b87ac36
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sippy/StatefulProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ def recvRequest(self, req):
via0.genBranch()
via1 = req.getHF('via')
req.insertHeaderBefore(via1, SipHeader(name = 'via', body = via0))

to = req.getHF('to')
to0 = to.getBCopy()
to0.address.url.setAddr(self.destination)
req.replaceHeader(to, SipHeader(name = 'to', body = to0))

fr0m = req.getHF('from')
fr0m0 = fr0m.getBCopy()
fr0m0.address.url.setAddr(self.destination)
req.replaceHeader(fr0m, SipHeader(name = 'from', body = fr0m0))

ruri = req.ruri.getCopy()
ruri.setAddr(self.destination)
req.setRURI(ruri)

req.setTarget(self.destination)
print req
self.global_config['_sip_tm'].newTransaction(req, self.recvResponse)
Expand Down

0 comments on commit b87ac36

Please sign in to comment.