01-15-2021 08:57 AM
Hello there!
I'm struggling with a normalization script to modify an incoming (from Avaya) INVITE to replace the incorrect IP address they are sending with the proper IP address. I have it working with the To: field, but not the INVITE field.
This works to replace the To: in the INVITE:
M={}
function M.inbound_INVITE(msg)
local to = msg:getHeader("To") --Get To Header
local b = string.gsub(to, "@10.19.242.10>", "@10.225.221.25>") --New To Header
msg:modifyHeader("To", b) --Replace To Header
end
return M
Tried to do the same for the INVITE field, but it throws this error: "UpdateTo at line 7: bad argument #1 to 'gsub' (string expected, got nil)"
M={}
function M.inbound_INVITE(msg)
local INVITE= msg:getHeader("INVITE") --Get INVITE Header
local b = string.gsub(INVITE, "@10.19.242.10>", "@10.225.221.25>") --New INVITE Header
msg:modifyHeader("INVITE", b) --Replace INVITE Header
end
return M
Any help would be great.
Many thanks,
Jason
01-15-2021 09:16 AM
Not an answer as such for your question, but wouldn’t it be better if you would get the Avaya side to send the proper IP address in the invites instead of trying to modify it on the receiver side? Feel like a backwards way to solve this.
01-15-2021 09:23 AM
Yeah, I agree 100%. I've pointed that out to the Avaya folks, but they don't seem to know how. I'm working on this as a temporary solution to get project closure.
01-15-2021 10:30 AM - edited 01-15-2021 10:38 AM
Likely it would be easier to do the modification of the SDP content if you have a SBC (Cube) in between the two systems.
If you got a router to spare for this have a look at document on how you could create a SIP profile to modify this. https://www.cisco.com/c/en/us/support/docs/voice/ip-telephony-voice-over-ip-voip/211306-In-Depth-Explanation-of-Cisco-IOS-and-IO.html
01-15-2021 10:38 AM
Yeah, forgot to mention, this is a direct trunk, no CUBE or other SBC between CUCM and Avaya.
01-15-2021 11:01 AM
01-15-2021 11:13 AM
Thanks for the link - I've already reviewed that slide deck, but it wasn't much help for this particular scenario.
01-15-2021 11:26 AM
Development guide for SIP transparency and normalisation https://d1nmyq4gcgsfi5.cloudfront.net/fileMedia/12089d2d-f579-4dd7-a67f-f96d92f3e350/9.0(1)_developer_guide_for_sip_transparency_and_normalization.pdf
01-15-2021 11:35 AM
From a quick glance this looks like it could contain information that could be of help. https://afterthenumber.com/2015/08/28/lua-scripting-replacing-fqdn-with-ip-in-sip-headers/
For sure it would need a bit of alterations, but on a whole it looks to be a good fit.
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