This dirty patch solved my problem:
diff -ur asterisk-16.12.0_OLD/funcs/func_odbc.c asterisk-16.12.0_NEW/funcs/func_odbc.c
--- asterisk-16.12.0_OLD/funcs/func_odbc.c 2020-07-16 19:00:28.000000000 +0300
+++ asterisk-16.12.0_NEW/funcs/func_odbc.c 2020-09-11 22:52:46.337103514 +0300
@@ -100,6 +100,7 @@
static char *config = "func_odbc.conf";
+#define RAY_TEST_CONST 64
#define DEFAULT_SINGLE_DB_CONNECTION 0
static int single_db_connection;
@@ -520,8 +521,8 @@
);
SQLHSTMT stmt = NULL;
SQLLEN rows=0;
- struct ast_str *buf = ast_str_thread_get(&sql_buf, 16);
- struct ast_str *insertbuf = ast_str_thread_get(&sql2_buf, 16);
+ struct ast_str *buf = ast_str_thread_get(&sql_buf, RAY_TEST_CONST);
+ struct ast_str *insertbuf = ast_str_thread_get(&sql2_buf, RAY_TEST_CONST);
const char *status = "FAILURE";
struct dsn *dsn = NULL;
@@ -715,7 +716,7 @@
struct odbc_obj *obj = NULL;
struct acf_odbc_query *query;
char varname[15], rowcount[12] = "-1";
- struct ast_str *colnames = ast_str_thread_get(&colnames_buf, 16);
+ struct ast_str *colnames = ast_str_thread_get(&colnames_buf, RAY_TEST_CONST);
int res, x, y, buflen = 0, escapecommas, rowlimit = 1, multirow = 0, dsn_num, bogus_chan = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(field)[100];
@@ -726,7 +727,7 @@
SQLSMALLINT collength;
struct odbc_datastore *resultset = NULL;
struct odbc_datastore_row *row = NULL;
- struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
+ struct ast_str *sql = ast_str_thread_get(&sql_buf, RAY_TEST_CONST);
const char *status = "FAILURE";
struct dsn *dsn = NULL;
@@ -903,7 +904,7 @@
buf[0] = '\0';
for (x = 0; x < colcount; x++) {
int i;
- struct ast_str *coldata = ast_str_thread_get(&coldata_buf, 16);
+ struct ast_str *coldata = ast_str_thread_get(&coldata_buf, RAY_TEST_CONST);
char *ptrcoldata;
if (!coldata) {
@@ -1448,7 +1449,7 @@
return CLI_SHOWUSAGE;
}
- sql = ast_str_thread_get(&sql_buf, 16);
+ sql = ast_str_thread_get(&sql_buf, RAY_TEST_CONST);
if (!sql) {
return CLI_FAILURE;
}
@@ -1501,7 +1502,7 @@
int rows = 0, res, x;
SQLSMALLINT colcount = 0, collength;
SQLLEN indicator, octetlength;
- struct ast_str *coldata = ast_str_thread_get(&coldata_buf, 16);
+ struct ast_str *coldata = ast_str_thread_get(&coldata_buf, RAY_TEST_CONST);
char colname[256];
if (!coldata) {
@@ -1664,7 +1665,7 @@
return CLI_SHOWUSAGE;
}
- sql = ast_str_thread_get(&sql_buf, 16);
+ sql = ast_str_thread_get(&sql_buf, RAY_TEST_CONST);
if (!sql) {
return CLI_FAILURE;
}