How can i access the calls report database?

hi ,

everyday we perform a specific job in reports as follow:

we have three shifts per day , and in every shift i have to calculate the answered, busy , ignored …etc calls.

now from pbx i cant do it because it give me the report per day not per specific hour , but by CRI i could do it , but the problem it consumes alot of time to perform what i want , as an example , if i want to calculate the busy calls for the 1st , 2nd , 3rd shift for a specific extention it will be annoying and take along time.

now i began to think in another way,
i want to access the database which contains all the calls , and by scripting or programming , i want my reports to be done dynamically which save my time.

who can advise me in my request ??

it is right ??

what is the nature of database in pbx and does it allow me to do what i want ??

regards