Index: include/asterisk/res_fax.h
===================================================================
--- include/asterisk/res_fax.h	(revision 4)
+++ include/asterisk/res_fax.h	(revision 6)
@@ -178,6 +178,8 @@
 	int gateway_id;
 	/*! the timeout for this gateway in seconds */
 	int gateway_timeout;
+	/*! disable v21 modem tone detection for this gateway */
+	int gateway_no_v21_detect;
 	/*! the id of the faxdetect framehook for this channel */
 	int faxdetect_id;
 };
Index: res/res_fax.c
===================================================================
--- res/res_fax.c	(revision 4)
+++ res/res_fax.c	(revision 6)
@@ -187,7 +187,7 @@
 						R/W Modem type (v17/v27/v29).
 					
 					
-						R/W T38 fax gateway, with optional fax activity timeout in seconds (yes[,timeout]/no)
+						R/W T38 fax gateway, with optional fax activity timeout in seconds (yes[,timeout]/no,t38)
 					
 					
 						R/W Enable FAX detect with optional timeout in seconds (yes,t38,cng[,timeout]/no)
@@ -3111,7 +3111,7 @@
 		return fax_gateway_detect_t38(gateway, chan, peer, active, f);
 	}
 
-	if (!gateway->detected_v21 && gateway->t38_state == T38_STATE_UNAVAILABLE && f->frametype == AST_FRAME_VOICE) {
+	if (!details->gateway_no_v21_detect && !gateway->detected_v21 && gateway->t38_state == T38_STATE_UNAVAILABLE && f->frametype == AST_FRAME_VOICE) {
 		/* not in gateway mode and have not detected v21 yet, listen
 		 * for v21 */
 		ao2_ref(details, -1);
@@ -3915,7 +3915,7 @@
 		ast_copy_string(buf, details->option.ecm ? "yes" : "no", len);
 	} else if (!strcasecmp(data, "t38gateway") || !strcasecmp(data, "gateway") ||
 		   !strcasecmp(data, "t38_gateway") || !strcasecmp(data, "faxgateway")) {
-		ast_copy_string(buf, details->gateway_id != -1 ? "yes" : "no", len);
+		ast_copy_string(buf, details->gateway_id != -1 ? (details->gateway_no_v21_detect ? "t38" : "yes") : "no", len);
 	} else if (!strcasecmp(data, "faxdetect")) {
 		ast_copy_string(buf, details->faxdetect_id != -1 ? "yes" : "no", len);
 	} else if (!strcasecmp(data, "error")) {
@@ -4001,7 +4001,12 @@
 			*timeout++ = '\0';
 		}
 
-		if (ast_true(val)) {
+		if (ast_true(val) || !strcasecmp(val, "t38")) {
+			if (!strcasecmp(val, "t38")) {
+				details->gateway_no_v21_detect = 1;
+			} else {
+				details->gateway_no_v21_detect = 0;
+			}
 			if (details->gateway_id < 0) {
 				details->gateway_timeout = 0;
 				if (timeout) {