<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SIP Normalization Script to replace Anonymous ID and add Privacy field in Call Control</title>
    <link>https://community.cisco.com/t5/call-control/sip-normalization-script-to-replace-anonymous-id-and-add-privacy/m-p/3510890#M1208</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you have the extra step of checking the From: header. You can just grab the existing PAI if it exists, and just gsub directly. Two things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. you want a new header added that looks like:&amp;nbsp; "Privacy: ID" ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If there isn't a PAI, your script won't do anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just be careful about cutting and pasting code from some text editors. Have you captured the headers before and after normalization?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M = {}&lt;/P&gt;&lt;P&gt;function M.outbound_INVITE(msg)&lt;/P&gt;&lt;P&gt;&amp;nbsp; local oldPAI = msg:getHeader("P-Asserted-Identity")&lt;/P&gt;&lt;P&gt;&amp;nbsp; if oldPAI&lt;/P&gt;&lt;P&gt;&amp;nbsp; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; local newPAI = string.gsub(oldPAI, "anonymous@", "+3611234567@")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg:modifyHeader("P-Asserted-Identity", newPAI)&lt;/P&gt;&lt;P&gt;&amp;nbsp; end&lt;/P&gt;&lt;P&gt;&amp;nbsp; msg:addHeader("Privacy", "ID")&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;return M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Sep 2017 17:11:42 GMT</pubDate>
    <dc:creator>Mark Stover</dc:creator>
    <dc:date>2017-09-07T17:11:42Z</dc:date>
    <item>
      <title>SIP Normalization Script to replace Anonymous ID and add Privacy field</title>
      <link>https://community.cisco.com/t5/call-control/sip-normalization-script-to-replace-anonymous-id-and-add-privacy/m-p/3510889#M1207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Colleagues,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After a CUCM implementation I have faced with a problem. The anonymous calls are not forwarded and the provider informed me that the outbound INVITE has to met for two requirements:&lt;/P&gt;&lt;P&gt;- The INVITE's PAI has to contain a supported phone number instead of anonymous ID&lt;/P&gt;&lt;P&gt;- The INVITE has to contain Privacy:ID line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote a LUA script and I have added it to the SIP trunk, but it does not work, please be so kind to help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;M = {}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;function M.outbound_INVITE(msg)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; local header = msg:getHeader("From")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if string.find(header, "anonymous")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; then&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; local oldPAI = msg:getHeader("P-Asserted-Identity")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; local newPAI = string.gsub(oldPAI, "anonymous@", "+3611234567@")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg:modifyHeader("P-Asserted-Identity", newPAI)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg:addHeader("Privacy",&amp;nbsp; "ID")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; end&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;end&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;return M&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Laci&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Aug 2017 08:45:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/sip-normalization-script-to-replace-anonymous-id-and-add-privacy/m-p/3510889#M1207</guid>
      <dc:creator>Laszlo Olah</dc:creator>
      <dc:date>2017-08-26T08:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: SIP Normalization Script to replace Anonymous ID and add Privacy field</title>
      <link>https://community.cisco.com/t5/call-control/sip-normalization-script-to-replace-anonymous-id-and-add-privacy/m-p/3510890#M1208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you have the extra step of checking the From: header. You can just grab the existing PAI if it exists, and just gsub directly. Two things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. you want a new header added that looks like:&amp;nbsp; "Privacy: ID" ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If there isn't a PAI, your script won't do anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just be careful about cutting and pasting code from some text editors. Have you captured the headers before and after normalization?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M = {}&lt;/P&gt;&lt;P&gt;function M.outbound_INVITE(msg)&lt;/P&gt;&lt;P&gt;&amp;nbsp; local oldPAI = msg:getHeader("P-Asserted-Identity")&lt;/P&gt;&lt;P&gt;&amp;nbsp; if oldPAI&lt;/P&gt;&lt;P&gt;&amp;nbsp; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; local newPAI = string.gsub(oldPAI, "anonymous@", "+3611234567@")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg:modifyHeader("P-Asserted-Identity", newPAI)&lt;/P&gt;&lt;P&gt;&amp;nbsp; end&lt;/P&gt;&lt;P&gt;&amp;nbsp; msg:addHeader("Privacy", "ID")&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;return M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 17:11:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/sip-normalization-script-to-replace-anonymous-id-and-add-privacy/m-p/3510890#M1208</guid>
      <dc:creator>Mark Stover</dc:creator>
      <dc:date>2017-09-07T17:11:42Z</dc:date>
    </item>
  </channel>
</rss>

