TrackMyCalls is a web application written in PHP that keeps a record of all successful calls made to a list of contacts.

 

Overview

This tool is useful for any developer of PHP applications as it contains basic examples of how to integrate third-party applications with Amernet via the Call Events feature.

Let us assume that you are an insurance company that uses Amernet as a Unified Communication system and you want to track down the calls made to customers. You have an internal application and a database containing all the customers. These are not related in any way with Amernet. 

You want to record a note in the internal application every time an employee calls an existing customer. This way, you will have a record for every customer that has received the company’s latest offer. You want to know which calls are successful and which are not and also track down if the customer received the offer from the company.

This example illustrates how you can accomplish this.

This demonstrative code SHOULD NOT be used in production. It is designed simply to show how a client application interacts with Call Events. From this perspective, validations and error-checks aiming to demonstrate the most common mistakes are minimal and can be done easily.

How to Install It

System Requirements

In order to be able to use the TrackMyCalls plug-in, you need a webserver with PHP 5.2.14 or higher installed. Also, please note that the MySQLi PHP extension is necessary to make the TrackMyCalls setup work.

STEP 1: Download the archive, extract the files, and copy them to a directory that can be accessed over the Web.

STEP 2: Allow permissions and ownership rights. You need to give proper permissions and ownership rights to the files of the plugin – the plugin needs to be owned by the web server user and group.

For example, if we use httpd as a webserver:

chmod -R 755 <PATH_TO_TRACKMYCALLS>
chwon -R httpd:httpd <PATH_TO_TRACKMYCALLS>

STEP 3: In order to use the tool, you must first set up the database by running the SQL script located at /sql/callevents.sql

Icon

You should have your DB admin setup a database for you: e.g. trackmycallsdb.

Now, use those values to run the supplied SQL script:

mysql -u<db_user> -p<db_pass> <db_name> < sql/callevents.sql

STEP 4: Configure the tool. As soon as the database is set up, you must configure it by opening the file /config.conf in the <PATH_TO_TRACKMYCALLS>/interface/config/ and changing the following settings:

  • Set the db_host variable to the IP or hostname of your Amernet server;
  • Set the db_username variable to the username used for accessing the database;
  • Set the db_password variable to the password used by the user;
  • Set the db_databaseName variable to the database you have set up.

How It Works

As soon as calls are placed, the information about the callers involved will be recorded in the database. Calls made to phone numbers that don not exist in the database are ignored. That is why, in order to make this work, you have to insert some contacts in the database (along with their phone numbers).

How to Use It

In order to make this script usable, you need to follow these steps:

STEP 1: Register an extension using a real phone or a softphone.

STEP 2: In the extension manager of your Amernet administration page, select the extension you wish to monitor and click Call Events.

STEP 3: Configure a ‘Hangup’ event by clicking on the corresponding link.

STEP 4: Select POST as request method and fill in the Make request to text area with the URL which points to your script.

STEP 5: Click OK to confirm your settings.

STEP 6: Make a call to a number from the contacts list. If the callee answers, a note is written in the database:

| customerId | notes                                                                                                           |
+------------+-----------------------------------------------------------------------------------------------------------------+
|          2 | Client John Doe with phone # '0003*003' has been called by Employee with ID '002'. Time: 13:33:41 21 Sep 2012   |
|          1 | Client Alan John with phone # '0003*004' has been called by Employee with ID '002'. Time: 13:39:46 21 Sep 2012  |

Example

You register extension 002, which in our case could be the employee, and then you call extension 003 which would be the client. A note will be inserted only if number 003 answers the call. The client’s extension can, of course, be an external number.