[asterisk-commits] jpeeler: branch jpeeler/chan_dahdi r118748 - /team/jpeeler/chan_dahdi/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 28 11:26:54 CDT 2008


Author: jpeeler
Date: Wed May 28 11:26:46 2008
New Revision: 118748

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118748
Log:
removed unnecessary HAVE_DAHDI defines

Modified:
    team/jpeeler/chan_dahdi/channels/chan_dahdi.c

Modified: team/jpeeler/chan_dahdi/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/channels/chan_dahdi.c?view=diff&rev=118748&r1=118747&r2=118748
==============================================================================
--- team/jpeeler/chan_dahdi/channels/chan_dahdi.c (original)
+++ team/jpeeler/chan_dahdi/channels/chan_dahdi.c Wed May 28 11:26:46 2008
@@ -636,14 +636,10 @@
 	int stripmsd;
 	int callwaitcas;
 	int callwaitrings;
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 	struct {
 		struct dahdi_echocanparams head;
 		struct dahdi_echocanparam params[DAHDI_MAX_ECHOCANPARAMS];
 	} echocancel;
-#else
-	int echocancel;
-#endif
 	int echotraining;
 	char echorest[20];
 	int busycount;
@@ -794,11 +790,7 @@
 
 			.tonezone = -1,
 
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 			.echocancel.head.tap_length = 1,
-#else
-			.echocancel = 1,
-#endif
 
 			.busycount = 3,
 
@@ -1653,23 +1645,14 @@
 		ast_debug(1, "Echo cancellation isn't required on digital connection\n");
 		return;
 	}
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 	if (p->echocancel.head.tap_length) {
-#else
-	if (p->echocancel) {
-#endif
 		if ((p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP) || (p->sig == SIG_PRI) || (p->sig == SIG_SS7)) {
 			x = 1;
 			res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &x);
 			if (res)
 				ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", p->channel, strerror(errno));
 		}
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
-#else
-		x = p->echocancel;
-		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL, &x);
-#endif
 		if (res)  {
 			ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
 		} else {
@@ -1702,15 +1685,9 @@
 	int res;
 
 	if (p->echocanon) {
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 		struct dahdi_echocanparams ecp = { .tap_length = 0 };
 
 		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL_PARAMS, &ecp);
-#else
-		int x = 0;
-
-		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL, &x);
-#endif
 
 		if (res)
 			ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d\n", p->channel);
@@ -4209,9 +4186,7 @@
 {
 	int res;
 	DAHDI_SPANINFO zi;
-#if defined(HAVE_DAHDI_CHANALARMS)
 	struct dahdi_params params;
-#endif
 
 	memset(&zi, 0, sizeof(zi));
 	zi.spanno = p->span;
@@ -4220,11 +4195,9 @@
 			return zi.alarms;
 	}
 
-#if defined(HAVE_DAHDI_CHANALARMS)
 	/* No alarms on the span. Check for channel alarms. */
 	if ((res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &params)) >= 0)
 		return params.chan_alarms;
-#endif
 
 	ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
 
