- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Labels:
-
UC Manager SIP
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 06:37 AM
OK, thank you very much!
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 06:19 AM
Can we have inbound and outbound in the same script, Inbound script is working but when it comes to outbound, it still displaying the messages, which we dont want. Outbound call is made by the CCB funtionality.
M = {}
function M.inbound_ANY(msg)
local from = msg:getHeader("Remote-Party-ID")
if (from ~= nil) then
from = string.gsub(from, "--CVP[_0-9]*", "")
msg:modifyHeader("Remote-Party-ID", from )
end
end
function M.outbound_ANY_ANY(msg)
local from = msg:getHeader("Remote-Party-ID")
if (from ~= nil) then
from = string.gsub(from, "--CVP[_0-9]*", "")
msg:modifyHeader("Remote-Party-ID", from )
end
end
return M
Can you let us know if that work ?
