<?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 SIP Normalization Script Assistance in Call Control</title>
    <link>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4408282#M3088</link>
    <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I hope someone can possible assist me here ,we have a CUCM version 11.5 that has a Trunk to a Genesys server ,problem is that randomly the Genesys server sends a SIP Invite with a malformed x-farenaddr in the From field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an excerpt of what it looks like :&lt;/P&gt;&lt;P&gt;SIP From URI parameter: x-farendaddr=%23msml=T9LOJ5CEUL3MH2678AI75CUTIG0008NB&lt;/P&gt;&lt;P&gt;I am looking for a normalization script that will match all calls that have the x-farendaddr as "=%23msml=" and replace that with "x-farendaddr=unknown&lt;/P&gt;&lt;P&gt;I have the following which i have tried to construct using multiple sources ,but i might be completely missing it here ,any assistance will be greatly appreciated :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M={}&lt;/P&gt;&lt;P&gt;function M.inbound_INVITE(msg)&lt;/P&gt;&lt;P&gt;local from = msg:getHeader("From") --Get FROM Header&lt;/P&gt;&lt;P&gt;local b = string.gsub(from, "x-farendaddr=%23msml=*", "x-farendaddr=unknown") --New FROM Header&lt;/P&gt;&lt;P&gt;msg:modifyHeader("From", b) --Replace FROM Header&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;return M&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 13:03:46 GMT</pubDate>
    <dc:creator>rynard.coetzee</dc:creator>
    <dc:date>2021-05-25T13:03:46Z</dc:date>
    <item>
      <title>SIP Normalization Script Assistance</title>
      <link>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4408282#M3088</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I hope someone can possible assist me here ,we have a CUCM version 11.5 that has a Trunk to a Genesys server ,problem is that randomly the Genesys server sends a SIP Invite with a malformed x-farenaddr in the From field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an excerpt of what it looks like :&lt;/P&gt;&lt;P&gt;SIP From URI parameter: x-farendaddr=%23msml=T9LOJ5CEUL3MH2678AI75CUTIG0008NB&lt;/P&gt;&lt;P&gt;I am looking for a normalization script that will match all calls that have the x-farendaddr as "=%23msml=" and replace that with "x-farendaddr=unknown&lt;/P&gt;&lt;P&gt;I have the following which i have tried to construct using multiple sources ,but i might be completely missing it here ,any assistance will be greatly appreciated :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M={}&lt;/P&gt;&lt;P&gt;function M.inbound_INVITE(msg)&lt;/P&gt;&lt;P&gt;local from = msg:getHeader("From") --Get FROM Header&lt;/P&gt;&lt;P&gt;local b = string.gsub(from, "x-farendaddr=%23msml=*", "x-farendaddr=unknown") --New FROM Header&lt;/P&gt;&lt;P&gt;msg:modifyHeader("From", b) --Replace FROM Header&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;return M&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 13:03:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4408282#M3088</guid>
      <dc:creator>rynard.coetzee</dc:creator>
      <dc:date>2021-05-25T13:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: SIP Normalization Script Assistance</title>
      <link>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4410371#M3092</link>
      <description>&lt;P&gt;Rynard,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if string.match(from,'x-farendaddr=%%23msml=') then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from=string.gsub(from,"=.+=.+","=unknown")&lt;BR /&gt;end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-david&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 23:09:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4410371#M3092</guid>
      <dc:creator>davidn#</dc:creator>
      <dc:date>2021-05-28T23:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: SIP Normalization Script Assistance</title>
      <link>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4410385#M3093</link>
      <description>&lt;P&gt;Complete code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;M={}&lt;/P&gt;
&lt;P&gt;function M.inbound_INVITE(msg)&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;local from = msg:getHeader("From") --Get FROM Header&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;if string.match(from,'x-farendaddr=%%23msml=') then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from=string.gsub(from,"=.+=.+","=unknown")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg:modifyHeader("From", from) --Replace FROM Header&lt;BR /&gt;end&lt;/P&gt;
&lt;P&gt;end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;return M&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 06:50:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4410385#M3093</guid>
      <dc:creator>davidn#</dc:creator>
      <dc:date>2021-05-29T06:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: SIP Normalization Script Assistance</title>
      <link>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4410417#M3094</link>
      <description>&lt;P&gt;Thank you David , that looks like it will work ,we are currently testing with the following script which our Recording guys wrote :&lt;/P&gt;&lt;P&gt;M = {}&lt;BR /&gt;trace.disable()&lt;BR /&gt;-- trace.enable()&lt;/P&gt;&lt;P&gt;-- Remove potentially invalid x-farendaddr parameter from From address&lt;BR /&gt;-- Reason: sometimes the value contains a "=" (not valid), which causes DataVoice recorder to ignore the INVITE&lt;BR /&gt;-- ASSUME: x-farendaddr a parameter INSIDE address i.e. somewhere before "&amp;gt;"&lt;BR /&gt;-- Cater for situation where x-farendaddr is the last parameter AND where it is not.&lt;/P&gt;&lt;P&gt;-- To see tracing output - SSH to CUCM: file tail activelog /cm/trace/ccm/sdl recent regexp "SIPLua"&lt;/P&gt;&lt;P&gt;function M.outbound_INVITE(msg)&lt;/P&gt;&lt;P&gt;local fromHdr = msg:getHeader("From")&lt;/P&gt;&lt;P&gt;trace.format("DataVoice | old From: %s", fromHdr)&lt;/P&gt;&lt;P&gt;local pos1 = string.find(fromHdr, "x-farendaddr=", 1, true)&lt;BR /&gt;local posOfNextGT = string.find(fromHdr, "&amp;gt;", pos1, true)&lt;BR /&gt;local posOfNextSemicolon = string.find(fromHdr, ";", pos1, true)&lt;BR /&gt;local pos2 = nil&lt;/P&gt;&lt;P&gt;if posOfNextGT ~= nil then&lt;BR /&gt;if (posOfNextSemicolon == nil) or (posOfNextGT &amp;lt; posOfNextSemicolon) then&lt;BR /&gt;-- last parameter&lt;BR /&gt;pos2 = posOfNextGT&lt;BR /&gt;else&lt;BR /&gt;-- not the last parameter&lt;BR /&gt;pos2 = posOfNextSemicolon&lt;BR /&gt;end&lt;BR /&gt;local newHdr = string.sub(fromHdr, 1, pos1 - 1).."x-farendaddr=Removed_for_DV"..string.sub(fromHdr, pos2)&lt;BR /&gt;trace.format("DataVoice | new From: %s", newHdr)&lt;/P&gt;&lt;P&gt;msg:modifyHeader("From", newHdr)&lt;BR /&gt;else&lt;BR /&gt;trace.format("DataVoice | unexpected - did not find a '&amp;gt;'")&lt;BR /&gt;end&lt;/P&gt;&lt;P&gt;end&lt;BR /&gt;return M&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 06:03:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/call-control/sip-normalization-script-assistance/m-p/4410417#M3094</guid>
      <dc:creator>rynard.coetzee</dc:creator>
      <dc:date>2021-05-29T06:03:48Z</dc:date>
    </item>
  </channel>
</rss>

