[asterisk-commits] jpeeler: trunk r277837 - /trunk/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 19 09:39:13 CDT 2010


Author: jpeeler
Date: Mon Jul 19 09:39:07 2010
New Revision: 277837

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=277837
Log:
Fix regression with distinctive ring detection.

The issue here is that passing an array to a function prohibits the ARRAY_LEN
macro from returning the real size. To avoid this the size is now defined and
use of ARRAY_LEN is avoided.

(closes issue #15718)
Reported by: alecdavis
Patches: 
      bug15718.patch uploaded by jpeeler (license 325)


Modified:
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_analog.c
    trunk/channels/sig_analog.h

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=277837&r1=277836&r2=277837
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Mon Jul 19 09:39:07 2010
@@ -1728,7 +1728,7 @@
 {
 	unsigned char buf[256];
 	int distMatches;
-	int curRingData[3];
+	int curRingData[RING_PATTERNS];
 	int receivedRingT;
 	int counter1;
 	int counter;
@@ -1749,7 +1749,7 @@
 	 * distinctive ringing */
 	if ((checkaftercid && distinctiveringaftercid) || !checkaftercid) {
 		/* Clear the current ring data array so we don't have old data in it. */
-		for (receivedRingT = 0; receivedRingT < ARRAY_LEN(ringdata); receivedRingT++)
+		for (receivedRingT = 0; receivedRingT < RING_PATTERNS; receivedRingT++)
 			ringdata[receivedRingT] = 0;
 		receivedRingT = 0;
 		if (checkaftercid && distinctiveringaftercid)
@@ -1783,7 +1783,7 @@
 					break;
 				/* Increment the ringT counter so we can match it against
 				   values in chan_dahdi.conf for distinctive ring */
-				if (++receivedRingT == ARRAY_LEN(ringdata))
+				if (++receivedRingT == RING_PATTERNS)
 					break;
 			} else if (i & DAHDI_IOMUX_READ) {
 				res = read(p->subs[idx].dfd, buf, sizeof(buf));

Modified: trunk/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_analog.c?view=diff&rev=277837&r1=277836&r2=277837
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Mon Jul 19 09:39:07 2010
@@ -2281,7 +2281,7 @@
 			int timeout = 10000;  /* Ten seconds */
 			struct timeval start = ast_tvnow();
 			enum analog_event ev;
-			int curRingData[3] = { 0 };
+			int curRingData[RING_PATTERNS] = { 0 };
 			int receivedRingT = 0;
 
 			namebuf[0] = 0;
@@ -2315,7 +2315,7 @@
 							}
 							/* Increment the ringT counter so we can match it against
 							   values in chan_dahdi.conf for distinctive ring */
-							if (++receivedRingT == ARRAY_LEN(curRingData)) {
+							if (++receivedRingT == RING_PATTERNS) {
 								break;
 							}
 						}

Modified: trunk/channels/sig_analog.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_analog.h?view=diff&rev=277837&r1=277836&r2=277837
==============================================================================
--- trunk/channels/sig_analog.h (original)
+++ trunk/channels/sig_analog.h Mon Jul 19 09:39:07 2010
@@ -27,6 +27,10 @@
 
 #include "asterisk/channel.h"
 #include "asterisk/frame.h"
+
+#define ANALOG_MAX_CID 300
+#define READ_SIZE 160
+#define RING_PATTERNS 3
 
 /* Signalling types supported */
 enum analog_sigtype {
@@ -110,8 +114,6 @@
 	ANALOG_CID_START_DTMF_NOALERT,
 };
 
-#define ANALOG_MAX_CID 300
-
 enum dialop {
 	ANALOG_DIAL_OP_REPLACE = 2,
 };
@@ -220,8 +222,6 @@
 };
 
 
-
-#define READ_SIZE 160
 
 struct analog_subchannel {
 	struct ast_channel *owner;




More information about the asterisk-commits mailing list