cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3324
Views
0
Helpful
4
Replies

Cisco CUCM: SIP Normalization Script to change From

SamSaul
Level 1
Level 1

Hi there,

I'm looking for SIP Normalization Script to the change the From field from Internal IP Address to Public IP Address.

I have looked at some scripts on this website and modified:

M={}

function M.outbound_INVITE(msg)

  local from = msg:getHeader("From")  --Get FROM Header

  local b = string.gsub(from, "<sip:.+@10.10.10.1>", "<sip:.+@A.B.C.D>")  --New FROM Header

  msg:modifyHeader("From", b)  --Replace FROM Header

end

return M

When applied it doesn't show the number before @10.10.10.1. How I can let the portion before @ unchanged? (which wildcard I can use) So that the number is shown.

Any help will be highly appreciated.

Thanks.

1 Accepted Solution

Accepted Solutions

Mark Stover
Cisco Employee
Cisco Employee

Hi Sam,

gsub is greedy, so unless you capture the LHS, it will disappear after the substitution. I would try:

local b = string.gsub(from, "@10.10.10.1>", "@A.B.C.D>")

Mark

View solution in original post

4 Replies 4

Mark Stover
Cisco Employee
Cisco Employee

Hi Sam,

gsub is greedy, so unless you capture the LHS, it will disappear after the substitution. I would try:

local b = string.gsub(from, "@10.10.10.1>", "@A.B.C.D>")

Mark

Hi Mark,

Thanks for your reaction. It's working like a charm

Is it possible to add another method in this script? I want to add change in Via and Diversion in the same method.

Thanks.

Sam,

If you want to change the headers in the same 'outbound_INVITE' headers, then just add additional header manipulations in the function you are working on.

Mark

Hello All,

 

We are using below SIP normalization for inbound and outbound in one script does it work's?

 

Error message " Unavaliable--CVP_11.0.1" message showing for the incoming customer call and CCB calls as well.

 

We have created below script, but for incoming call from customer we are not seeing the error message on IP phones,But for Courtesy Call Back calls, when they are connected it is showing as " Unavaliabl" on the IP phones.

 

Script #

M = {}
function M.inbound_ANY(msg)
  local from = msg:getHeader("Remote-Party-ID")
  if (from ~= nil) then
    from = string.gsub(from, "--CVP[_0-9]*", "")
    msg:modifyHeader("Remote-Party-ID", from )
  end
end
function M.outbound_ANY_ANY(msg)
  local from = msg:getHeader("Remote-Party-ID")
  if (from ~= nil) then
    from = string.gsub(from, "--CVP[_0-9]*", "")
    msg:modifyHeader("Remote-Party-ID", from )
  end
end
return M

 

any suggestions to fix this.