--- cdr_adaptive_odbc.c.orig 2018-11-03 09:18:32.630075166 +0100 +++ cdr_adaptive_odbc.c 2018-11-03 09:19:43.216786974 +0100 @@ -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,10 @@ } AST_LIST_TRAVERSE(&odbc_tables, tableptr, list) { + + if (alreadyinserted==1) + continue; + separator = ""; quoted = 0; @@ -763,6 +769,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);