Showing results for 
Search instead for 
Did you mean: 
Walkthrough Wednesdays

SIP Normalization on Recording

This document was generated from CDN thread

Created by: Ramonito Escarro on 08-05-2013 11:52:04 PM
Hi All,  
We currently have an issue on our recording platform having parsing error and not recording SIP calls with farendaddr=?????? (with UNKNOWN/PRIVATE calling ID). Would like to know how we can do about changing the whole address with ?????? to anonymous or 000000 since the recording platform only can support
paramchar = param-unreserved / unreserved / escaped
param-unreserved = "[" / "]" / "/" / ":" / "&" / "+" / "$"
unreserved = alphanum / mark
mark = "-" / "_" / "." / "!" / "˜" / "*" / "’"/ "(" / ")"
Below is a sample SIP Invite message that causes parsing error.
sip:11120006678@ SIP/2.0
Via: SIP/2.0/TCP;branch=z9hG4bK432b4772fca8d3
From: "Jeffrey Lim"<sip:+6566783008@;x-farend;x-refci=54684567;x-nearenddevice=SEPD824BD26AEA2;x-farendrefci=54684566;x-farenddevice=;x-farendaddr=???????>;tag=57345144~cd085c1c-4462-4066-8252-25989229b16e-54684584

Any form of help would be great.  
Regards, Ramon

Subject: RE: SIP Normalization on Recording
Replied by: Mark Stover on 09-05-2013 06:33:20 AM
I have to start off by saying that I've never tried to use SIP normalization on a recording trunk, but I don't see any reason why it wouldn't work. To manipulate the header, you can start by determining quickly if the header for this message needs to be manipulated or not by using:
local fromtag = msg:getHeaderUriParameter("From", "x-farendaddr")
You can then retrieve the address from the header and check to see if it is ??????. If it is, you'll need to use 'modifyHeader' to change it's value; you can't update an existing Header URI Parameter (or remove & add it). That means you'll have to get the entire 'From' header by doing a:
local fromheader = msg:getHeader("From")
manipulate the string by substituting 'x-farendaddr=??????' with 'x-farendaddr=anonymous', then modify the header with the updated string:
msg:modifyHeader("From", fromheader)
Content for Community-Ad

This widget could not be displayed.