cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
564
Views
0
Helpful
2
Replies

Passthrough CallerID as paramater to SIP normalisation script

Signups
Level 1
Level 1

Hi, I have been using a sip normalization script I found on this website to modify the from header

M={}

function M.outbound_INVITE(msg)

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

  local b = string.gsub(from, "<sip:.+@", "<sip:xxxxxxxxxx@")  --New FROM Header

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

end

return M

however ive been trying to modify it to allow the caller ID to be passed through from the CUCM trunk configuration interface

I found an example of this online but the value being changed is not the one I'm trying to change

M = {}

local ccaid = scriptParameters.getValue("CCA-ID")

function M.outbound_INVITE(msg)

    if ccaid

    then

        local contact = msg:getHeader("Contact")

        local replace = string.format("%s;CCA-ID=%s>", "%1", ccaid)

        contact = string.gsub(contact, "(<sip:.*)>", replace)

        msg:modifyHeader("Contact", contact)

    end

end

return M

Can anyone suggest how to modify this so that the x's in the from header are replaced by the value of CCA-ID ?

2 Replies 2

Signups
Level 1
Level 1

Here is the solution another admin suggested

M={}

local callingnumber= scriptParameters.getValue("callingnumber")

function M.outbound_INVITE(msg)

if callingnumber

then

local replace = "<sip:" .. callingnumber .. "@"

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

local b = string.gsub(from, "<sip:.+@", replace)  --New FROM Header

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

end

end

return M

Tested and working hope this helps someone else in the future

Nice tip, thanks for sharing