cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
376
Views
0
Helpful
1
Replies

SIP normalization for privacy

nikhilrajan
Level 1
Level 1

I need to modify this script to change this header. Can any one pls help me on this. 


From

Remote-Party-ID "London Test" ;party=calling;screen=yes;privacy=off

To

Remote-Party-ID "London Test" ;party=calling;screen=yes;privacy=full

The script is

M = {}
function M.outbound_INVITE(msg)
local fromtag = msg:getHeaderValueParameter("From", "tag")
local pai = msg:getHeader("P-Asserted-Identity")
local uri = string.match(pai, "(<sip:%+4420.+>)")
local uri2 = string.match(pai, "(<sip:%+441785.+>)")
if uri or uri2
then
msg:modifyHeader("From", "Anonymous <sip:anonymous@anonymous.invalid>")
msg:addHeaderValueParameter("From", "tag", fromtag)
msg:addHeader("Privacy", "id")
end
end
return M

tried


function M.outbound_INVITE(msg)
local remote = msg:getHeader("Remote-Party-ID")
local privacy = string.find(remote, "off")
local target = string.sub(remote, privacy)
local replace = string.gsub(target, "full")
msg:modifyHeader("Remote-Party-ID", replace)
end
return M

but failed

1 Reply 1

nikhilrajan
Level 1
Level 1

Any help shall be great..

Regards

Nikhil