01-29-2021 04:48 AM
I have a CallManager 12.5 SIP Normalization script where I want to prepend OY to all inbound calls on the Calling Party Name;
so if it came in From: "Jason Aarons 55901" I want it to change to From: "OY Jason Aarons 55901"
M={}
trace.enable()
function M.inbound_INVITE(msg)
--Adding Shipcode to inbound Calling Party Name
local from = msg:getHeader("From") --Get FROM Header
if from then
local b = from:gsub("From: \", "From: \"OY ") --New FROM Header
trace.format("From header: BEFORE: \""..from.."\"; AFTER: \""..b.."\"")
msg:modifyHeader("From", b) --Replace FROM Header
else
trace.format("No SIP From header in message.")
end
end
return M
++++++++++++++++++++++++
Here is the CUCM trace file showing "no change"
78017633.002 |11:57:33.032 |AppInfo |//SIP/SIPUdp/wait_SdlDataInd: Incoming SIP UDP message size 1602 from 10.169.8.10:[59854]:
[71946528,NET]
INVITE sip:19045554444@192.168.180.161:5060 SIP/2.0
Via: SIP/2.0/UDP 10.169.8.10:5060;branch=z9hG4bK18878C4
Remote-Party-ID: "Jason Aarons 55901" <sip:1016955901@10.169.8.10>;party=calling;screen=yes;privacy=off
From: "Jason Aarons 55901" <sip:1016955901@10.169.8.10>;tag=870055F-236C
To: <sip:19045554444@192.168.180.161>
78017635.000 |11:57:33.033 |SdlSig |SIPNormalizeReq |wait |SIPNormalization(2,100,184,1) |SIPHandler(2,100,183,1) |2,100,255,1.26630753^10.169.8.10^* |*TraceFlagOverrode
78017635.001 |11:57:33.033 |AppInfo |//SIP/SIPNormalization/trace_sip_message: After inbound (no change) SIP Normalization msg is:
[71946528,INT]
INVITE sip:19045554444@192.168.180.161:5060 SIP/2.0
Via: SIP/2.0/UDP 10.169.8.10:5060;branch=z9hG4bK18878C4
Remote-Party-ID: "Jason Aarons 55901" <sip:1016955901@10.169.8.10>;party=calling;screen=yes;privacy=off
From: "Jason Aarons 55901" <sip:1016955901@10.169.8.10>;tag=870055F-236C
To: <sip:19045554444@192.168.180.161>
01-29-2021 04:50 AM
If I want to change what the PSTN see for Calling Party Name should I be modifying From or Remote-Party-ID or both?
01-29-2021 08:11 AM
local b = from:gsub("From: \", "From: \"OY ") --- Double quotes is missing in this line.
local b = from:gsub("From: \"", "From: \"OY ")
02-08-2021 06:06 AM
still failing, updated below;
M={}
trace.enable()
function M.inbound_INVITE(msg)
--Adding Shipcode to inbound Calling Party Name
local from = msg:getHeader("From") --Get FROM Header
if from then
local b = from:gsub("From: \"", "From: \"OY ") --New FROM Header
trace.format("From header: BEFORE: \""..from.."\"; AFTER: \""..b.."\"")
msg:modifyHeader("From", b) --Replace FROM Header
else
trace.format("No SIP From header in message.")
end
end
return M
02-08-2021 10:25 AM - edited 02-08-2021 10:58 AM
This line:
local b = from:gsub("From: \"", "From: \"OY ") --New FROM Header
should be:
local b = from:gsub("\"", "\"OY ",1) --New FROM Header
As the from variable value from msg:getHeader("From") is ""Jason Aarons 55901" <sip:1016955901@10.169.8.10>;tag=870055F-236C"
so there is no "from" in the string to match with.
in this line: local b = from:gsub("\"", "\"OY ",1) --it matches with the first double quotes only and replace it with the prefix you want.
if this helps, please rate.
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