06-05-2017 02:16 PM
Hello. I'm looking to remove and replace the FROM header as the invite ingresses from Skype for Business into CUCM. Would the below script accomplish this? The invite currently just says "first.last@test.com:10.1.1.1". I'm looking to replace it with a phone number so its routable. Any help is appreciated.
Robert
M={}
function M.outbound_INVITE(msg)
local from = msg:getHeader("FROM") --Get FROM Header
local b = string.gsub(from, "(<sip:.+@)", "<sip:5551112222") --New FROM Header
msg:modifyHeader("From", b) --Replace FROM Header
end
return M
Solved! Go to Solution.
07-07-2017 05:55 AM
Hi Robert,
Since the SIP INVITE is being received by Unified CM from S4B, it is an "inbound_INVITE" from the perspective of SIP Normalization.
BTW, There's a couple other minor tweaks I would make to your above...
M={}
function M.outbound_INVITE(msg)
local from = msg:getHeader("From") --Get FROM Header
local b = string.gsub(from, "<sip:.+@", "<sip:5551112222@") --New FROM Header
msg:modifyHeader("From", b) --Replace FROM Header
end
return M
I always use header names using a format of "From" rather than "FROM".
Since you aren't trying to 'capture' what you matched, the () in your match string aren't needed.
07-02-2017 07:51 PM
Hi Robert,
Have moved your question under UC Manager SIP community. Please refer this url for related information
https://communities.cisco.com/thread/73584?start=0&tstart=0
Thanks and Regards,
Geevarghese
07-07-2017 05:55 AM
Hi Robert,
Since the SIP INVITE is being received by Unified CM from S4B, it is an "inbound_INVITE" from the perspective of SIP Normalization.
BTW, There's a couple other minor tweaks I would make to your above...
M={}
function M.outbound_INVITE(msg)
local from = msg:getHeader("From") --Get FROM Header
local b = string.gsub(from, "<sip:.+@", "<sip:5551112222@") --New FROM Header
msg:modifyHeader("From", b) --Replace FROM Header
end
return M
I always use header names using a format of "From" rather than "FROM".
Since you aren't trying to 'capture' what you matched, the () in your match string aren't needed.
07-07-2017 06:37 AM
OK, thank you very much!
Robert
12-01-2017 01:26 PM
Hi. Is there a way to modify this script to capture From header "unknown" or "anonymous" and change it to say +1234567890 under the same script?
12-04-2017 05:00 AM
Hi,
Do you want the script to change it on outbound direction or inbound direction? It's straightforward if you want to add an inbound section. You just need a corresponding:
M.inbound_INVITE(msg)
...
end
before the "return M"
12-04-2017 05:34 AM
HI. I know how to change directions. What I’m not sure is how to make the script change the From header based on multiple “From” header values like Unknown, anonymous and Restricted.
01-07-2019 06:19 AM
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