<para>This application does not automatically answer and should be preceeded by
an application such as Answer or Progress().</para>
<note><para>MixMonitor runs as an audiohook.</para></note>
+ <note><para>If a filename passed to MixMonitor ends with
+ <literal>.wav49</literal>, Asterisk will silently convert the extension to
+ <literal>.WAV</literal> for legacy reasons. <variable>MIXMONITOR_FILENAME</variable>
+ will contain the actual filename that Asterisk is writing to, not necessarily the
+ value that was passed in.</para></note>
<variablelist>
<variable name="MIXMONITOR_FILENAME">
<para>Will contain the filename used to record.</para>
static char *filename_parse(char *filename, char *buffer, size_t len)
{
char *slash;
+ char *ext;
+
+ ast_assert(len > 0);
+
if (ast_strlen_zero(filename)) {
ast_log(LOG_WARNING, "No file name was provided for a file save option.\n");
- } else if (filename[0] != '/') {
- char *build;
- build = ast_alloca(strlen(ast_config_AST_MONITOR_DIR) + strlen(filename) + 3);
+ buffer[0] = 0;
+ return buffer;
+ }
+
+ /* If we don't have an absolute path, make one */
+ if (*filename != '/') {
+ char *build = ast_alloca(strlen(ast_config_AST_MONITOR_DIR) + strlen(filename) + 3);
sprintf(build, "%s/%s", ast_config_AST_MONITOR_DIR, filename);
filename = build;
}
ast_copy_string(buffer, filename, len);
+ /* If the provided filename has a .wav49 extension, we need to convert it to .WAV to
+ match the behavior of build_filename in main/file.c. Otherwise MIXMONITOR_FILENAME
+ ends up referring to a file that does not/will not exist */
+ ext = strrchr(buffer, '.');
+ if (ext && !strcmp(ext, ".wav49")) {
+ /* Change to WAV - we know we have at least 6 writeable bytes where 'ext' points,
+ * so this is safe */
+ memcpy(ext, ".WAV", sizeof(".WAV"));
+ }
+
if ((slash = strrchr(filename, '/'))) {
*slash = '\0';
}
--- /dev/null
+Subject: app_mixmonitor
+
+If the 'filename' argument to MixMonitor() ended with '.wav49,'
+Asterisk would silently convert the extension to '.WAV' when opening
+the file for writing. This caused the MIXMONITOR_FILENAME variable to
+reference the wrong file. The MIXMONITOR_FILENAME variable will now
+reflect the name of the file that Asterisk actually used instead of
+the filename that was passed to the application.