mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
file.c: missing "custom" sound files should not generate warning logs
With `sounds_search_custom_dir = yes` we first look to see if a sound file
is present in the "custom" sound directory before looking in the standard
sound directories. We should not be issuing a WARNING log message if a
sound cannot be found in the "custom" directory.
Resolves: https://github.com/asterisk/asterisk/issues/1170
(cherry picked from commit e2e36748f5
)
This commit is contained in:
committed by
Asterisk Development Team
parent
b7f7d66fca
commit
bdc925c8cc
26
main/file.c
26
main/file.c
@@ -787,13 +787,8 @@ static int fileexists_core(const char *filename, const char *fmt, const char *pr
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
|
||||
{
|
||||
return ast_openstream_full(chan, filename, preflang, 0);
|
||||
}
|
||||
|
||||
struct ast_filestream *ast_openstream_full(struct ast_channel *chan,
|
||||
const char *filename, const char *preflang, int asis)
|
||||
static struct ast_filestream *openstream_internal(struct ast_channel *chan,
|
||||
const char *filename, const char *preflang, int asis, int quiet)
|
||||
{
|
||||
/*
|
||||
* Use fileexists_core() to find a file in a compatible
|
||||
@@ -822,7 +817,9 @@ struct ast_filestream *ast_openstream_full(struct ast_channel *chan,
|
||||
if (!fileexists_core(filename, NULL, preflang, buf, buflen, file_fmt_cap) ||
|
||||
!ast_format_cap_has_type(file_fmt_cap, AST_MEDIA_TYPE_AUDIO)) {
|
||||
|
||||
ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
|
||||
if (!quiet) {
|
||||
ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
|
||||
}
|
||||
ao2_ref(file_fmt_cap, -1);
|
||||
return NULL;
|
||||
}
|
||||
@@ -845,6 +842,17 @@ struct ast_filestream *ast_openstream_full(struct ast_channel *chan,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
|
||||
{
|
||||
return openstream_internal(chan, filename, preflang, 0, 0);
|
||||
}
|
||||
|
||||
struct ast_filestream *ast_openstream_full(struct ast_channel *chan,
|
||||
const char *filename, const char *preflang, int asis)
|
||||
{
|
||||
return openstream_internal(chan, filename, preflang, asis, 0);
|
||||
}
|
||||
|
||||
struct ast_filestream *ast_openvstream(struct ast_channel *chan,
|
||||
const char *filename, const char *preflang)
|
||||
{
|
||||
@@ -1307,7 +1315,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename,
|
||||
if (ast_opt_sounds_search_custom && !is_absolute_path(filename)) {
|
||||
memset(custom_filename, 0, sizeof(custom_filename));
|
||||
snprintf(custom_filename, sizeof(custom_filename), "custom/%s", filename);
|
||||
fs = ast_openstream(chan, custom_filename, preflang);
|
||||
fs = openstream_internal(chan, filename, preflang, 0, 1); /* open stream, do not warn for missing files */
|
||||
if (fs) {
|
||||
tmp_filename = custom_filename;
|
||||
ast_debug(3, "Found file %s in custom directory\n", filename);
|
||||
|
Reference in New Issue
Block a user