Assuming your CDR is stored in the database, this information can be gleaned with database queries and Asterisk CLI execution OR an operator panel like iSymphony or FOP2.
If you want somebody to code it for you, I suspect you’d have to be willing to hire them.
Generally the CDR records are generated after the call is finished, the CEL records not so much .
As asterisk’s database in FreePBX only maintains a subset of the state of the machine, and FreePBX only commits to the programmed databases occasionally , you are thus limited as to what you can do. More uptodate state is in the asterisk sqlite3 database than anything in the mysql ones.
For real-time data you probably need either snmp set up and working with the asterisk/digium MIBS, or an AMI process that CAN glean in realtime WeverTF, even the data that the extant MIB’s don’t handle