[Asterisk-cvs] asterisk/channels chan_zap.c,1.470,1.471

mattf at lists.digium.com mattf at lists.digium.com
Mon Jul 11 15:14:46 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv10626/channels

Modified Files:
	chan_zap.c 
Log Message:
Make PRI debug easier to read if you're not using NFAS


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.470
retrieving revision 1.471
diff -u -d -r1.470 -r1.471
--- chan_zap.c	10 Jul 2005 23:49:57 -0000	1.470
+++ chan_zap.c	11 Jul 2005 19:23:02 -0000	1.471
@@ -7525,23 +7525,29 @@
 {
 	int x, y;
 	int dchan = -1, span = -1;
+	int dchancount = 0;
 
 	if (pri) {
 		for (x = 0; x < NUM_SPANS; x++) {
 			for (y = 0; y < NUM_DCHANS; y++) {
-				if (pris[x].dchans[y] == pri) {
+				if (pris[x].dchans[y])
+					dchancount++;
+
+				if (pris[x].dchans[y] == pri)
 					dchan = y;
-					break;
-				}
 			}
 			if (dchan >= 0) {
 				span = x;
 				break;
 			}
+			dchancount = 0;
 		}
-		if ((dchan >= 0) && (span >= 0))
-			ast_verbose("[Span %d D-Channel %d]%s", span, dchan, s);
-		else
+		if ((dchan >= 0) && (span >= 0)) {
+			if (dchancount > 1)
+				ast_verbose("[Span %d D-Channel %d]%s", span, dchan, s);
+			else
+				ast_verbose("%s", s);
+		} else
 			ast_verbose("PRI debug error: could not find pri associated it with debug message output\n");
 	} else
 		ast_verbose("%s", s);
@@ -7549,7 +7555,7 @@
 	ast_mutex_lock(&pridebugfdlock);
 
 	if (pridebugfd >= 0)
-		write (pridebugfd, s, strlen(s));
+		write(pridebugfd, s, strlen(s));
 
 	ast_mutex_unlock(&pridebugfdlock);
 }
@@ -7558,23 +7564,29 @@
 {
 	int x, y;
 	int dchan = -1, span = -1;
+	int dchancount = 0;
 
 	if (pri) {
 		for (x = 0; x < NUM_SPANS; x++) {
 			for (y = 0; y < NUM_DCHANS; y++) {
-				if (pris[x].dchans[y] == pri) {
+				if (pris[x].dchans[y])
+					dchancount++;
+
+				if (pris[x].dchans[y] == pri)
 					dchan = y;
-					break;
-				}
 			}
 			if (dchan >= 0) {
 				span = x;
 				break;
 			}
+			dchancount = 0;
 		}
-		if ((dchan >= 0) && (span >= 0))
-			ast_log(LOG_WARNING, "[Span %d D-Channel %d] PRI: %s", span, dchan, s);
-		else
+		if ((dchan >= 0) && (span >= 0)) {
+			if (dchancount > 1)
+				ast_log(LOG_WARNING, "[Span %d D-Channel %d] PRI: %s", span, dchan, s);
+			else
+				ast_verbose("%s", s);
+		} else
 			ast_verbose("PRI debug error: could not find pri associated it with debug message output\n");
 	} else
 		ast_log(LOG_WARNING, "%s", s);




More information about the svn-commits mailing list