This would be fairly complicated, but possible, with the 3CX Call Control API. However, 3CX has announced that in 3CX V18 they will provide a new Gateway service intended to simplify (or make possible) new 3rd-party integrations with 3CX.
As far as I know, no details have been released about what will be possible with this service, but I hope it will allow us to subscribe to events much the way we can today with the Call Control API. There is no indication whether there will be any developer support offered through 3CX for the announced REST API or Gateway service.
To do this today, you would have to subscribe to call events and keep track yourself of the number of callers waiting in the queue. You would separately have to monitor both extension (DN) and phone registration events to determine what agents are available.