Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

SIP Trunk Normalization Script



I need some assistance with SIP Trunk Normalization script, not sure if this is right forum to post this question.


We have CUCM 8.6 cluster integrated with Microsoft Lync over SIP Trunk.

We have the below SIP Normalization script to convert the History-Info to Diversion Header,


M = {}

M.allowHeaders = {"History-Info"}

function M.inbound_INVITE(msg)



return M


When a Lync user sets Call Forward All & Call Forward No Answer to external number, the script correctly changes the the header.


However when the same Lync user sets Simultaneous ring on the client, CUCM does receive the same History-Info but without any reason text.


Hence the script is not taking effect on that received INVITE message.


When we did Call Forward All from Lync number:+16477900399 to +13365439382, below is the History Info we received and it was converted to Diversion Header


HISTORY-INFO: <;user=phone?Reason=SIP%3Bcause%3D302%3Btext%3D%22Moved%20Temporarily%22>;index=1;ms-retarget-reason=forwarding,<;user=phone>;index=1.1


But when we did simultaneous ring to +13365439382 and got the following HISTORY-INFO, it was not converted to Diversion Header by the same script


HISTORY-INFO: <;user=phone>;index=1;ms-retarget-reason=forwarding,<;user=phone>;index=1.1


The only difference I see the in those 2 History Info is that, Simultaneous Ring INVITE doesn't have the reason text included.


is that the reason the Script not converting the header?


This is the first time I'm trying the scripting. can anyone help me to convert this nonworking History Info to Diversion header?


Thanks for your help



//Suresh Please rate all the useful posts.
Everyone's tags (1)

I think its because re

I think its because re-Invites the script is not kicking .I am not an expert in Lua scripting but i can give you a suggestion that you can try it is to use wildcard in method.

function M.inbound_ANY(msg)

I know this will modify all inbound message , so if you doing testing then try to isolate sip profile from the running environment , so it wouldn't affect other calls.


Here is link from Cisco live which explains normalization and lua scripting.



Thanks Manish, I'll have a

Thanks Manish, I'll have a check :)

//Suresh Please rate all the useful posts.

Manish, I wrote another

Manish, I wrote another script to change those 2 different HI to Diversion header and that works fine now. found this very good video guide from Sreekanth which helped to build that script.

//Suresh Please rate all the useful posts.
CreatePlease to create content