From 306b5ae0c743ae17543a1890f47bf40e3a99a775 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Thu, 20 Aug 2026 07:13:50 -0600 Subject: [PATCH] res_cdrel_custom: Use extendable ast_str for JSON records. Since JSON records include the field names, the actual record size can be quite lengthy and since the thread-local backed ast_str used by the DSV writer can't be extended, we need to use a regular, extendable ast_str. Resolves: #2106 --- res/cdrel_custom/writers.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/res/cdrel_custom/writers.c b/res/cdrel_custom/writers.c index 975302c042..171badf647 100644 --- a/res/cdrel_custom/writers.c +++ b/res/cdrel_custom/writers.c @@ -136,7 +136,16 @@ static int json_writer(struct cdrel_config *config, struct cdrel_values *values) { int ix = 0; int res = 0; - struct ast_str *str = ast_str_thread_get(&custom_buf, 1024); + /* + * Since JSON records include the field names, the actual record size can be quite + * lengthy and since the thread-local backed ast_str used by the DSV writer can't be + * extended, we need to use a regular, extendable ast_str. + */ + RAII_VAR(struct ast_str *, str, ast_str_create(1024), ast_free); + + if (!str) { + return -1; + } ast_str_set(&str, -1, "%s", "{");