Commit 6b88b7d0b2 for asterisk.org

commit 6b88b7d0b253ca8982768fca31cc44093150c180
Author: phoneben <3232963@gmail.com>
Date:   Thu Oct 8 17:10:53 2026 +0300

    file.c: Log the actual file extension during playback

    file.c: Log the actual file extension during playback

    The playback verbose message currently uses the channel write format when building the displayed filename.

    This can be misleading. For example, a WAV file may be logged as:

    Playing 'soundfile.slin'

    because WAV playback uses signed linear audio internally.

    Store the actual file extension matched by filehelper() on the ast_filestream and use that extension in the playback verbose message.

    This allows the log to reflect the actual source file that was opened, including cases where the format handler name differs from the file extension.

    Example after the change:

    Playing 'soundfile.wav'

    This only changes the verbose log output and does not affect playback behavior.

    AI assistance: ChatGPT assisted with identifying the issue and PR text.

diff --git a/include/asterisk/mod_format.h b/include/asterisk/mod_format.h
index 8066c3dfe0..24c73c2dd7 100644
--- a/include/asterisk/mod_format.h
+++ b/include/asterisk/mod_format.h
@@ -103,7 +103,7 @@ struct ast_filestream {
 	struct ast_format_def *fmt;	/* need to write to the lock and usecnt */
 	int flags;
 	mode_t mode;
-	char *open_filename;
+	char *open_extension;
 	char *filename;
 	char *realfilename;
 	/*! Video file stream */
diff --git a/main/file.c b/main/file.c
index 28923d64c6..94e16a6ee5 100644
--- a/main/file.c
+++ b/main/file.c
@@ -519,6 +519,7 @@ static void filestream_destructor(void *arg)

 	ast_free(f->filename);
 	ast_free(f->realfilename);
+	ast_free(f->open_extension);
 	if (f->vfs)
 		ast_closestream(f->vfs);
 	ast_free(f->write_buffer);
@@ -691,6 +692,7 @@ static int filehelper(const char *filename, const void *arg2, const char *fmt, c
 				s->fmt = f;
 				s->trans = NULL;
 				s->filename = NULL;
+				s->open_extension = ast_strdup(translate_extension(ext));
 				if (ast_format_get_type(s->fmt->format) == AST_MEDIA_TYPE_AUDIO) {
 					if (ast_channel_stream(chan))
 						ast_closestream(ast_channel_stream(chan));
@@ -1463,7 +1465,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename,

 	if (VERBOSITY_ATLEAST(3)) {
 		ast_channel_lock(chan);
-		ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", ast_channel_name(chan), tmp_filename, ast_format_get_name(ast_channel_writeformat(chan)), preflang ? preflang : "default");
+		ast_verb(3, "<%s> Playing '%s' (format '%s', language '%s')\n", ast_channel_name(chan), tmp_filename, S_OR(fs->open_extension, "unknown"), preflang ? preflang : "default");
 		ast_channel_unlock(chan);
 	}