AnsweredAssumed Answered

Lua Script Remote-Party-ID

Question asked by nikhilrajan on Nov 17, 2016
Latest reply on Nov 23, 2016 by nikhilrajan

Hi All,

 

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


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


I tried applying below but it failed.


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


Can anyone pls help me on this?


Regards,

Nikhil

Outcomes