WILLIAM HATCHER | 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 |