diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index d2f18a97a5843898a97b9c33062fd276bc384865..a301b0cf256348df8dabeca9eb1e2dcb3578ee6c 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -5132,6 +5132,7 @@ static int dahdi_func_write(struct ast_channel *chan, const char *function, char
 			ast_mutex_lock(&p->lock);
 			dahdi_disable_ec(p);
 			ast_mutex_unlock(&p->lock);	
+#ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
 		} else if (!strcasecmp(value, "fax")) {
 			int blah = 1;
 
@@ -5154,6 +5155,7 @@ static int dahdi_func_write(struct ast_channel *chan, const char *function, char
 				ast_log(LOG_WARNING, "Unable to place echocan into voice mode on channel %d: %s\n", p->channel, strerror(errno));
 			}
 			ast_mutex_unlock(&p->lock);	
+#endif
 		} else {
 			ast_log(LOG_WARNING, "Unsupported value '%s' provided for '%s' item.\n", value, data);
 			res = -1;