--- cdr_adaptive_odbc.c.orig 2018-10-25 15:34:05.630252545 +0200 +++ cdr_adaptive_odbc.c 2018-10-25 15:38:13.655278204 +0200 @@ -397,6 +397,8 @@ return -1; } + int alreadyinserted = 0; + if (AST_RWLIST_RDLOCK(&odbc_tables)) { ast_log(LOG_ERROR, "Unable to lock table list. Insert CDR(s) failed.\n"); ast_free(sql); @@ -405,6 +407,8 @@ } AST_LIST_TRAVERSE(&odbc_tables, tableptr, list) { + if (alreadyinserted==1) + continue; separator = ""; quoted = 0; @@ -763,6 +767,8 @@ } if (rows == 0) { ast_log(LOG_WARNING, "cdr_adaptive_odbc: Insert failed on '%s:%s'. CDR failed: %s\n", tableptr->connection, tableptr->table, ast_str_buffer(sql)); + } else { + alreadyinserted=1; } early_release: ast_odbc_release_obj(obj);