diff --git a/CHANGES b/CHANGES
index fcbe04c943bf5359a319d38c2a69f0d60da7b659..305719ae4d25a441076d6a78ac2c38a9b13dfccf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -17,6 +17,17 @@ app_queue
  * PAUSEALL/UNPAUSEALL now sets the pause reason in the queue_log if it has
    been defined.
 
+------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 14.5.0 to Asterisk 14.6.0 ------------
+------------------------------------------------------------------------------
+
+res_agi
+------------------
+ * The EAGI() application will now look for a dialplan variable named
+   EAGI_AUDIO_FORMAT and use that format with the 'enhanced' audio pipe that
+   EAGI provides. If not specified, it will continue to use the default signed
+   linear (slin).
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 14.4.0 to Asterisk 14.5.0 ------------
 ------------------------------------------------------------------------------
diff --git a/res/res_agi.c b/res/res_agi.c
index 557f34971528f71b11fd9621e64da73e45dce532..0463573bbd58128e28db1a43c553442ab9b31700 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -4552,15 +4552,30 @@ static int eagi_exec(struct ast_channel *chan, const char *data)
 {
 	int res;
 	struct ast_format *readformat;
+	struct ast_format *requested_format = NULL;
+	const char *requested_format_name;
 
 	if (ast_check_hangup(chan)) {
 		ast_log(LOG_ERROR, "EAGI cannot be run on a dead/hungup channel, please use AGI.\n");
 		return 0;
 	}
+
+	requested_format_name = pbx_builtin_getvar_helper(chan, "EAGI_AUDIO_FORMAT");
+	if (requested_format_name) {
+		requested_format = ast_format_cache_get(requested_format_name);
+		if (requested_format) {
+			ast_verb(3, "<%s> Setting EAGI audio pipe format to %s\n",
+					 ast_channel_name(chan), ast_format_get_name(requested_format));
+		} else {
+			ast_log(LOG_ERROR, "Could not find requested format: %s\n", requested_format_name);
+		}
+	}
+
 	readformat = ao2_bump(ast_channel_readformat(chan));
-	if (ast_set_read_format(chan, ast_format_slin)) {
+	if (ast_set_read_format(chan, requested_format ?: ast_format_slin)) {
 		ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", ast_channel_name(chan));
-		ao2_ref(readformat, -1);
+		ao2_cleanup(requested_format);
+		ao2_cleanup(readformat);
 		return -1;
 	}
 	res = agi_exec_full(chan, data, 1, 0);
@@ -4570,7 +4585,8 @@ static int eagi_exec(struct ast_channel *chan, const char *data)
 				ast_format_get_name(readformat));
 		}
 	}
-	ao2_ref(readformat, -1);
+	ao2_cleanup(requested_format);
+	ao2_cleanup(readformat);
 	return res;
 }