cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1393
Views
5
Helpful
1
Replies

Cisco CUCM: SIP Normalization Script

IamSamSaul
Level 1
Level 1

Hi there,

 

I want to covert a SIP Profile to SIP Normalization Script using LUA scripting. 

 

The SIP Profile is below:

 

!
voice class sip-profiles 10
response ANY sip-header P-Asserted-Identity modify "<sip:(.*)@.*>" "<sip:1234@name.local>"
request ANY sip-header P-Asserted-Identity modify "<sip:(.*)@.*>" "<sip:1234@name.local>"
!

Any help will be greatly appreciated. 

 

Thanks & Regards,

 

Sam

1 Accepted Solution

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

The first thing I should say is, that I didn't validate this.  So, please give it a try and let me know if it does or doesn't work.

Second, you're using the grouping with parenthesis in there, but for no reason, so I omitted them.

Third, I'm making the assumption that you are applying this in the outbound direction.

M = {}

local function normalize_pai(msg)
    local old_pai = msg:getHeader("P-Asserted-Identity")
    local new_pai = string.gsub(old_pai, "<sip:.+>", "<sip:1234@name.local>")
    msg:modifyHeader("P-Asserted-Identity", new_pai)
end

M.outbound_ANY = normalize_pai
M.outbound_ANY_ANY = normalize_pai

return M

Last, I should mention that there is a method called applyNumberMask, which allows you to manipulate the user portion of the URI just like how CUCM does Transformation masks.  This might be useful if you didn't want to set every call to the same PAI value, but rather, transform it.

View solution in original post

1 Reply 1

Anthony Holloway
Cisco Employee
Cisco Employee

The first thing I should say is, that I didn't validate this.  So, please give it a try and let me know if it does or doesn't work.

Second, you're using the grouping with parenthesis in there, but for no reason, so I omitted them.

Third, I'm making the assumption that you are applying this in the outbound direction.

M = {}

local function normalize_pai(msg)
    local old_pai = msg:getHeader("P-Asserted-Identity")
    local new_pai = string.gsub(old_pai, "<sip:.+>", "<sip:1234@name.local>")
    msg:modifyHeader("P-Asserted-Identity", new_pai)
end

M.outbound_ANY = normalize_pai
M.outbound_ANY_ANY = normalize_pai

return M

Last, I should mention that there is a method called applyNumberMask, which allows you to manipulate the user portion of the URI just like how CUCM does Transformation masks.  This might be useful if you didn't want to set every call to the same PAI value, but rather, transform it.