There are situations where using an IP socket approach is the only option (3CX Hosted Instances for example). However, when possible, I would NOT take this approach.
If your socket goes down for any reason (internet outage, software upgrade, service crash, etc.), any calls that complete during that time will not be captured and the data will be lost forever. As a result, any reports generated from the CDR data will be incomplete at best and completely wrong at worst.
The only safe way to collect CDR data is to configure 3CX to write the data to a file, and then have your CDR service process the files. The beauty of this approach is that you can take down your CDR service at any time, and when you start it up again it will process the back transactions that took place while your service was down. In other words, NO LOST DATA ever.
The primary challenge to this approach is how to get the files from your 3CX server, especially if 3CX is hosted in the cloud. You could use a tool like FileZilla to access your 3CX instance and manually copy the files. However, I am confident you can find off-the-shelf software that can automatically move the files to a central location. Once the files are at the central server, your service could parse the CDR files and insert the data into a database. My recommendation would be to configure 3CX to write a separate file for each call -- that way you can process each call as they complete.
Alternatively, you could look at our
3CX Exporter tool that automates the entire process. It will, in real time, process the individual CDR files and put the data into a SQL / MySQL database.