[Asterisk-cvs] asterisk/channels chan_zap.c,1.380,1.381

markster at lists.digium.com markster at lists.digium.com
Mon Nov 22 13:59:35 CST 2004


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

Modified Files:
	chan_zap.c 
Log Message:
Don't allow more than 10 seconds of audio for callerid (bug #2920)


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.380
retrieving revision 1.381
diff -u -d -r1.380 -r1.381
--- chan_zap.c	19 Nov 2004 13:45:44 -0000	1.380
+++ chan_zap.c	22 Nov 2004 18:59:19 -0000	1.381
@@ -4700,6 +4700,7 @@
 	int receivedRingT;
 	int counter1;
 	int counter;
+	int samples = 0;
 
 	int flags;
 	int i;
@@ -5296,6 +5297,7 @@
 			} else if (p->cid_signalling == CID_SIG_V23) {
 				cs = callerid_new(cid_signalling);
 				if (cs) {
+					samples = 0;
 #if 1
 					bump_gains(p);
 #endif				
@@ -5327,12 +5329,15 @@
 								}
 								break;
 							}
+							samples += res;
 							res = callerid_feed(cs, buf, res, AST_LAW(p));
 							if (res < 0) {
 								ast_log(LOG_WARNING, "CallerID feed failed: %s\n", strerror(errno));
 								break;
 							} else if (res)
 								break;
+							else if (samples > (8000 * 10))
+								break;
 						}
 					}
 					if (res == 1) {
@@ -5466,6 +5471,7 @@
 #if 1
 				bump_gains(p);
 #endif				
+				samples = 0;
 				len = 0;
 				distMatches = 0;
 				/* Clear the current ring data array so we dont have old data in it. */
@@ -5520,12 +5526,15 @@
 							res = -1;
 							break;
 						}
+						samples += res;
 						res = callerid_feed(cs, buf, res, AST_LAW(p));
 						if (res < 0) {
 							ast_log(LOG_WARNING, "CallerID feed failed: %s\n", strerror(errno));
 							break;
 						} else if (res)
 							break;
+						else if (samples > (8000 * 10))
+							break;
 					}
 				}
 				if (p->usedistinctiveringdetection == 1) {




More information about the svn-commits mailing list