cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Cisco Community Designated VIP Class of 2020

954
Views
2
Helpful
1
Replies
Beginner

SIP Normalization Script to replace Anonymous ID and add Privacy field

Dear Colleagues,

After a CUCM implementation I have faced with a problem. The anonymous calls are not forwarded and the provider informed me that the outbound INVITE has to met for two requirements:

- The INVITE's PAI has to contain a supported phone number instead of anonymous ID

- The INVITE has to contain Privacy:ID line

I wrote a LUA script and I have added it to the SIP trunk, but it does not work, please be so kind to help me out.

M = {}

function M.outbound_INVITE(msg)

  local header = msg:getHeader("From")

  if string.find(header, "anonymous")

  then

    local oldPAI = msg:getHeader("P-Asserted-Identity")

    local newPAI = string.gsub(oldPAI, "anonymous@", "+3611234567@")

    msg:modifyHeader("P-Asserted-Identity", newPAI)

    msg:addHeader("Privacy",  "ID")

  end

end

return M

Thanks in advance,

Laci

Everyone's tags (3)
1 REPLY 1
Highlighted
Cisco Employee

Re: SIP Normalization Script to replace Anonymous ID and add Privacy field

I'm not sure why you have the extra step of checking the From: header. You can just grab the existing PAI if it exists, and just gsub directly. Two things:

1. you want a new header added that looks like:  "Privacy: ID" ??

2. If there isn't a PAI, your script won't do anything.

Just be careful about cutting and pasting code from some text editors. Have you captured the headers before and after normalization?

M = {}

function M.outbound_INVITE(msg)

  local oldPAI = msg:getHeader("P-Asserted-Identity")

  if oldPAI

  then

    local newPAI = string.gsub(oldPAI, "anonymous@", "+3611234567@")

    msg:modifyHeader("P-Asserted-Identity", newPAI)

  end

  msg:addHeader("Privacy", "ID")

end

return M

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here