[svn-commits] jpeeler: trunk r222652 - /trunk/channels/chan_dahdi.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Oct 7 15:08:19 CDT 2009


Author: jpeeler
Date: Wed Oct  7 15:08:14 2009
New Revision: 222652

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222652
Log:
Change ringt (ring timeout) styles to be consistent across chan_dahdi.

(closes issue #15684)
Reported by: alecdavis
Patches: 
      chan_dahdi.bug15684.diff2.txt uploaded by alecdavis (license 585)
Tested by: alecdavis

Modified:
    trunk/channels/chan_dahdi.c

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=222652&r1=222651&r2=222652
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Oct  7 15:08:14 2009
@@ -1638,11 +1638,11 @@
 			}
 		}
 
-		if (analog_p->ringt) {
-			analog_p->ringt--;
-		}
-		if (analog_p->ringt == 1) {
-			return -1;
+		if (analog_p->ringt > 0) {
+			if (!(--analog_p->ringt)) {
+				/* only return if we timeout from a ring event */
+				return -1;
+			}
 		}
 
 		if (p->cid_signalling == CID_SIG_V23_JP) {
@@ -1742,11 +1742,11 @@
 					}
 					break;
 				}
-				if (analog_p->ringt)
-					analog_p->ringt--;
-				if (analog_p->ringt == 1) {
-					res = -1;
-					break;
+				if (analog_p->ringt > 0) {
+					if (!(--analog_p->ringt)) {
+						res = -1;
+						break;
+					}
 				}
 			}
 		}
@@ -7713,12 +7713,12 @@
 		ast_mutex_unlock(&p->lock);
 		return &p->subs[idx].f;
 	}
-	if (p->ringt == 1) {
-		ast_mutex_unlock(&p->lock);
-		return NULL;
-	}
-	else if (p->ringt > 0)
-		p->ringt--;
+	if (p->ringt > 0) {
+		if (!(--p->ringt)) {
+			ast_mutex_unlock(&p->lock);
+			return NULL;
+		}
+	}
 
 #ifdef HAVE_OPENR2
 	if (p->mfcr2) {
@@ -9291,11 +9291,11 @@
 									}
 									break;
 								}
-								if (p->ringt)
-									p->ringt--;
-								if (p->ringt == 1) {
-									res = -1;
-									break;
+								if (p->ringt > 0) {
+									if (!(--p->ringt)) {
+										res = -1;
+										break;
+									}
 								}
 							}
 						}
@@ -9448,12 +9448,11 @@
 								}
 								break;
 							}
-							if (p->ringt) {
-								p->ringt--;
-							}
-							if (p->ringt == 1) {
-								res = -1;
-								break;
+							if (p->ringt > 0) {
+								if (!(--p->ringt)) {
+									res = -1;
+									break;
+								}
 							}
 							samples += res;
 							res = callerid_feed(cs, buf, res, AST_LAW(p));
@@ -9510,11 +9509,11 @@
 									}
 									break;
 								}
-							if (p->ringt)
-								p->ringt--;
-								if (p->ringt == 1) {
-									res = -1;
-									break;
+								if (p->ringt > 0) {
+									if (!(--p->ringt)) {
+										res = -1;
+										break;
+									}
 								}
 							}
 						}




More information about the svn-commits mailing list