[asterisk-commits] russell: trunk r71557 - in /trunk/main: rtp.c say.c sched.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 25 08:42:52 CDT 2007


Author: russell
Date: Mon Jun 25 08:42:51 2007
New Revision: 71557

URL: http://svn.digium.com/view/asterisk?view=rev&rev=71557
Log:
Convert so more logging to ast_debug (issue #10045, dimas)

Modified:
    trunk/main/rtp.c
    trunk/main/say.c
    trunk/main/sched.c

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=71557&r1=71556&r2=71557
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Mon Jun 25 08:42:51 2007
@@ -730,7 +730,7 @@
 	event = data[3] & 0x1f;
 
 	if (option_debug > 2 || rtpdebug)
-		ast_log(LOG_DEBUG, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
+		ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
 	if (event < 10) {
 		resp = '0' + event;
 	} else if (event < 11) {
@@ -790,7 +790,7 @@
 
 	/* Print out debug if turned on */
 	if (rtpdebug || option_debug > 2)
-		ast_log(LOG_DEBUG, "- RTP 2833 Event: %08x (len = %d)\n", event, len);
+		ast_debug(0, "- RTP 2833 Event: %08x (len = %d)\n", event, len);
 
 	/* Figure out what digit was pressed */
 	if (event < 10) {
@@ -843,7 +843,7 @@
 	   totally help us out becuase we don't have an engine to keep it going and we are not
 	   guaranteed to have it every 20ms or anything */
 	if (rtpdebug)
-		ast_log(LOG_DEBUG, "- RTP 3389 Comfort noise event: Level %d (len = %d)\n", rtp->lastrxformat, len);
+		ast_debug(0, "- RTP 3389 Comfort noise event: Level %d (len = %d)\n", rtp->lastrxformat, len);
 
 	if (!(ast_test_flag(rtp, FLAG_3389_WARNING))) {
 		ast_log(LOG_NOTICE, "Comfort noise support incomplete in Asterisk (RFC 3389). Please turn off on client if possible. Client IP: %s\n",
@@ -933,7 +933,7 @@
 		    (rtp->rtcp->them.sin_port != sin.sin_port)) {
 			memcpy(&rtp->rtcp->them, &sin, sizeof(rtp->rtcp->them));
 			if (option_debug || rtpdebug)
-				ast_log(LOG_DEBUG, "RTCP NAT: Got RTCP from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
+				ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
 		}
 	}
 
@@ -1198,7 +1198,7 @@
 			ast_debug(1, "RTP Transmission error of packet to %s:%d: %s\n", ast_inet_ntoa(bridged->them.sin_addr), ntohs(bridged->them.sin_port), strerror(errno));
 		} else if (((ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(bridged, FLAG_NAT_INACTIVE_NOWARN)) {
 			if (option_debug || rtpdebug)
-				ast_log(LOG_DEBUG, "RTP NAT: Can't write RTP to private address %s:%d, waiting for other end to send audio...\n", ast_inet_ntoa(bridged->them.sin_addr), ntohs(bridged->them.sin_port));
+				ast_debug(0, "RTP NAT: Can't write RTP to private address %s:%d, waiting for other end to send audio...\n", ast_inet_ntoa(bridged->them.sin_addr), ntohs(bridged->them.sin_port));
 			ast_set_flag(bridged, FLAG_NAT_INACTIVE_NOWARN);
 		}
 		return 0;
@@ -1284,7 +1284,7 @@
 			rtp->rxseqno = 0;
 			ast_set_flag(rtp, FLAG_NAT_ACTIVE);
 			if (option_debug || rtpdebug)
-				ast_log(LOG_DEBUG, "RTP NAT: Got audio from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
+				ast_debug(0, "RTP NAT: Got audio from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
 		}
 	}
 
@@ -1306,7 +1306,7 @@
 	
 	if (!mark && rtp->rxssrc && rtp->rxssrc != ssrc) {
 		if (option_debug || rtpdebug)
-			ast_log(LOG_DEBUG, "Forcing Marker bit, because SSRC has changed\n");
+			ast_debug(0, "Forcing Marker bit, because SSRC has changed\n");
 		mark = 1;
 	}
 
@@ -1330,9 +1330,9 @@
 			int profile;
 			profile = (ntohl(rtpheader[3]) & 0xffff0000) >> 16;
 			if (profile == 0x505a)
-				ast_log(LOG_DEBUG, "Found Zfone extension in RTP stream - zrtp - not supported.\n");
+				ast_debug(1, "Found Zfone extension in RTP stream - zrtp - not supported.\n");
 			else
-				ast_log(LOG_DEBUG, "Found unknown RTP Extensions %x\n", profile);
+				ast_debug(1, "Found unknown RTP Extensions %x\n", profile);
 		}
 	}
 
@@ -2833,7 +2833,7 @@
 			} else if (((ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(rtp, FLAG_NAT_INACTIVE_NOWARN)) {
 				/* Only give this error message once if we are not RTP debugging */
 				if (option_debug || rtpdebug)
-					ast_log(LOG_DEBUG, "RTP NAT: Can't write RTP to private address %s:%d, waiting for other end to send audio...\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
+					ast_debug(0, "RTP NAT: Can't write RTP to private address %s:%d, waiting for other end to send audio...\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
 				ast_set_flag(rtp, FLAG_NAT_INACTIVE_NOWARN);
 			}
 		} else {
@@ -3204,7 +3204,7 @@
 		rtp->rxseqno = 0;
 		ast_set_flag(rtp, FLAG_NAT_ACTIVE);
 		if (option_debug || rtpdebug)
-			ast_log(LOG_DEBUG, "P2P RTP NAT: Got audio from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
+			ast_debug(0, "P2P RTP NAT: Got audio from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
 	}
 
 	/* Write directly out to other RTP stream if bridged */
@@ -3566,8 +3566,7 @@
 		fmt0 = ast_codec_pref_getsize(&p0->pref, c0->rawreadformat);
 		fmt1 = ast_codec_pref_getsize(&p1->pref, c1->rawreadformat);
 		if (fmt0.cur_ms != fmt1.cur_ms) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Cannot packet2packet bridge - packetization settings prevent it\n");
+			ast_debug(1, "Cannot packet2packet bridge - packetization settings prevent it\n");
 			ast_channel_unlock(c0);
 			ast_channel_unlock(c1);
 			return AST_BRIDGE_FAILED_NOWARN;

Modified: trunk/main/say.c
URL: http://svn.digium.com/view/asterisk/trunk/main/say.c?view=diff&rev=71557&r1=71556&r2=71557
==============================================================================
--- trunk/main/say.c (original)
+++ trunk/main/say.c Mon Jun 25 08:42:51 2007
@@ -1381,7 +1381,7 @@
 						num = num % 1000000;
 						snprintf(fn, sizeof(fn), "digits/million");
 					} else {
-						ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+						ast_debug(1, "Number '%d' is too big for me\n", num);
 						res = -1;
 					}
 				}
@@ -6305,7 +6305,7 @@
 	int res;
 	char fn[256] = "";
 
-	/* ast_log(LOG_DEBUG, "\n\n Saying number female %s %d \n\n",lang, num); */
+	/* ast_debug(1, "\n\n Saying number female %s %d \n\n",lang, num); */
 	if (num < 5) {
 		snprintf(fn, sizeof(fn), "digits/female-%d", num);
 		res = wait_file(chan, ints, fn, lang);

Modified: trunk/main/sched.c
URL: http://svn.digium.com/view/asterisk/trunk/main/sched.c?view=diff&rev=71557&r1=71556&r2=71557
==============================================================================
--- trunk/main/sched.c (original)
+++ trunk/main/sched.c Mon Jun 25 08:42:51 2007
@@ -196,7 +196,7 @@
 {
 	struct timeval now = ast_tvnow();
 
-	/*ast_log(LOG_DEBUG, "TV -> %lu,%lu\n", tv->tv_sec, tv->tv_usec);*/
+	/*ast_debug(1, "TV -> %lu,%lu\n", tv->tv_sec, tv->tv_usec);*/
 	if (ast_tvzero(*tv))	/* not supplied, default to now */
 		*tv = now;
 	*tv = ast_tvadd(*tv, ast_samp2tv(when, 1000));
@@ -301,22 +301,20 @@
 	ast_debug(1, "Asterisk Schedule Dump (%d in Q, %d Total)\n", con->schedcnt, con->eventcnt - 1);
 #endif
 
-	if (option_debug) {
-	ast_log(LOG_DEBUG, "=============================================================\n");
-	ast_log(LOG_DEBUG, "|ID    Callback          Data              Time  (sec:ms)   |\n");
-	ast_log(LOG_DEBUG, "+-----+-----------------+-----------------+-----------------+\n");
-		AST_LIST_TRAVERSE(&con->schedq, q, list) {
-			struct timeval delta = ast_tvsub(q->when, tv);
-
-			ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n", 
-				q->id,
-				q->callback,
-				q->data,
-				delta.tv_sec,
-				(long int)delta.tv_usec);
-		}
-		ast_log(LOG_DEBUG, "=============================================================\n");
-	}
+	ast_debug(1, "=============================================================\n");
+	ast_debug(1, "|ID    Callback          Data              Time  (sec:ms)   |\n");
+	ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n");
+	AST_LIST_TRAVERSE(&con->schedq, q, list) {
+		struct timeval delta = ast_tvsub(q->when, tv);
+
+		ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n", 
+			q->id,
+			q->callback,
+			q->data,
+			delta.tv_sec,
+			(long int)delta.tv_usec);
+	}
+	ast_debug(1, "=============================================================\n");
 }
 
 /*! \brief




More information about the asterisk-commits mailing list