<?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: LUA script to modify privacy inbound invite in Call Control</title>
    <link>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498960#M1088</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try removing ‘\r\n’ from your formatted strings. The header functions will insert those correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Apr 2017 13:57:14 GMT</pubDate>
    <dc:creator>Mark Stover</dc:creator>
    <dc:date>2017-04-04T13:57:14Z</dc:date>
    <item>
      <title>LUA script to modify privacy inbound invite</title>
      <link>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498959#M1087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm struggling to get my LUA script to work. The RightFax server on other end does not allow SIP parameters to be altered and sends a basic invite with no privacy option. I'd like to alter my inbound invites to add P-Asserted-ID and alter From field. Here is my LUA script:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;M = {}&lt;BR /&gt;trace.enable()&lt;BR /&gt;function M.inbound_INVITE(msg)&lt;BR /&gt;--get Header Values&lt;BR /&gt;local uriString = msg:getUri("From")&lt;BR /&gt;local nuri = sipUtils.parseUri(uriString)&lt;BR /&gt;trace.format("Parse success")&lt;BR /&gt;local nUser = nuri:getUser()&lt;BR /&gt;trace.format("user is '%s'", nUser)&lt;BR /&gt;local nHost = nuri:getHost()&lt;BR /&gt;trace.format("host is '%s'", nHost)&lt;BR /&gt;--get tag from From header&lt;BR /&gt;local fromtag = msg:getHeaderValueParameter("From", "tag")&lt;BR /&gt;trace.format("tag from From is '%s'", fromtag)&lt;BR /&gt;--create new from header&lt;BR /&gt;local newFromHeader = string.format("\"Anonymous\" &amp;lt;sip:Anonymous@%s&amp;gt;;tag=%s\r\n", nHost, fromtag)&lt;BR /&gt;trace.format("new From Header is '%s'", newFromHeader)&lt;BR /&gt;msg:modifyHeader("From", newFromHeader)&lt;BR /&gt;trace.format("From Header is updated successfully")&lt;BR /&gt;--create Remote party ID string with privacy&lt;BR /&gt;local newRPartyHeader = string.format("&amp;lt;sip:%s@%s&amp;gt;;party=calling;id-type=subscriber;privacy=full;screen=yes\r\n", nUser, nHost)&lt;BR /&gt;trace.format("header string created '%s'", newRPartyHeader)&lt;BR /&gt;--Add Remote party ID (not added for now)&lt;BR /&gt;--msg:addHeader("Remote-Party-ID", newRPartyHeader)&lt;BR /&gt;local newPAIHeader = string.format("\"RightFax\" &amp;lt;sip:%s@%s&amp;gt;\r\n", nUser, nHost)&lt;BR /&gt;trace.format("PAI header string created '%s'", newPAIHeader)&lt;BR /&gt;msg:addHeader("P-Asserted-Identity", newPAIHeader)&lt;BR /&gt;local ids = string.format("id\r\n")&lt;BR /&gt;trace.format("Adding ID")&lt;BR /&gt;msg:addHeader("Privacy", ids)&lt;BR /&gt;trace.format("All Done\r\n")&lt;BR /&gt;end&lt;BR /&gt;return M&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Original Invite from RightFax:&lt;/P&gt;&lt;P&gt;INVITE sip:0385410508@172.22.5.31 SIP/2.0&lt;BR /&gt;From: Rightfax Dev &amp;lt;sip:0397277670@172.22.31.185&amp;gt;;tag=8be2690-b91f16ac-13c4-55013-312cf8-26efef6b-312cf8&lt;BR /&gt;To: &amp;lt;sip:0385410508@172.22.5.31&amp;gt;&lt;BR /&gt;Call-ID: 776a928-b91f16ac-13c4-55013-312cf8-70e1aefd-312cf8&lt;BR /&gt;CSeq: 1 INVITE&lt;BR /&gt;Via: SIP/2.0/UDP 172.22.31.185:5060;branch=z9hG4bK-312cf8-c017a9f1-27c0c9e1&lt;BR /&gt;Supported: 100rel&lt;BR /&gt;Max-Forwards: 70&lt;BR /&gt;User-Agent: Brktsip/6.5.2B5 (Dialogic)&lt;BR /&gt;Contact: &amp;lt;sip:172.22.31.185:5060&amp;gt;&lt;BR /&gt;Content-Type: application/sdp&lt;BR /&gt;Content-Length: 150&lt;/P&gt;&lt;P&gt;v=0&lt;BR /&gt;o=- 2212556890 0340060000 IN IP4 172.22.31.185&lt;BR /&gt;s=no_session_name&lt;BR /&gt;t=0 0&lt;BR /&gt;m=audio 56300 RTP/AVP 0&lt;BR /&gt;c=IN IP4 172.22.31.185&lt;BR /&gt;a=rtpmap:0 pcmu/8000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Altered Invite from RightFax:&lt;/P&gt;&lt;P&gt;INVITE sip:0385410508@172.22.5.31 SIP/2.0&lt;BR /&gt;From: "Anonymous" &amp;lt;sip:Anonymous@172.22.31.185&amp;gt;;tag=8be2690-b91f16ac-13c4-55013-312cf8-26efef6b-312cf8&lt;/P&gt;&lt;P&gt;P-Asserted-Identity: "RightFax" &amp;lt;sip:0397277670@172.22.31.185&amp;gt;&lt;/P&gt;&lt;P&gt;Supported: 100rel&lt;BR /&gt;Content-Length: 150&lt;BR /&gt;User-Agent: Brktsip/6.5.2B5 (Dialogic)&lt;BR /&gt;Privacy: id&lt;/P&gt;&lt;P&gt;To: &amp;lt;sip:0385410508@172.22.5.31&amp;gt;&lt;BR /&gt;Contact: &amp;lt;sip:172.22.31.185:5060&amp;gt;&lt;BR /&gt;Content-Type: application/sdp&lt;BR /&gt;Call-ID: 776a928-b91f16ac-13c4-55013-312cf8-70e1aefd-312cf8&lt;BR /&gt;CSeq: 1 INVITE&lt;BR /&gt;Via: SIP/2.0/UDP 172.22.31.185:5060;branch=z9hG4bK-312cf8-c017a9f1-27c0c9e1&lt;BR /&gt;Max-Forwards: 70&lt;/P&gt;&lt;P&gt;v=0&lt;BR /&gt;o=- 2212556890 0340060000 IN IP4 172.22.31.185&lt;BR /&gt;s=no_session_name&lt;BR /&gt;t=0 0&lt;BR /&gt;m=audio 56300 RTP/AVP 0&lt;BR /&gt;c=IN IP4 172.22.31.185&lt;BR /&gt;a=rtpmap:0 pcmu/8000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;SIP/2.0 400 Bad Request - 'Malformed/Missing FROM: field'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2017 01:19:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498959#M1087</guid>
      <dc:creator>Gaurav Purohit</dc:creator>
      <dc:date>2017-04-04T01:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: LUA script to modify privacy inbound invite</title>
      <link>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498960#M1088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try removing ‘\r\n’ from your formatted strings. The header functions will insert those correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2017 13:57:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498960#M1088</guid>
      <dc:creator>Mark Stover</dc:creator>
      <dc:date>2017-04-04T13:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: LUA script to modify privacy inbound invite</title>
      <link>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498961#M1089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks heaps!&lt;/P&gt;&lt;P&gt;Can't believe I was so close.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2017 02:56:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/lua-script-to-modify-privacy-inbound-invite/m-p/3498961#M1089</guid>
      <dc:creator>Gaurav Purohit</dc:creator>
      <dc:date>2017-04-05T02:56:29Z</dc:date>
    </item>
  </channel>
</rss>

