12-02-2017 08:21 AM
Hi, I have been using a sip normalization script I found on this website to modify the from header
M={}
function M.outbound_INVITE(msg)
local from = msg:getHeader("From") --Get FROM Header
local b = string.gsub(from, "<sip:.+@", "<sip:xxxxxxxxxx@") --New FROM Header
msg:modifyHeader("From", b) --Replace FROM Header
end
return M
however ive been trying to modify it to allow the caller ID to be passed through from the CUCM trunk configuration interface
I found an example of this online but the value being changed is not the one I'm trying to change
M = {}
local ccaid = scriptParameters.getValue("CCA-ID")
function M.outbound_INVITE(msg)
if ccaid
then
local contact = msg:getHeader("Contact")
local replace = string.format("%s;CCA-ID=%s>", "%1", ccaid)
contact = string.gsub(contact, "(<sip:.*)>", replace)
msg:modifyHeader("Contact", contact)
end
end
return M
Can anyone suggest how to modify this so that the x's in the from header are replaced by the value of CCA-ID ?
12-03-2017 12:58 PM
Here is the solution another admin suggested
M={}
local callingnumber= scriptParameters.getValue("callingnumber")
function M.outbound_INVITE(msg)
if callingnumber
then
local replace = "<sip:" .. callingnumber .. "@"
local from = msg:getHeader("From") --Get FROM Header
local b = string.gsub(from, "<sip:.+@", replace) --New FROM Header
msg:modifyHeader("From", b) --Replace FROM Header
end
end
return M
Tested and working hope this helps someone else in the future
12-04-2017 07:59 AM
Nice tip, thanks for sharing
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide