There are a couple of challenges that must be overcome when building custom solutions for 3CX. (1) 3CX Support does not want any non-3cx software installed directly on the 3CX server, (2) the 3CX Call Control API only responds to requests from localhost, (3) call history records are not accessible via any API (although you can get limited information from the CDR files), and (4) last time I checked you are only allowed to have one active connection to the Call Control API at a time.
If you want access to the Call Control API, you are going to need some kind of REST / WCF based API that exposes the call control API to remote computers (since 3CX doesn't want you installing applications on the 3CX server). It's a bit of a catch-22 because you can't install anything on the 3CX server, but the call control API only responds to localhost requests. Our solution was to build a small Relay application (very small footprint) that is installed on the 3CX server and makes the one permitted connection to the API. Then our applications are installed on a separate server and communicate with 3CX through the Relay.
Our current Relay uses WCF for communication, but our new Relay uses REST and SignalR for communication. Since our add-on applications all need to communicate with 3CX for various reasons we have elected to make our REST API available through our Universal suite of tools. So if any of our application needs the REST API to function, we will make that function available to any developer who purchases our Suite of tools. If you need an API method that is not part of our REST API, we will consider adding it. The Relay makes it possible to install custom applications anywhere regardless of where our tools or 3CX are installed. Our new Relay
To access historical call information, the only supported method is either using 3CX reports or by processing the optionally created CDR files. While the data contained in the CDR files is limited, it still has very valuable information in an easy-to-interpret structure. But if you need more information than what's available in the CDR files (queue statistics for example) then the only option is to pull the data directly from the 3CX PostgreSQL database. But let me be very clear on this point, accessing the 3CX database directly is not supported and strongly discouraged by 3CX support. 3CX has a good reason for being restrictive about people accessing the database directly -- you can really screw things up if you are not extremely careful. One safe option (although not endorsed by 3CX) is to use our Exporter tool to copy the data from the PostgreSQL database to either Microsoft SQL or MySQL. Exporter has been in use for about 7-8 years with no reported issues. Once you have the data in SQL, you can build whatever reports / queries you need without impacting 3CX in any way.