Merged revisions 324174 via svnmerge from
authorRichard Mudgett <rmudgett@digium.com>
Fri, 17 Jun 2011 18:23:54 +0000 (18:23 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 17 Jun 2011 18:23:54 +0000 (18:23 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r324174 | rmudgett | 2011-06-17 13:23:19 -0500 (Fri, 17 Jun 2011) | 5 lines

  Add header string to libpri debug output.

  Add header string to libpri debug output so the libpri output can be
  found/extracted easier from huge debug trace files.
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324175 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c

index 131279e..2fe9e01 100644 (file)
@@ -13933,17 +13933,22 @@ static void *mfcr2_monitor(void *data)
 #endif
 static void dahdi_pri_message(struct pri *pri, char *s)
 {
-       int x, y;
-       int dchan = -1, span = -1, dchancount = 0;
+       int x;
+       int y;
+       int dchan = -1;
+       int span = -1;
+       int dchancount = 0;
 
        if (pri) {
                for (x = 0; x < NUM_SPANS; x++) {
                        for (y = 0; y < SIG_PRI_NUM_DCHANS; y++) {
-                               if (pris[x].pri.dchans[y])
+                               if (pris[x].pri.dchans[y]) {
                                        dchancount++;
+                               }
 
-                               if (pris[x].pri.dchans[y] == pri)
+                               if (pris[x].pri.dchans[y] == pri) {
                                        dchan = y;
+                               }
                        }
                        if (dchan >= 0) {
                                span = x;
@@ -13951,14 +13956,18 @@ static void dahdi_pri_message(struct pri *pri, char *s)
                        }
                        dchancount = 0;
                }
-               if (dchancount > 1 && (span > -1))
-                       ast_verbose("[Span %d D-Channel %d]%s", span, dchan, s);
-               else if (span > -1)
-                       ast_verbose("%d %s", span+1, s);
-               else
-                       ast_verbose("%s", s);
-       } else
-               ast_verbose("%s", s);
+               if (-1 < span) {
+                       if (1 < dchancount) {
+                               ast_verbose("[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
+                       } else {
+                               ast_verbose("PRI Span: %d %s", span + 1, s);
+                       }
+               } else {
+                       ast_verbose("PRI Span: ? %s", s);
+               }
+       } else {
+               ast_verbose("PRI Span: ? %s", s);
+       }
 
        ast_mutex_lock(&pridebugfdlock);
 
@@ -13975,18 +13984,22 @@ static void dahdi_pri_message(struct pri *pri, char *s)
 #if defined(HAVE_PRI)
 static void dahdi_pri_error(struct pri *pri, char *s)
 {
-       int x, y;
-       int dchan = -1, span = -1;
+       int x;
+       int y;
+       int dchan = -1;
+       int span = -1;
        int dchancount = 0;
 
        if (pri) {
                for (x = 0; x < NUM_SPANS; x++) {
                        for (y = 0; y < SIG_PRI_NUM_DCHANS; y++) {
-                               if (pris[x].pri.dchans[y])
+                               if (pris[x].pri.dchans[y]) {
                                        dchancount++;
+                               }
 
-                               if (pris[x].pri.dchans[y] == pri)
+                               if (pris[x].pri.dchans[y] == pri) {
                                        dchan = y;
+                               }
                        }
                        if (dchan >= 0) {
                                span = x;
@@ -13994,14 +14007,18 @@ static void dahdi_pri_error(struct pri *pri, char *s)
                        }
                        dchancount = 0;
                }
-               if ((dchancount > 1) && (span > -1))
-                       ast_log(LOG_ERROR, "[Span %d D-Channel %d] PRI: %s", span, dchan, s);
-               else if (span > -1)
-                       ast_log(LOG_ERROR, "%d %s", span+1, s);
-               else
-                       ast_log(LOG_ERROR, "%s", s);
-       } else
-               ast_log(LOG_ERROR, "%s", s);
+               if (-1 < span) {
+                       if (1 < dchancount) {
+                               ast_log(LOG_ERROR, "[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
+                       } else {
+                               ast_log(LOG_ERROR, "PRI Span: %d %s", span + 1, s);
+                       }
+               } else {
+                       ast_log(LOG_ERROR, "PRI Span: ? %s", s);
+               }
+       } else {
+               ast_log(LOG_ERROR, "PRI Span: ? %s", s);
+       }
 
        ast_mutex_lock(&pridebugfdlock);