CDR Configuration : Storing calls and missing others!

I’m using Asterisk 11.25.1 on a server running on CentOs 6.9.
I’ve configured Asterisk to store calls in a mysql database using unixODBC. The problem is that Asterisk store some calls and miss others!
For example if i recieve 300 calls, it only store 160!
From time to time, in the CLI, i get this error : cdr_odbc.c:163 odbc_log: Unable to retrieve database handle. CDR failed.
My configuration files :

Description = MySQL connection to ‘asterisk’ database
Driver = MySQL
Server = localhost
Database = asterisk
User = asterisk
Password = asterisk
Port = 3306
Option = 3
Socket = /var/lib/mysql/mysql.sock
Trace = On
TraceFile = /var/log/odbc.log


Description = ODBC for MySQL
Driver = /usr/lib/
Setup = /usr/lib/
Driver64 = /usr/lib64/
Setup64 = /usr/lib64/
FileUsage = 1
Pooling = Yes
CPTimeout = 120


enabled => yes
dsn => asterisk-connector
pre-connect => yes
pooling => yes
limit => 100


alias start=calldate


dsn =asterisk-connector
dispositionstring =yes
table =cdr
usegmtime =no
hrtime =yes
newcdrcolumns =yes
loguniqueid =yes

I hope that you can help me with this. Thank you.

Your version of Asterisk is quite old and no longer supported. You may not find anyone here who is able to provide assistance with it. I’ve already forgotten quite a lot about Asterisk 11, and bugs have been fixed since.