I am trying to create a SIP Normalization Script to modify the From header if it contains sip:Anonymous@IP Address inbound over one SIP trunk. I came up with the script below but the following error shows in the SDL log in CallManager "attempt to call method 'ModifyHeader' (a nil value)".
M = {}
function M.inbound_INVITE(msg)
local from = msg:getHeader("From")
local fromchange = string.gsub(from, "sip:Anonymous@", "sip:5555555555@") --Real phone number replaced for this example
msg:ModifyHeader("From", fromchange)
end
return M
If I run the core part of the code through a LUA interpretor and print fromchange I am getting a valid value back.
Anyone have any ideas?