cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
176
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: WILLIAM HATCHER on 20-04-2012 10:36:36 AM
We are trying to write a normalization script to change the outbound
calling name.  We have several companies that are tenants as well, so
changing it just on the trunk is not an option since all tenants utilize
the same SIP trunk.  We want to make the change based on the calling
number.  Here is the script that we have come up with, but it does not
seem to be working.  Also the trace is enabled on both the script and
the trunk, but we are not seeing any trace in the sdi when we make
calls.  Any help or suggestions would be greatly appreciated.
 
Bill
 

M = {}

trace.enable()

local function modifyMessage(msg, newstring)
    local newstring1 = '"'..newstring..'"'
    trace.format("Newstring is %s", newstring)
    trace.format("Newstring1 is %s", newstring1)

    local paivalue = msg:getHeader("P-Asserted-Identity")
    local painewuri = newstring1.." "..string.match(value, "(<.+>)")
    trace.format("PAIValue is %s", paivalue)
    trace.format("PAINewuri is %s", painewuri)
    msg:modifyHeader("P-Asserted-Identity", painewuri)
    local fromvalue = msg:getHeader("From")
    local fromnewuri = newstring1.." "..string.match(value, "(<.+>)")
    trace.format("FromValue is %s", fromvalue)
    trace.format("FromNewuri is %s", fromnewuri)
    msg:modifyHeader("From", fromnewuri)
    local rpivalue = msg:getHeader("Remote-Party-ID")
    local rpinewuri = newstring1.." "..string.match(value, "(<.+>)")
    trace.format("RPIValue is %s", rpivalue)
    trace.format("RPINewuri is %s", rpinewuri)
    msg:modifyHeader("Remote-Party-ID", rpinewuri)

end
function M.outbound_ANY(msg)
    local from = msg:getHeader("From")
    if(from.find('636827...') not -1)
    then
        modifyMessage(msg, "Maritz")
    end
   if(from.find('6362262[0-5]..') not -1)
    then
        modifyMessage(msg, "Intellispend")
    end
end

return M
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links