<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Masking the Calling Name based on Calling number</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=5493549" />
  <subtitle>Masking the Calling Name based on Calling number</subtitle>
  <id>http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=5493549</id>
  <updated>2013-05-22T05:43:44Z</updated>
  <dc:date>2013-05-22T05:43:44Z</dc:date>
  <entry>
    <title>Masking the Calling Name based on Calling number</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5493548" />
    <author>
      <name>WILLIAM HATCHER</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5493548</id>
    <updated>2012-04-23T16:29:03Z</updated>
    <published>2012-04-20T15:36:36Z</published>
    <summary type="html">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, "(&lt;.+&gt;)")
    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, "(&lt;.+&gt;)")
    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, "(&lt;.+&gt;)")
    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</summary>
    <dc:creator>WILLIAM HATCHER</dc:creator>
    <dc:date>2012-04-20T15:36:36Z</dc:date>
  </entry>
</feed>

