This is an old revision of the document!
SIP Normalization
Reference
Examples
Add Sip Header
- Create a SIP Normalization Script similar to below
- Assign this to the SIP trunk (via SIP trunk configuration)
- Reset trunk
M = {}
local headername = "myHeader"
local token = "myToken"
function M.outbound_INVITE(msg)
msg:addHeader(headername, token)
end
return M
Removing a SIP (Diversion) Header - by Jason Williams
M = {} trace.enable() function M.outbound_INVITE(msg) trace.format("Diversion Lua Start") local from = msg:getHeader("From") local diversion = msg:getHeader("Diversion") local fromnum = string.match(from, "<sip:.+@") trace.format("From header is %s", from) if diversion then trace.format("Diversion header is %s", diversion) local divertnum = string.match(diversion, "<sip:.+@") trace.format("The From Number is %s", fromnum) trace.format("The Diversion Number is %s", divertnum) if (fromnum == divertnum) then trace.format("Removing Diversion Header") msg:removeHeader("Diversion") end end end return M
Debug Before
Initial INVITE 04419012.001 |19:10:39.938 |AppInfo |//SIP/SIPNormalization/trace_sip_message: Before outbound SIP Normalization msg is: [915821,INT] INVITE sip:00826661234@159.134.113.212:5060 SIP/2.0 Via: SIP/2.0/TCP 10.46.96.20:5060;branch=z9hG4bKf8296e71e9bd From: "Alice Anderson" <sip:+353238866200@10.46.96.20>;tag=314564~07989e9a-9d91-485c-b4a9-dd3742168ba9-54086325 To: <sip:00857452333@159.134.113.212> Date: Thu, 09 Apr 2020 18:10:39 GMT Call-ID: 69a3ff00-e8f1651f-c445-14602e0a@10.46.96.20 Supported: 100rel,timer,resource-priority,replaces Min-SE: 1800 User-Agent: Cisco-CUCM10.5 Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY CSeq: 101 INVITE Expires: 180 Allow-Events: presence Supported: X-cisco-srtp-fallback Supported: Geolocation Call-Info: <urn:x-cisco-remotecc:callinfo>;x-cisco-video-traffic-class=DESKTOP Cisco-Guid: 1772355328-0000065536-0000001634-0341847562 Session-Expires: 1800 Diversion: "Alice Anderson" <sip:+35315551234@10.10.10.20>;reason=unconditional;privacy=off;screen=yes P-Asserted-Identity: "Alice Anderson" <sip:+35315551234@10.10.10.20> Remote-Party-ID: "Alice Anderson" <sip:+35315551234@10.10.10.20>;party=calling;screen=yes;privacy=off Contact: <sip:+35315551234@10.10.10.20:5060;transport=tcp>;+u.sip!devicename.ccm.cisco.com="SEPBCC493964725" Max-Forwards: 69 Content-Type: application/sdp Content-Length: 350 v=0 o=CiscoSystemsCCM-SIP 314564 1 IN IP4 10.10.10.20 s=SIP Call c=IN IP4 10.16.60.56 b=TIAS:64000 b=AS:64 t=0 0 m=audio 18282 RTP/AVP 0 8 116 18 101 b=TIAS:64000 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:116 iLBC/8000 a=maxptime:20 a=fmtp:116 mode=20 a=rtpmap:18 G729/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 04419014.000 |19:10:39.939 |SdlSig |SsDataInd |wait |ForwardManager(3,100,199,1) |Cdcc(3,100,219,5708) |3,100,14,1.14913^*^* |[R:N-H:0,N:0,L:0,V:0,Z:0,D:0] SsType=50331654 SsKey=0 SsNode=3 SsParty=54086325 DevId=(0,0,0) BCC=3 OtherParty=54086322 NodeOtherParty=3 clearType = 0 CSS=861fc2e6-0851-81f6-a6b7-dc31947efff0:9120391d-9c40-99aa-28b2-36b27887847c CNumInfo = 0 CNameInfo = 0 ssDevType=8 ssOtherDevType=4 FDataType=0opId=0ssType=0 SsKey=0invokeId=0resultExp=Fbpda=F ssCause = 0 ssUserState = 1 ssOtherUserState = 2 PL=5 PLDmn=0 networkDomain= delayAPTimer=F geolocInfo={geolocPkid=, filterPkid=, geolocVal=MixedDevice, devType=4} cfwdTimerAction=0 matchInterceptPartition= matchInterceptPattern= 04419014.001 |19:10:39.939 |AppInfo |ForwardManager - wait_SsDataInd - Key= 0x0, party= 54086325, BCC= 3 04419014.002 |19:10:39.939 |AppInfo |ForwardManager - findCallBySsParty - Found entry for party= 54086325, callkey= 0xAC 04419012.002 |19:10:39.939 |AppInfo |//SIPLua/Script/trace_output: Diversion Lua Start 04419015.000 |19:10:39.939 |SdlSig |SsDataInd |awaitingCallResponse |Forwarding(3,100,198,172) |ForwardManager(3,100,199,1) |3,100,14,1.14913^*^* |[R:N-H:0,N:0,L:0,V:0,Z:0,D:0] SsType=50331654 SsKey=0 SsNode=3 SsParty=54086325 DevId=(0,0,0) BCC=3 OtherParty=54086322 NodeOtherParty=3 clearType = 0 CSS=861fc2e6-0851-81f6-a6b7-dc31947efff0:9120391d-9c40-99aa-28b2-36b27887847c CNumInfo = 0 CNameInfo = 0 ssDevType=8 ssOtherDevType=4 FDataType=0opId=0ssType=0 SsKey=0invokeId=0resultExp=Fbpda=F ssCause = 0 ssUserState = 1 ssOtherUserState = 2 PL=5 PLDmn=0 networkDomain= delayAPTimer=F geolocInfo={geolocPkid=, filterPkid=, geolocVal=MixedDevice, devType=4} cfwdTimerAction=0 matchInterceptPartition= matchInterceptPattern= 04419012.003 |19:10:39.939 |AppInfo |//SIPLua/Script/trace_output: From header is "Alice Anderson" <sip:[email protected]>;tag=314564~07989e9a-9d91-485c-b4a9-dd3742168ba9-54086325 04419012.004 |19:10:39.939 |AppInfo |//SIPLua/Script/trace_output: Diversion header is "Alice Anderson" <sip:[email protected]>;reason=unconditional;privacy=off;screen=yes 04419012.005 |19:10:39.939 |AppInfo |//SIPLua/Script/trace_output: The From Number is <sip:+35315551234@ 04419012.006 |19:10:39.939 |AppInfo |//SIPLua/Script/trace_output: The Diversion Number is <sip:+35315551234@ 04419012.007 |19:10:39.939 |AppInfo |//SIPLua/Script/trace_output: Removing Diversion Header 04419016.000 |19:10:39.939 |SdlSig |SIPSPISignal |wait |SIPTcp(3,100,71,1) |SIPHandler(3,100,79,1) |3,100,14,1.14913^*^* |*TraceFlagOverrode 04419016.001 |19:10:39.939 |AppInfo |SIPTcp - wait_SdlSPISignal: Outgoing SIP TCP message to 159.134.113.212 on port 5060 index 8704 [915821,NET]
Debug After
INVITE sip:00826661234@159.134.113.212:5060 SIP/2.0 Via: SIP/2.0/TCP 10.46.96.20:5060;branch=z9hG4bKf8296e71e9bd From: "Alice Anderson" <sip:+353238866200@10.46.96.20>;tag=314564~07989e9a-9d91-485c-b4a9-dd3742168ba9-54086325 To: <sip:00826661234@159.134.113.212> Date: Thu, 09 Apr 2020 18:10:39 GMT Call-ID: 69a3ff00-e8f1651f-c445-14602e0a@10.46.96.20 Supported: 100rel,timer,resource-priority,replaces Min-SE: 1800 User-Agent: Cisco-CUCM10.5 Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY CSeq: 101 INVITE Expires: 180 Allow-Events: presence Supported: X-cisco-srtp-fallback Supported: Geolocation Call-Info: <urn:x-cisco-remotecc:callinfo>;x-cisco-video-traffic-class=DESKTOP Cisco-Guid: 1772355328-0000065536-0000001634-0341847562 Session-Expires: 1800 <Diversion Header removed from here> P-Asserted-Identity: "Alice Anderson" <sip:+35315551234@10.10.10.20> Remote-Party-ID: "Alice Anderson" <sip:+35315551234@10.10.10.20>;party=calling;screen=yes;privacy=off Contact: <sip:+35315551234@10.10.10.20:5060;transport=tcp>;+u.sip!devicename.ccm.cisco.com="SEPBCC493964725" Max-Forwards: 69 Content-Type: application/sdp Content-Length: 350 v=0 o=CiscoSystemsCCM-SIP 314564 1 IN IP4 10.10.10.20 s=SIP Call c=IN IP4 10.16.60.56 b=TIAS:64000 b=AS:64 t=0 0 m=audio 18282 RTP/AVP 0 8 116 18 101 b=TIAS:64000 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:116 iLBC/8000 a=maxptime:20 a=fmtp:116 mode=20 a=rtpmap:18 G729/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15