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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It would be easier if you don't try to use the indexes returned by string.find:
local remote = msg:getHeader("Remote-Party-ID")
local replace = string.gsub(remote, "privacy=off", "privacy=full")
msg:modifyHeader("Remote-Party-ID", replace)
Mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks a lot Mark. It worked
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comments
0 comments
Please sign in to leave a comment.