I understand that you are trying to get the detailed information about the calls, that is when the call came in, when it was answered and when it was disconnected and what is the caller id.
Simply to say call details records CDR in a external database.
If my understanding are correct then google for asterisk Cdr mysql storage.
Asterisk support many database storages for CDR like mysql, postgress, sqlite, MSSQL.
I would suggest you to go for Mysql database storage which I feel that simple to configure.