Hot To Get Agent Extension From Recorded Call File Name Unique Id in FreePBX DB

Hello Guys!

We are using FreePBX version

I am developing a PHP application to move all the FreePBX recorded call files to another server dedicated just for storing these recorded calls. Now I would like to be able to rename these files to add the agent extension number in our call center so our manager can easily identify each of these recorded file names when training their agents. Is there a way to obtain the agent extension number, based on the unique id in the FreePBX database? Where is the database? What is the database name? Which table? Please help.

Here is the file name structure that is being recorded in the present moment:
| | | |
| | | _unique id
| | |
| | _timestamp
| |
| _datestamp
_queue number

Thank you.