[asterisk-commits] rmudgett: branch 11 r372327 - /branches/11/res/res_rtp_asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 5 12:33:14 CDT 2012


Author: rmudgett
Date: Wed Sep  5 12:33:11 2012
New Revision: 372327

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=372327
Log:
Fix RTP/RTCP read error message confusion.

The RTP/RTCP read error message can report "fail: success" when the
read failure is because of an ICE failure.

* Changed __rtp_recvfrom() to generate a PJ ICE message when ICE fails.

* Changed RTP/RTCP read error message to indicate an unspecified error
when errno is zero.

(closes issue ASTERISK-20288)
Reported by: Joern Krebs
Patches:
      jira_asterisk_20288_err_msg.patch (license #5621) patch uploaded by rmudgett (modified)

Modified:
    branches/11/res/res_rtp_asterisk.c

Modified: branches/11/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_rtp_asterisk.c?view=diff&rev=372327&r1=372326&r2=372327
==============================================================================
--- branches/11/res/res_rtp_asterisk.c (original)
+++ branches/11/res/res_rtp_asterisk.c Wed Sep  5 12:33:11 2012
@@ -882,13 +882,21 @@
 	if (rtp->ice) {
 		pj_str_t combined = pj_str(ast_sockaddr_stringify(sa));
 		pj_sockaddr address;
+		pj_status_t status;
 
 		pj_thread_register_check();
 
 		pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &combined, &address);
 
-		if (pj_ice_sess_on_rx_pkt(rtp->ice, rtcp ? COMPONENT_RTCP : COMPONENT_RTP, rtcp ? TRANSPORT_SOCKET_RTCP : TRANSPORT_SOCKET_RTP,
-					  buf, len, &address, pj_sockaddr_get_len(&address)) != PJ_SUCCESS) {
+		status = pj_ice_sess_on_rx_pkt(rtp->ice, rtcp ? COMPONENT_RTCP : COMPONENT_RTP,
+			rtcp ? TRANSPORT_SOCKET_RTCP : TRANSPORT_SOCKET_RTP, buf, len, &address,
+			pj_sockaddr_get_len(&address));
+		if (status != PJ_SUCCESS) {
+			char buf[100];
+
+			pj_strerror(status, buf, sizeof(buf));
+			ast_log(LOG_WARNING, "PJ ICE Rx error status code: %d '%s'.\n",
+				(int) status, buf);
 			return -1;
 		}
 		if (!rtp->passthrough) {
@@ -2482,7 +2490,8 @@
 				0, &addr)) < 0) {
 		ast_assert(errno != EBADF);
 		if (errno != EAGAIN) {
-			ast_log(LOG_WARNING, "RTCP Read error: %s.  Hanging up.\n", strerror(errno));
+			ast_log(LOG_WARNING, "RTCP Read error: %s.  Hanging up.\n",
+				(errno) ? strerror(errno) : "Unspecified");
 			return NULL;
 		}
 		return &ast_null_frame;
@@ -2876,7 +2885,8 @@
 				&addr)) < 0) {
 		ast_assert(errno != EBADF);
 		if (errno != EAGAIN) {
-			ast_log(LOG_WARNING, "RTP Read error: %s. Hanging up.\n", strerror(errno));
+			ast_log(LOG_WARNING, "RTP Read error: %s.  Hanging up.\n",
+				(errno) ? strerror(errno) : "Unspecified");
 			return NULL;
 		}
 		return &ast_null_frame;




More information about the asterisk-commits mailing list