@@ -8456,11 +8429,7 @@
 		tmp->echocancel = conf->chan.echocancel;
 		tmp->echotraining = conf->chan.echotraining;
 		tmp->pulse = conf->chan.pulse;
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 		if (tmp->echocancel.head.tap_length) {
-#else
-		if (tmp->echocancel) {
-#endif
 			tmp->echocanbridged = conf->chan.echocanbridged;
 		} else {
 			if (conf->chan.echocanbridged)
@@ -12045,7 +12014,7 @@
 			ast_cli(a->fd, "Pulse phone: %s\n", tmp->pulsedial ? "yes" : "no");
 			ast_cli(a->fd, "DND: %s\n", tmp->dnd ? "yes" : "no");
 			ast_cli(a->fd, "Echo Cancellation:\n");
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
+
 			if (tmp->echocancel.head.tap_length) {
 				ast_cli(a->fd, "\t%d taps\n", tmp->echocancel.head.tap_length);
 				for (x = 0; x < tmp->echocancel.head.param_count; x++) {
@@ -12055,14 +12024,6 @@
 			} else {
 				ast_cli(a->fd, "\tnone\n");
 			}
-#else
-			if (tmp->echocancel) {
-				ast_cli(a->fd, "\t%d taps\n", tmp->echocancel);
-				ast_cli(a->fd, "\t%scurrently %s\n", tmp->echocanbridged ? "" : "(unless TDM bridged) ", tmp->echocanon ? "ON" : "OFF");
-			}
-			else
-				ast_cli(a->fd, "\tnone\n");
-#endif
 			if (tmp->master)
 				ast_cli(a->fd, "Master Channel: %d\n", tmp->master->channel);
 			for (x = 0; x < MAX_SLAVES; x++) {
@@ -12282,7 +12243,6 @@
 	return CLI_SUCCESS;
 }
 
-#if defined(HAVE_DAHDI_HWGAIN)
 static char *dahdi_set_hwgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int channel;
@@ -12351,7 +12311,6 @@
 	return CLI_FAILURE;
 
 }
-#endif
 
 static char *dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
@@ -12492,9 +12451,7 @@
 	AST_CLI_DEFINE(dahdi_restart_cmd, "Fully restart DAHDI channels"),
 	AST_CLI_DEFINE(dahdi_show_status, "Show all DAHDI cards status"),
 	AST_CLI_DEFINE(dahdi_show_version, "Show the DAHDI version in use"),
-#if defined(HAVE_DAHDI_HWGAIN)
 	AST_CLI_DEFINE(dahdi_set_hwgain, "Set hardware gain on a channel"),
-#endif
 	AST_CLI_DEFINE(dahdi_set_swgain, "Set software gain on a channel"),
 	AST_CLI_DEFINE(dahdi_set_dnd, "Set software gain on a channel"),
 };
@@ -12868,11 +12825,7 @@
 			ast_log(LOG_ERROR, "Unable to get parameters for sigchan %d (%s)\n", sigchan, strerror(errno));
 			return -1;
 		}
-		if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC) 
-#if defined(HAVE_DAHDI_SIG_MTP2)
-				&& (p.sigtype != DAHDI_SIG_MTP2)
-#endif
-				) {
+		if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC) && (p.sigtype != DAHDI_SIG_MTP2)) {
 			dahdi_close(link->fds[curfd]);
 			link->fds[curfd] = -1;
 			ast_log(LOG_ERROR, "sigchan %d is not in HDLC/FCS mode.  See /etc/dahdi.conf\n", sigchan);
@@ -13274,7 +13227,6 @@
  * \todo Move definition of MAX_CHANLIST_LEN to a proper place. */
 #define MAX_CHANLIST_LEN 80
 
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 static void process_echocancel(struct dahdi_chan_conf *confp, const char *data, unsigned int line)
 {
 	char *parse = ast_strdupa(data);
@@ -13325,7 +13277,6 @@
 		confp->chan.echocancel.head.param_count++;
 	}
 }
-#endif /* defined(HAVE_DAHDI_ECHOCANPARAMS) */
 
 /*! process_dahdi() - ignore keyword 'channel' and similar */
 #define PROC_DAHDI_OPT_NOCHAN  (1 << 0) 
@@ -13456,16 +13407,7 @@
 			} else if (!strcasecmp(v->value, "both") || ast_true(v->value))
 				confp->chan.callprogress |= CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING;
 		} else if (!strcasecmp(v->name, "echocancel")) {
-#if defined(HAVE_DAHDI_ECHOCANPARAMS)
 			process_echocancel(confp, v->value, v->lineno);
-#else
-			y = ast_strlen_zero(v->value) ? 0 : atoi(v->value);
-
-			if ((y == 32) || (y == 64) || (y == 128) || (y == 256) || (y == 512) || (y == 1024))
-				confp->chan.echocancel = y;
-			else if ((confp->chan.echocancel = ast_true(v->value)))
-				confp->chan.echocancel = 128;
-#endif
 		} else if (!strcasecmp(v->name, "echotraining")) {
 			if (sscanf(v->value, "%d", &y) == 1) {
 				if ((y < 10) || (y > 4000)) {




More information about the asterisk-commits mailing list