[Asterisk-cvs] asterisk/channels chan_zap.c,1.114,1.115

markster at lists.digium.com markster at lists.digium.com
Mon Oct 27 10:50:01 CST 2003


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

Modified Files:
	chan_zap.c 
Log Message:
Use echo training on FXS (fxo signalled) interfaces... rest to follow


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- chan_zap.c	25 Oct 2003 18:00:00 -0000	1.114
+++ chan_zap.c	27 Oct 2003 17:16:08 -0000	1.115
@@ -172,6 +172,8 @@
 
 static int echocancel;
 
+static int echotraining;
+
 static int echocanbridged = 0;
 
 static int busydetect = 0;
@@ -403,6 +405,7 @@
 	int callwaitcas;
 	int callwaitrings;
 	int echocancel;
+	int echotraining;
 	int echocanbridged;
 	int echocanon;
 	int permcallwaiting;
@@ -1064,6 +1067,22 @@
 		ast_log(LOG_DEBUG, "No echocancellation requested\n");
 }
 
+static void zt_train_ec(struct zt_pvt *p)
+{
+	int x;
+	int res;
+	if (p && p->echocancel && p->echotraining) {
+		x = 400;
+		res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
+		if (res) 
+			ast_log(LOG_WARNING, "Unable to request echo training on channel %d\n", p->channel);
+		else {
+			ast_log(LOG_DEBUG, "Engaged echo training on channel %d\n", p->channel);
+		}
+	} else
+		ast_log(LOG_DEBUG, "No echo training requested\n");
+}
+
 static void zt_disable_ec(struct zt_pvt *p)
 {
 	int x;
@@ -2814,6 +2833,7 @@
 				switch(ast->_state) {
 				case AST_STATE_RINGING:
 					zt_enable_ec(p);
+					zt_train_ec(p);
 					p->subs[index].f.frametype = AST_FRAME_CONTROL;
 					p->subs[index].f.subclass = AST_CONTROL_ANSWER;
 					/* Make sure it stops ringing */
@@ -5149,6 +5169,7 @@
 		tmp->permhidecallerid = hidecallerid;
 		tmp->callreturn = callreturn;
 		tmp->echocancel = echocancel;
+		tmp->echotraining = echotraining;
 		tmp->echocanbridged = echocanbridged;
 		tmp->busydetect = busydetect;
 		tmp->busycount = busycount;
@@ -6773,6 +6794,8 @@
 				if (echocancel)
 					echocancel=128;
 			}
+		} else if (!strcasecmp(v->name, "echotraining")) {
+			echotraining = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "hidecallerid")) {
 			hidecallerid = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "callreturn")) {




More information about the svn-commits mailing list