[Asterisk-cvs] asterisk channel.c,1.134,1.135

markster at lists.digium.com markster at lists.digium.com
Fri Aug 27 17:54:22 CDT 2004


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

Modified Files:
	channel.c 
Log Message:
Fix generator for VAD as well as for automatically syncing to incoming signal if present (bug #2312)


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- channel.c	27 Aug 2004 03:28:32 -0000	1.134
+++ channel.c	27 Aug 2004 22:53:56 -0000	1.135
@@ -1,4 +1,4 @@
- /*
+/*
  * Asterisk -- A telephony toolkit for Linux.
  *
  * Channel Management
@@ -1359,12 +1359,16 @@
 	} 
 
 	/* Run any generator sitting on the line */
-	if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata && !chan->timingfunc) {
+	if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata) {
 		/* Mask generator data temporarily and apply.  If there is a timing function, it
 		   will be calling the generator instead */
 		void *tmp;
 		int res;
 		int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples);
+		if (chan->timingfunc) {
+			ast_log(LOG_DEBUG, "Generator got voice, switching to phase locked mode\n");
+			ast_settimeout(chan, 0, NULL, NULL);
+		}
 		tmp = chan->generatordata;
 		chan->generatordata = NULL;
 		generate = chan->generator->generate;
@@ -1374,6 +1378,11 @@
 			ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
 			ast_deactivate_generator(chan);
 		}
+	} else if (f && (f->frametype == AST_FRAME_CNG)) {
+		if (chan->generator && !chan->timingfunc && (chan->timingfd > -1)) {
+			ast_log(LOG_DEBUG, "Generator got CNG, switching to zap timed mode\n");
+			ast_settimeout(chan, 160, generator_force, chan);
+		}
 	}
 	if (chan->fin & 0x80000000)
 		ast_frame_dump(chan->name, f, "<<");




More information about the svn-commits mailing list