A Guide To SIP Normalization On CUCM and Lua Scripting - Page 6 - Cisco Community
A Guide To SIP Normalization On CUCM and Lua Scripting - Page 6 - Cisco Community
Cisco Community > Technology and Support > Collaboration > Collaboration Videos
> A guide to SIP Normalization on CUCM and Lua Scripting
39470 91 65
I have recorded this guide for SIP Normalization on call manager and also have elaborated a little
bit on how we use the Lua scripting.
A SIP Normalization script could really help the customer as a workaround or a permanent
solution for issues related to calling and CLID.
Disclaimer:
Cisco TAC does NOT support SIP Normalization scripts. If the customer has already applied a
script, TAC does NOT troubleshoot it. It is the customer's responsiblity to make it work.
Unied Communications
50 Helpful Share
91 Comments
01-28-2016 10:27 AM
01-28-2016 10:27 AM
Thanks for the pointer! I'll
pwhite Beginner give it a try.
0 Helpful
02-10-2016 10:03 PM
Ruslan Amrahov Beginner
02-10-2016 10:03 PM
I hope that you can help us with the issue we faced. We have a customer, who has CUCM
connected to SIP Provider directy (yeah, no CUBE, this is a long story). The topology is like this:
Phones----CUCM----ASA-----SIP_SP
The issue is that when someone is calling from outside, and there should be transfer, pickup or
anything which requires UPDATE message, as this message will contain internal extension (for
ex. transferring from one IP Phone to another), this message is going to SP and calls fails.
I believe I need to run some script on CUCM Trunk so it will change from: eld inside UPDATE
header. Do you guys can help me with it?
0 Helpful
02-11-2016 01:43 AM
Carlos Martinez Sanchez Beginner
02-11-2016 01:43 AM
Hi Solomon,
According to the SIP Normalization Developer guide, REFER and associated responses are not
supported for SIP Transparency.
Moreover, in thte outbound.INVITE function you are using rfchange, which is a local variable in
the inbound function, so I don't expect to be usable out of it.
Regards,
Carlos
0 Helpful
03-09-2016 07:02 AM
KY_ Enthusiast
03-09-2016 07:02 AM
Hi ,
I want to remove following line on the SDP messages about incoming calls.
I see something on sip normalization guide but it contain only outbound calls .
b=AS:64
b=CT:64
b=TIAS:64000
Thanks,
0 Helpful
05-25-2016 10:08 PM
joe.bennett Participant
05-25-2016 10:08 PM
Thanks Sreekanth,
Between this video and the Cisco Live Berlin presentation I now have a good handle on
normalisation. I'm stuck converting a SIP-prole from CUBE to Lua (the CUBE is managed
by a network team who don't know voice).
The prole;
voice class sip-profiles 1
request CANCEL sip-header Max-Forwards modify ".*" "User-Agent: CUBE"
response ANY sip-header Remote-Party-ID modify "(.*@).*>(.*)" "\1mydomain.com>\2
request ANY sip-header Remote-Party-ID modify "(mailto:.*@).*%3e(.*)".*@).*>(.*)" "\1mydomain.com>\2"
request REINVITE sdp-header Audio-Attribute modify "inactive" "sendrecv"
request ACK sdp-header Audio-Attribute modify "sendonly" "sendrecv"
request INVITE sip-header P-Asserted-Identity modify "(.*)" "P-Asserted-Identity: <sip:[email protected]
request INVITE peer-header sip Remote-Party-ID copy ".*<sip:(.*)@.*" u01
request INVITE sip-header From modify ".*<sip.*@.*>(.*)" "From:<sip:\[email protected]>\1"
The P-Asserted-Identity seems to be used by CUBE to rewrite the From address so I've left it
out of the script. The code seems to fail on calling the function change_domain with an error
that msg is empty, but testing calling functions on repl.it seems that the syntax is correct. I don't
want to have to replicate the translations for each message type but if I can't get calling
functions to work I may have to.
It's hard to debug in realtime and of course the Cisco functions don't work on repl.it so I can
only test scraps of code not the whole thing.
Do you have any thoughts on this implementation?
Joe
0 Helpful
05-26-2016 12:33 AM
Sreekanth Narayanan Cisco Employee
05-26-2016 12:33 AM
Ruslan, I am not sure if we can change the UPDATE method. I haven't tried this in my lab yet.
Sorry for the really delayed response.
0 Helpful
05-26-2016 02:33 AM
Sreekanth Narayanan Cisco Employee
05-26-2016 02:33 AM
Hi Joe,
Your script looks OK from a syntax standpoint, and should work. Perhaps the 'msg' is not
available for a custom function and can only be accessed by the Call manager's built-in lua
functions.
Can you try changing the name of the argument passed to the change_domain function to
something else and appropriately change the variable name in the rest of the function as well?
Any other name might be OK but not the 'msg'.
0 Helpful
11-02-2016 08:57 AM
jriacono5 Beginner
11-02-2016 08:57 AM
Hi Sreekanth, Currently, the From: eld for all of our outbound SIP video calls going through Expressway is
being set with the [email protected] (I.E. [email protected]). Is it possible to edit the
vcs-interop script to change it to use the SIP URI congured on the directory number instead? I.E.
[email protected] Thank you, James
0 Helpful
11-02-2016 09:22 AM
Louis-Philippe Descamps Beginner
11-02-2016 09:22 AM
hi,
got a bit of bug here with the Hyphen in my rst name in LUA. if i change Louis-Philippe to
LouisPhilippe. it works
in repl.it
print (target)
print (from)
print (newfrom)
the output is
"Louis-Philippe Descamps"
"Louis-Philippe Descamps"<sip:[email protected]:5060>;tag=E3ntppq
"Louis-Philippe Descamps"<sip:[email protected]:5060>;tag=E3ntppq
0 Helpful
11-02-2016 11:01 AM
Carlos Martinez Sanchez Beginner
11-02-2016 11:01 AM
Hi Louis-Philippe,
The problem is when adding the hyphon in the pattern of the string.gsub it behaves as a magic
character, so it needs to be escaped. What you can do is to edit the target and add it an %, the
following example may be appropiate:
This is quite simple, and it may not be applicable to a generic script, but it should work for your
case.
PS: Note that I have add it '' to the Global Service desk, so it will go between "" in the output.
0 Helpful
11-02-2016 11:32 AM
Louis-Philippe Descamps Beginner
11-02-2016 11:32 AM
Hi Carlos,
M={}
function M.inbound_INVITE(msg)
local from = msg:getHeader("From")
msg:modifyHeader("From", newfrom)
end
return M
0 Helpful
11-11-2016 08:08 AM
Carlos Martinez Sanchez Beginner
11-11-2016 08:08 AM
Hi James,
You actually can change the right-hand side of the script as you want. What you would need to
do is to copy the vcs-interop and paste it in a new one (the one by default cannot be modied)
and then add the part of code to change the directory number. There is actually a function that
already interoperates whit the left-hand side so, it shouldn't be complicate to add manipulations
for the right part and make it to be called when required.
The key thing here is about scalability, if you just want to change all calls using that script from a
number to VideoRoom it is easy to get it, the problem is if you have several numbers to be
matched to dierent names it may not be that easier.
For instance this would change the reight side of the from URI to a uri-name added via
parameter script (this is some add-on to the original script where uri-name is teh name of the
room):
M = {}
local uri_name = scriptParameters.getValue("uri-name")
local function modify_lhs_of_uri(msg, header, lhs)
local value = msg:getHeader(header)
if value and lhs
then
local position_of_uri = string.find (value, "<")
local position_of_domain = string.find (value, "@", position_of_uri+1)
local fulldn = string.sub (value, position_of_uri+5, position_of_domain-1)
local dn_pattern = string.gsub (fulldn, "%+", "%%+")
local newfrom = string.gsub(value, dn_pattern, uri_name)
end
end
local function modify_lhs_of_uri_for_calling_party(msg)
if not uri_name
then
return
end
modify_lhs_of_uri(msg, "From", uri_name)
end
local function process_outbound_request(msg, isInvite)
modify_lhs_of_uri_for_calling_party(msg)
end
M.outbound_INVITE = function(msg)
process_outbound_request(msg, true)
end
return M
Regards,
Carlos M.
0 Helpful
12-22-2016 05:19 AM
KY_ Enthusiast
12-22-2016 05:19 AM
How can I convert diversion header via incoming sip trunk thought Lync and Siemens HiPath.
I could not see diversion header when I receiving call from Lync and Siemens HiPath.
0 Helpful
07-10-2018 06:30 AM
Carlos Martinez Sanchez Beginner
07-10-2018 06:30 AM
I was trying to passthrouhg the SDP for an incoming 200 OK (answer to an INVITE). Curretnly we
have an incoming 200 OK with SDP that is being sent as 200 OK without SDP to an IP Phone, I
wanted to copy this SDP and add it to the 200 that goes to the phone.
Thanks in advance.
Carlos.
0 Helpful
12-18-2019 06:53 PM
bripeter Cisco Employee
12-18-2019 06:53 PM
Is there a way to use the Parameter Name and Parameter value within a Lua script to set
values? I am at a loss to nd a way to call these functions in the script. Thanks much in
advance for any help you can lend!
0 Helpful
You must be a registered user to add a comment. If you've already registered, sign in.
Otherwise, register and sign in.
Comment
Getting Started
Find answers to your questions by entering keywords or phrases in the Search bar above.
New here? Use these resources to familiarize yourself with the community:
Quick Links
Discussions
Popular Projects
by Abu Hadee •
Participant
45865 18 85
Cisco UC on UCS
by William Bell •
Advisor
1652 8 55
Extension Mobility Cross Cluster Conguration
by jehlas •
Beginner
5108 8 55
Top
Quick Links -
Contacts
Help
Terms & Conditions
Privacy Statement
Cookie Policy
Trademarks
Site Map