cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1439
Views
0
Helpful
2
Replies

CUCM Lua script assistance.

RG84
Level 1
Level 1

Hello Everyone,

 

Can anyone help me with the Lua scripting. I have created the below response normalization Lua script. 

 

M={}
function M.outbound_404_INVITE(msg)
msg:setResponseCode(406, "Not Accepted")
end
return M

 

This is applied on the SIP trunk to the ITSP. I need to modify the 404 response to 406 so that the SBC stops hunting for the next server. 

I am getting these errors from the logs. I tried to check online with the Lua script compiler but was unable to verify the script as I dont have much experience with scripting. 

 

30492831.003 |13:07:49.521 |AppInfo |//SIPLua/Info/Load and Init successful: de vice XXXXXX-XXX script Response_test module M max mem 51200 warning mem 40960
30492831.004 |13:07:49.523 |AppInfo |//SIPLua/Info/Device:XXXXX Script:R esponse_test -- base script memory 19604 user script memory 408
30492987.001 |13:08:20.967 |AppInfo |//SIPLua/Error/SipContexts_removeContext: call contexts object is missing
30493044.001 |13:08:21.146 |AppInfo |//SIPLua/Error/SipContexts_removeContext: call contexts object is missing
30493100.001 |13:08:21.632 |AppInfo |//SIPLua/Error/SipContexts_removeContext: call contexts object is missing

 

 

Many thanks,

Rus

2 Replies 2

Alexander Stevenson
Cisco Employee
Cisco Employee

 

Hello @RG84,

 

I found three resources to help you:

 

1. Configure SIP Normalization Script in CCM - Configuration Examples and TechNotes

https://www.cisco.com/c/en/us/support/docs/unified-communications/unified-communications-manager-callmanager/213516-configure-sip-normalization-script-in-cc.html

 

2. A guide to SIP Normalization on CUCM and Lua Scripting - Examples given (please note this discussion is several pages long)

https://community.cisco.com/t5/collaboration-voice-and-video/a-guide-to-sip-normalization-on-cucm-and-lua-scripting/ba-p/3099409

 

3. CUCM-Lua - An External GitHub repo with 5 Lua script examples

https://github.com/gj0nyg/CUCM-Lua

 

 

davidn#
Cisco Employee
Cisco Employee

Hi Rus,

 

Is this the full content of your script? When you configure the script from CUCM Admin page,  by default, max threshold allowed for your script is 50k, that's why you're getting the mem warning.  You can increase this value depending on the complexity of your script. Make sure you don't use too many global variables or too many functions.
If this API is invoked for a request, it triggers a run-time error. That's probably why you're seeing the "call contexts object is missing".
 Try to use trace.enable and trace.format to print out the SIP msg/headers while testing your script to see what's going on and why you're getting the errors. Hope that helps.


Regards,


David