This is a simple project to convert an asterisk dialplan to a PHP script. The dialplan now performs a look-up of the CALLERID(name) and CALLERID(number) to determine if we already have a record for this pair and if we do increment a counter and update 'last call field' with current date and time. If not, we add it. If a call arrives without a valid CALLERID(name), your script will attempt to match and set 'name' found for this call. Invalid names and numbers are ignored such as '0000000000' or 'UNAVAILABLE'. If the name is different from the record found, we want to update the record with the most current name.
I have attached my dialplan of that you can bid accordingly.