Asterisk Click2Dial Phonebook, with Grandstream GXP-2000 integration and personal phonebook
Filename: README
Version: 1.1.1
Date: 23/05/08
Author: Tony Ayre localzuk@gmail.com

Requirements:

1. Asterisk 1.2 (untested on other versions)
2. Freepbx 2.2.x
3. Mysql

On a separate machine, if you wish to use the SIMS.net search, you will need a client install of SIMS.net

Installation instructions:

To use this script, you need to do the following:

Create a table in your asterisk database with the name phonebook. The SQL command to do this is below:

CREATE TABLE IF NOT EXISTS `phonebook` (
  `id` int(11) NOT NULL auto_increment,
  `LastName` varchar(30) NOT NULL,
  `FirstName` varchar(30) NOT NULL,
  `phonenumber` varchar(10) NOT NULL,
  `accountindex` smallint(6) NOT NULL default '0',
  `pers_ext` int(5) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `fname` (`LastName`,`FirstName`,`phonenumber`),
  KEY `pers_ext` (`pers_ext`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COMMENT='GXP-2000 Phonebook';

If you wish to use the SIMS.net search, you also need the following 3 tables:

CREATE TABLE IF NOT EXISTS `sims_parents` (
  `id` int(10) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `ln_id` varchar(255) NOT NULL,
  `home` varchar(255) default '0',
  `work` varchar(255) default '0',
  `mobile` varchar(255) default '0',
  `priority` int(2) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3327 ;

CREATE TABLE IF NOT EXISTS `sims_pupils` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `reg` varchar(4) NOT NULL,
  `year` int(2) NOT NULL,
  `address` text NOT NULL,
  `upn` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `name` (`name`,`reg`,`year`,`upn`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=585 ;

CREATE TABLE IF NOT EXISTS `sims_upn_link` (
  `id` int(255) NOT NULL auto_increment,
  `upn` varchar(255) NOT NULL,
  `ln_id` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1861 ;

Install the AsteriskC2D server side software on the asterisk server per the instructions at http://click.rho.cc/Setup/ServerSetup.html

You also need to either alter the server script to accept some other form of authentication, or make use of an LDAP server. I set up an OpenLDAP server and created a basic record in it containing the username and password for a click2dial user. At some point, I will create a modified version of the AsteriskC2D script, which provides a nicer 'completion' page and offers more authentication options out of the box.

To make use of the SIMS.net search, you need to install the included reports onto SIMS.net and alter the commands.cmd file to use a user within your sims.net system. Now, set up a scheduled task to run the commands.cmd file overnight.

You need to set up some way of copying the outputted files to the server which has the php files installed on it. (ie. the freepbx server). This can be achieved in a variety of ways, such as using pscp to copy the files via ssh.

Finally, you need to put the php files, css files and img directory in a web accessible directory on a web server (for example, /var/www/phonebook would be fine in a default Ubuntu server lamp install).

Edit the settings in the global.php file to reflect your installation. you should be cooking with gas.

IF YOU DO NOT WANT TO MAKE USE OF THE SIMS.NET SEARCH:

Delete the files gp_data_import.php, sims_pupil_search.php and edit the file gp_phonebook.php by removing line 68: "echo("<br /><a href='" . $site_address . "sims_pupil_search.php'>Search SIMS.net Pupils</a>");"

KNOWN ISSUES:
It isn't the most beautiful system in the world. But it won't take much to make it look better. For example, a nice logo would make a whole load of difference.

If you find any bugs/issues, please email them to localzuk@gmail.com
