Commit df26b8d437 for asterisk.org

commit df26b8d4375804f33ff7ec98d5c27e6651726f9f
Author: Jonathan S B Guo <houxirens@qq.com>
Date:   Thu Nov 12 22:14:45 2026 +0800

    func,cli: Add raw write and read format to output

    Expose the raw read and write formats of a channel,that is the formats the channel technology itself provides and accepts. These differ from the read/write formats when transcoding is in use.

    The raw formats are exposed by the CHANNEL dialplan function and by the "core show channel" CLI command.

    UserNote: The CHANNEL function now supports the "audiorawreadformat" and "audiorawwriteformat" options, and "core show channel" prints RawReadFormat and RawWriteFormat.

diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 739a4786ec..0df0dca964 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -132,6 +132,12 @@
 							<enum name="unknown" />
 						</enumlist>
 					</enum>
+					<enum name="audiorawreadformat">
+						<para>R/O raw format currently being read from channel technology, before read translation.</para>
+					</enum>
+					<enum name="audiorawwriteformat">
+						<para>R/O raw format currently being written to channel technology, after write translation.</para>
+					</enum>
 					<enum name="audioreadformat">
 						<para>R/O format currently being read.</para>
 					</enum>
@@ -419,6 +425,10 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
 			ast_copy_string(buf, ast_format_cap_get_names(tmpcap, &codec_buf), len);
 			ao2_ref(tmpcap, -1);
 		}
+	} else if (!strcasecmp(data, "audiorawreadformat")) {
+		locked_copy_string(chan, buf, ast_format_get_name(ast_channel_rawreadformat(chan)), len);
+	} else if (!strcasecmp(data, "audiorawwriteformat")) {
+		locked_copy_string(chan, buf, ast_format_get_name(ast_channel_rawwriteformat(chan)), len);
 	} else if (!strcasecmp(data, "audioreadformat")) {
 		locked_copy_string(chan, buf, ast_format_get_name(ast_channel_readformat(chan)), len);
 	} else if (!strcasecmp(data, "audiowriteformat")) {
diff --git a/main/cli.c b/main/cli.c
index 90a901198e..5c324f6a60 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1816,6 +1816,8 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
 		"    DNID Digits: %s\n"
 		"       Language: %s\n"
 		"          State: %s (%u)\n"
+		" RawWriteFormat: %s\n"
+		"  RawReadFormat: %s\n"
 		"  NativeFormats: %s\n"
 		"    WriteFormat: %s\n"
 		"     ReadFormat: %s\n"
@@ -1854,6 +1856,8 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
 		ast_channel_language(chan),
 		ast_state2str(ast_channel_state(chan)),
 		ast_channel_state(chan),
+		ast_format_get_name(ast_channel_rawwriteformat(chan)),
+		ast_format_get_name(ast_channel_rawreadformat(chan)),
 		ast_format_cap_get_names(ast_channel_nativeformats(chan), &codec_buf),
 		ast_format_get_name(ast_channel_writeformat(chan)),
 		ast_format_get_name(ast_channel_readformat(chan)),