asterisklive call monitor

Asterisk Live Call Monitor By Manager

The following code will connect to the Asterisk Manager and get all live calls and then insert the data into MySQL DB which you can use to display on a web page.

I am assuming Asterisk and MySQL is already installed and configured. Please configure the manager.conf in /etc/asterisk folder and change the setting in the code provided here.

Step 1 : Create a table in MySQL DB

CREATE TABLE `tbl_livecallmanager` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`Uniqueid` varchar(20) DEFAULT NULL,

`ChannelStateDesc` varchar(20) DEFAULT NULL,

`CallerIDNum` varchar(20) DEFAULT NULL,

`Channel` varchar(100) DEFAULT NULL,

`starttime` datetime DEFAULT NULL,

`endtime` timestamp NULL DEFAULT CURRENT_TIMESTAMP,

UNIQUE KEY `id` (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1

Step 2 : Open Crontab and put the following entries

* * * * * /var/www/html/callcenteragi/livecallmanager.php //This Code will monitor the Asterisk Incoming or Outgoing calls we have put that in crontab cause in case of any error with will run automatically, the code itself take care that multiple instance of the same code should not run.

* * * * * /var/www/html/callcenteragi/livecallmanagerhangup.php // This code is to delete the calls from the live call table which are already hangup

Find the attachment for the codes in case of any comments or help required please mail me at i.sandip@gmail.com