cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1521
Views
5
Helpful
8
Replies

CUCM SIP normalization script assistance

Jason Cox
Level 1
Level 1

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

8 Replies 8

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.



Response Signature


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.

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



Response Signature


Yeah, forgot to mention, this is a direct trunk, no CUBE or other SBC between CUCM and Avaya.

Thanks for the link - I've already reviewed that slide deck, but it wasn't much help for this particular scenario.

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.



Response Signature