You would need to host your 3CX server on-prem or with a cloud provider that allows access to the CDR files.
Note that the CDR files have a start and end time, but this duration includes the entire time the call was connected to 3CX and not necessarily how long the caller was speaking with an agent --consider, for example, the time waiting in a queue.
While it is possible to create an IP Socket client to communicate with 3CX and receive CDR data, I personally do not recommend this approach. The primary concern being that you could miss call information if the socket connection was down when the call came in. There is no way to get missed call information later with this approach. However, with the CDR file approach, you can always catch up with missed calls.
I assume since you are after the call duration information, that you are OK with getting this information after the call has been disconnected. The CDR files are only created once the call is complete.
If you have access to a secure shell (Linux) or to the 3CX server desktop (Windows), then you can use free tools like WinSCP or FileZilla to download the CDR files. If you want an automated process of getting the data into a SQL database, we can help. I encourage you to take a look at our
3CX Exporter tool.