Logging and reporting calls
Another important aspect of IVRs is the ability to log calls. This helps us to go back and see how many calls have come in and when.
When a call comes in, we will store the phone number and the date and time of the call.
We'll also build a basic monitor to view call logs.
Getting ready
The complete source code for this recipe can be found in the Chapter8/Recipe3/
folder.
How to do it…
Let's set up a simple call logging system that lets us track calls. When a caller calls in, we'll update our database with a log of the call. Then, we'll be able to open a page and view all the calls.
Open
sql.sql
and load the schema into your database.Update
config.php
to your website and make sure your phone tree variables are set:<?php $dbhost = ''; // YOUR DATABASE HOST $dbname = ''; // YOUR DATABASE NAME $dbuser = ''; // YOUR DATABASE USER $dbpass = ''; // YOUR DATABASE PASS $directory = array( '1'=> array( 'phone'=>'415-555-2222', 'firstname' =>...