cdr_custom: Allow absolute filenames.

A follow up to #893 that brings the same functionality to
cdr_custom. Also update the sample configuration files to note support
for absolute paths.
This commit is contained in:
Sean Bright
2024-09-26 12:26:04 -04:00
parent 7c982de5c6
commit 084c04f711
4 changed files with 17 additions and 5 deletions

View File

@@ -58,8 +58,7 @@
#include "asterisk/threadstorage.h"
#include "asterisk/strings.h"
#define CUSTOM_LOG_DIR "/cdr_custom"
#define CONFIG "cdr_custom.conf"
#define CONFIG "cdr_custom.conf"
AST_THREADSTORAGE(custom_buf);
@@ -112,7 +111,11 @@ static int load_config(void)
}
ast_string_field_build(sink, format, "%s\n", var->value);
ast_string_field_build(sink, filename, "%s/%s/%s", ast_config_AST_LOG_DIR, name, var->name);
if (var->name[0] == '/') {
ast_string_field_build(sink, filename, "%s", var->name);
} else {
ast_string_field_build(sink, filename, "%s/%s/%s", ast_config_AST_LOG_DIR, name, var->name);
}
ast_mutex_init(&sink->lock);
AST_RWLIST_INSERT_TAIL(&sinks, sink, list);