<HTML>
<HEAD>
<TITLE>Re: [Freeswitch-users] Invalid length field in RTCP Sender Report</TITLE>
</HEAD>
<BODY>
<FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>This sort of thing should be reported via Jira ( <a href="http://jira.freeswitch.org">http://jira.freeswitch.org</a> ) will any logs, and patches attached...<BR>
<BR>
<BR>
On 9/24/12 11:00 AM, "James Bravo" <<a href="james.bravo@redmatter.com">james.bravo@redmatter.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'> Hi<BR>
<BR>
We've had a number of Yealink T22 & T28 phones with later <BR>
firmware crashing within approx 30 seconds of sending <BR>
and receiving RTP.<BR>
Yealink R&D department have narrowed it down to a<BR>
non-standard RTCP 'Sender Report' packet from FreeSWITCH.<BR>
For some packet content, the length field in these packets <BR>
does not seem to agree with the overall UDP packet size. <BR>
RFC1889 defines the length as:<BR>
"The length of this RTCP packet in 32-bit words minus one, <BR>
including the header and any padding."<BR>
For instance, below is a RTCP packet sent from FS as viewed <BR>
in Wireshark. The length field says 76 bytes but the udp packet <BR>
length is 78 bytes so the last two bytes (0x31, 0x00) are excluded<BR>
as far as the length field is concerned.<BR>
<BR>
<IMG src="cid:3431329652_17583681" ><BR>
I managed to stop the phones crashing by changing the following lines<BR>
in switch_rtp.c...<BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'> rtcp_bytes = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_senderinfo) + sr->sr_desc_ssrc.length -1 ;<BR>
rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); <BR>
</SPAN></FONT></FONT><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>...to something like...<BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'> {<BR>
switch_size_t rtcp_bytes_mod4;<BR>
rtcp_bytes = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_senderinfo) + sr->sr_desc_ssrc.length -1 ;<BR>
// Add padding and adjust length if necessary<BR>
rtcp_bytes_mod4 = rtcp_bytes % 4;<BR>
if (rtcp_bytes_mod4 > 0)<BR>
rtcp_bytes += 4 - rtcp_bytes_mod4;<BR>
rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4 - 1)); <BR>
}<BR>
</SPAN></FONT></FONT><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>although Freeswitch developers will probably find a better solution.<BR>
<BR>
Thanks in advance,<BR>
James Bravo, <BR>
Redmatter<BR>
<BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_________________________________________________________________________<BR>
Professional FreeSWITCH Consulting Services:<BR>
<a href="consulting@freeswitch.org">consulting@freeswitch.org</a><BR>
<a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><BR>
<BR>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
<a href="http://www.cudatel.com">http://www.cudatel.com</a><BR>
<BR>
Official FreeSWITCH Sites<BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
<a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><BR>
<a href="http://www.cluecon.com">http://www.cluecon.com</a><BR>
<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
</SPAN></FONT></FONT><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>-- <BR>
Ken<BR>
<FONT COLOR="#0000FF"><U><a href="http://www.FreeSWITCH.org">http://www.FreeSWITCH.org</a><BR>
<a href="http://www.ClueCon.com">http://www.ClueCon.com</a><BR>
<a href="http://www.OSTAG.org">http://www.OSTAG.org</a><BR>
</U></FONT>irc.freenode.net #freeswitch<BR>
</SPAN></FONT>
</BODY>
</HTML>