Merged revisions 106945 via svnmerge from
[asterisk/asterisk.git] / channels / chan_zap.c
index 5614b1f..0bb2d0b 100644 (file)
@@ -10301,8 +10301,18 @@ static void *pri_dchannel(void *vpri)
                if (e) {
                        if (pri->debug)
                                pri_dump_event(pri->dchans[which], e);
-                       if (e->e != PRI_EVENT_DCHAN_DOWN)
+
+                       if (e->e != PRI_EVENT_DCHAN_DOWN) {
+                               if (!(pri->dchanavail[which] & DCHAN_UP)) {
+                                       ast_verb(2, "%s D-Channel on span %d up\n", pri_order(which), pri->span);
+                               }
                                pri->dchanavail[which] |= DCHAN_UP;
+                       } else {
+                               if (pri->dchanavail[which] & DCHAN_UP) {
+                                       ast_verb(2, "%s D-Channel on span %d down\n", pri_order(which), pri->span);
+                               }
+                               pri->dchanavail[which] &= ~DCHAN_UP;
+                       }
 
                        if ((e->e != PRI_EVENT_DCHAN_UP) && (e->e != PRI_EVENT_DCHAN_DOWN) && (pri->pri != pri->dchans[which]))
                                /* Must be an NFAS group that has the secondary dchan active */
@@ -10310,8 +10320,6 @@ static void *pri_dchannel(void *vpri)
 
                        switch (e->e) {
                        case PRI_EVENT_DCHAN_UP:
-                               ast_verb(2, "%s D-Channel on span %d up\n", pri_order(which), pri->span);
-                               pri->dchanavail[which] |= DCHAN_UP;
                                if (!pri->pri) pri_find_dchan(pri);
 
                                /* Note presense of D-channel */
@@ -10330,8 +10338,6 @@ static void *pri_dchannel(void *vpri)
                                        }
                                break;
                        case PRI_EVENT_DCHAN_DOWN:
-                               ast_verb(2, "%s D-Channel on span %d down\n", pri_order(which), pri->span);
-                               pri->dchanavail[which] &= ~DCHAN_UP;
                                pri_find_dchan(pri);
                                if (!pri_is_up(pri)) {
                                        pri->resetting = 0;