Asterisk/astguiclient install from existing server.    v.2.0.4        2007-12-03
   By the astGUIclient group                              astguiclient@eflo.net


This document is meant to be more of an overview of a VICIDIAL/astGUIclient 
installation. If you are looking for more detail or are having problems with 
installation please read the SCRATCH_INSTALL.txt document.

End-user Manuals for Agents and Managers are available from http://www.eflo.net

REQUIREMENTS:
- root access on the server you want to install asGUIclient/VICIDIAL on to.
- Zap trunks(T1/E1 or PSTN lines), IAX2 trunks or SIP trunks required
- You must have a zaptel timer like a PSTN/T1/E1 card or ztdummy
   or you can use the experimental app_conference module
- Client phones can be SIP/IAX/Zap
- SoX 12.17.5 or greater must be installed
- GNU screen 3.9.15 or greater must be installed
- ntp must be installed and syncd to same time source as any other servers
- Perl5 with several CPAN modules(Time::HiRes, DBI, DBD::mysql, Net::Telnet, Net::Server etc)
- asterisk-perl 0.08, do NOT use the 0.09 version, it does not work with VICIDIAL
- MySQL server or mysqlclientlibs, must be version 4.0.X or higher
- If you will be installing Asterisk 1.4 releases you need Gnu Make 3.81
- Apache/PHP server with php.ini memory_limit set to 48M




PHASE 1: INSTALLING ASTERISK

1. follow these command line steps:
mkdir /usr/src/asterisk
cd /usr/src/asterisk
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz
gunzip asterisk-1.2.24.tar.gz
tar xvf asterisk-1.2.24.tar
gunzip zaptel-1.2.21.tar.gz
tar xvf zaptel-1.2.21.tar
gunzip libpri-1.2.5.tar.gz
tar xvf libpri-1.2.5.tar
cd ./zaptel-1.2.21
wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz
gunzip newt-0.51.6.tar.gz
tar xvf newt-0.51.6.tar
cd newt-0.51.6
./configure
make
make install
cd ../
ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51
make clean
make zttool
make
make install
cd ../libpri-1.2.5
make clean
make
make install
cd ../asterisk-1.2.24
	(1.2 tree) If you want to include Answering Machine Detection ability
	  you will need to download app_amd.c and amd.conf and alter the 
	  apps/Makefile to compile it properly
	cd apps
	wget http://www.eflo.net/files/app_amd2.c
	mv app_amd2.c app_amd.c
	vi Makefile
	  replace this line(line 32):
	       app_mixmonitor.so app_stack.so
	  with this line:
	       app_mixmonitor.so app_stack.so app_amd.so
	wget http://www.eflo.net/files/amd2.conf
	mkdir /etc/asterisk
	mv amd2.conf /etc/asterisk/amd.conf
	*OPTIONAL*(1.2.23 thru 1.2.24) apply the meetme DTMF passthru patch
	wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch
	patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch
		- File to patch: app_meetme.c
	*OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch
		*Different patches available for 1.2.7.1 through 1.2.14
	wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch
	patch -p1 < ./meetme_volume_control_1.2.16.patch
		- File to patch: app_meetme.c
	cd ../

	(1.2 tree) apply the cli delimiter patch
	wget http://www.eflo.net/files/cli_chan_concise_delimiter.patch
	patch -p1 < ./cli_chan_concise_delimiter.patch
		- File to patch: cli.c

	*OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence
	wget http://www.eflo.net/files/app_waitforsilence.c
	mv app_waitforsilence.c apps/app_waitforsilence.c

	*OPTIONAL* shorter enter and leave sounds for meetme
	wget http://www.eflo.net/files/enter.h
	wget http://www.eflo.net/files/leave.h
	mv -f enter.h apps/enter.h
	mv -f leave.h apps/leave.h

make clean
make
make install
make samples		# this makes sample conf files (only use for new installs)

modprobe zaptel	# this loads the zaptel module
	- install the module for the digium device that you are using, we are 
	using the T100P single span T1 card so we use:
modprobe wct1xxp
	   Here's the list of all digium cards and the modules you use with 
them:
		Card      Module
		-----------------
		TDM400P   wctdm
		X100P     wcfxo
		TDM*	  wcfxs
		S100U     wcusb
		T100P     wct1xxp
		E100P     wct1xxp
		T400P     tor2
		E400P     tor2
		TE110P    wcte11xp
		TE410P    wct4xxp
		TE405P    wct4xxp
		TE411P    wct4xxp
		TE406P    wct4xxp
		TE210P    wct2xxp
		TE205P    wct2xxp
		TDM2400P  wctdm24xxp
	- If you have chosen a Sangoma T1/E1 or analog card, you will need to 
	  follow their instructions for installation of their driver software
	  LATEST Sangoma Wanpipe drivers: 
	  ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-2.3.4-13.tgz
   - now your asterisk installation is built and loaded and it's time to 
configure it.

NOTES: If you want to install zttool diagnostics you may need the newt package installed:
http://www.freedomphones.net/files/newt-0.51.6.tar.gz
ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51
then go to your zaptel folder and do 'make zttool' 

Digium/Clone X100P EXAMPLE for reliable cheap hardware timer:
./conf_examples/zaptel.conf.x100p.sample
./conf_examples/zapata.conf.x100p.sample

Digium/Clone T100P EXAMPLE, also works for TE4xxp cards
./conf_examples/zaptel.conf.t100p.sample
./conf_examples/zapata.conf.t100p.sample





PHASE 2: CONFIGURING ASTERISK

Sample conf files for a system with:
- astGUIclient and VICIDIAL
- two SIP phones
- one IAX phone
- a SIP trunk
- an IAX trunk
- a set of Zap phones through a channelbank
- a Zap T1 PRI line with 23 voice channels
These are available in these sample conf files:
./conf_examples/sip.conf.sample
./conf_examples/iax.conf.sample
./conf_examples/extensions.conf.sample
./conf_examples/meetme.conf.sample
./conf_examples/voicemail.conf.sample
./conf_examples/manager.conf.sample
./conf_examples/logger.conf.sample
./conf_examples/dnsmgr.conf.sample

For more information on configuring Asterisk or your phones read the 
SCRATCH_INSTALL document.





PHASE 3: INSTALLING ASTGUICLIENT AND VICIDIAL

Now that Asterisk is installed and running we can add the astGUIclient and 
VICIDIAL components to the system.

There are two methods for downloading astGUIclient/VICIDIAL, a release and SVN

1. Go to http://astguiclient.sf.net/ and download the latest astguiclient 
package(as of this writing it is 2.0.4)
   - for 2.0.X release:
	mkdir /usr/src/astguiclient
	cd /usr/src/astguiclient
	wget http://internap.dl.sourceforge.net/sourceforge/astguiclient/astguiclient_2.0.4.zip
	unzip astguiclient_2.0.4.zip
	perl install.pl
   - for SVN 2.0 trunk:
	mkdir /usr/src/astguiclient
	cd /usr/src/astguiclient
	svn checkout svn://svn.eflo.net:43690/agc_2-X/trunk
	cd trunk
	perl install.pl
	    select to do interactive setup and customize to your server
   - there is one more file you need that's not included with the download 
package, it's the conf.gsm file(this is the half-hour music file that we use 
to put people on hold). I have a free classical music file that is available 
free for download at the following two sites:
	http://www.freedomphones.net/conf.gsm
	http://astguiclient.sf.net/conf.gsm
   Once you have downloaded it, you will need to copy it to this folder:
		/var/lib/asterisk/sounds/
   Then you will need to execute this command to copy it as the park file
   'cp /var/lib/asterisk/sounds/conf.gsm /var/lib/asterisk/sounds/park.gsm'
  Here are the steps spelled out:
	cd /var/lib/asterisk/sounds
	wget http://www.freedomphones.net/conf.gsm 
	cp conf.gsm park.gsm
   - you are done

If you will be doing native music-on-hold for your inbound calls, you will need 
musiconhold audio files to be converted to native formats like GSM, ULAW and ALAW:

	cd /var/lib/asterisk/mohmp3/
	mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw
	sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav
	sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm
	sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm
	mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw
	sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav
	sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm
	sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm
	mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw
	sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav
	sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
	sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
	rm -f *.raw
	mkdir ../orig-mp3
	mv -f *.mp3 ../orig-mp3/





PHASE 4: CREATING MYSQL DATABASE AND POPULATING IT

we will create the database and add a few initial records so that we can 
use the administrative web interface. Since this is a new install it is easier 
to use our new mysql script file to add the tables to the database:

1.  at the command prompt type go to the mysql client: 
/usr/local/mysql/bin/mysql
2.  type the following into the mysql client prompt:
   (make sure you put your IP address in place of "10.10.10.15" in the queries below)
######------ BEGIN Mysql data entry(you can copy and paste this into terminal) #

create database asterisk;

GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234';
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234';

use asterisk;

\. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql
	or you may need to run this if you get an error:
	\. /usr/src/astguiclient/astguiclient/MySQL_AST_CREATE_tables.sql

##### make sure on these queries that you change the server_ip "10.10.10.15" 
##### to the server IP that you are using

insert into servers (server_id,server_description,server_ip,active,asterisk_version)values('TESTasterisk','Test install of Asterisk server', '10.10.10.15','Y','1.2.24');

insert into server_updater values('10.10.10.15','');

insert into phones (extension, dialplan_number, voicemail_id, phone_ip, computer_ip, server_ip, login, pass, status, active, phone_type, fullname, company, picture, messages, old_messages, protocol) values('gs102','102','102','10.10.10.16','10.10.9.16','10.10.10.15','gs102','test', 'ADMIN','Y','Grandstream BT 102','Test Admin Phone','TEST','','0','0','SIP');

insert into vicidial_users (user,pass,full_name,user_level,user_group,load_leads,campaign_detail,ast_admin_access,modify_users) values('6666','1234','Admin','9','ADMIN','1','1','1','1');

insert into conferences values('8600001','10.10.10.15','');
insert into conferences values('8600002','10.10.10.15','');
insert into conferences values('8600003','10.10.10.15','');
insert into conferences values('8600004','10.10.10.15','');
insert into conferences values('8600005','10.10.10.15','');
insert into conferences values('8600006','10.10.10.15','');
insert into conferences values('8600007','10.10.10.15','');
insert into conferences values('8600008','10.10.10.15','');
insert into conferences values('8600009','10.10.10.15','');
insert into conferences values('8600010','10.10.10.15','');
insert into conferences values('8600011','10.10.10.15','');
insert into conferences values('8600012','10.10.10.15','');
insert into conferences values('8600013','10.10.10.15','');
insert into conferences values('8600014','10.10.10.15','');
insert into conferences values('8600015','10.10.10.15','');
insert into conferences values('8600016','10.10.10.15','');
insert into conferences values('8600017','10.10.10.15','');
insert into conferences values('8600018','10.10.10.15','');
insert into conferences values('8600019','10.10.10.15','');
insert into conferences values('8600020','10.10.10.15','');
insert into conferences values('8600021','10.10.10.15','');
insert into conferences values('8600022','10.10.10.15','');
insert into conferences values('8600023','10.10.10.15','');
insert into conferences values('8600024','10.10.10.15','');
insert into conferences values('8600025','10.10.10.15','');
insert into conferences values('8600026','10.10.10.15','');
insert into conferences values('8600027','10.10.10.15','');
insert into conferences values('8600028','10.10.10.15','');
insert into conferences values('8600029','10.10.10.15','');

insert into vicidial_conferences values('8600051','10.10.10.15','');
insert into vicidial_conferences values('8600052','10.10.10.15','');
insert into vicidial_conferences values('8600053','10.10.10.15','');
insert into vicidial_conferences values('8600054','10.10.10.15','');
insert into vicidial_conferences values('8600055','10.10.10.15','');
insert into vicidial_conferences values('8600056','10.10.10.15','');
insert into vicidial_conferences values('8600057','10.10.10.15','');
insert into vicidial_conferences values('8600058','10.10.10.15','');
insert into vicidial_conferences values('8600059','10.10.10.15','');
insert into vicidial_conferences values('8600060','10.10.10.15','');
insert into vicidial_conferences values('8600061','10.10.10.15','');
insert into vicidial_conferences values('8600062','10.10.10.15','');
insert into vicidial_conferences values('8600063','10.10.10.15','');
insert into vicidial_conferences values('8600064','10.10.10.15','');
insert into vicidial_conferences values('8600065','10.10.10.15','');
insert into vicidial_conferences values('8600066','10.10.10.15','');
insert into vicidial_conferences values('8600067','10.10.10.15','');
insert into vicidial_conferences values('8600068','10.10.10.15','');
insert into vicidial_conferences values('8600069','10.10.10.15','');
insert into vicidial_conferences values('8600070','10.10.10.15','');
insert into vicidial_conferences values('8600071','10.10.10.15','');
insert into vicidial_conferences values('8600072','10.10.10.15','');
insert into vicidial_conferences values('8600073','10.10.10.15','');
insert into vicidial_conferences values('8600074','10.10.10.15','');
insert into vicidial_conferences values('8600075','10.10.10.15','');
insert into vicidial_conferences values('8600076','10.10.10.15','');
insert into vicidial_conferences values('8600077','10.10.10.15','');
insert into vicidial_conferences values('8600078','10.10.10.15','');
insert into vicidial_conferences values('8600079','10.10.10.15','');
insert into vicidial_conferences values('8600080','10.10.10.15','');
insert into vicidial_conferences values('8600081','10.10.10.15','');
insert into vicidial_conferences values('8600082','10.10.10.15','');
insert into vicidial_conferences values('8600083','10.10.10.15','');
insert into vicidial_conferences values('8600084','10.10.10.15','');
insert into vicidial_conferences values('8600085','10.10.10.15','');
insert into vicidial_conferences values('8600086','10.10.10.15','');
insert into vicidial_conferences values('8600087','10.10.10.15','');
insert into vicidial_conferences values('8600088','10.10.10.15','');
insert into vicidial_conferences values('8600089','10.10.10.15','');
insert into vicidial_conferences values('8600090','10.10.10.15','');
insert into vicidial_conferences values('8600091','10.10.10.15','');
insert into vicidial_conferences values('8600092','10.10.10.15','');
insert into vicidial_conferences values('8600093','10.10.10.15','');
insert into vicidial_conferences values('8600094','10.10.10.15','');
insert into vicidial_conferences values('8600095','10.10.10.15','');
insert into vicidial_conferences values('8600096','10.10.10.15','');
insert into vicidial_conferences values('8600097','10.10.10.15','');
insert into vicidial_conferences values('8600098','10.10.10.15','');
insert into vicidial_conferences values('8600099','10.10.10.15','');
insert into vicidial_conferences values('8600100','10.10.10.15','');
insert into vicidial_conferences values('8600101','10.10.10.15','');
insert into vicidial_conferences values('8600102','10.10.10.15','');
insert into vicidial_conferences values('8600103','10.10.10.15','');
insert into vicidial_conferences values('8600104','10.10.10.15','');
insert into vicidial_conferences values('8600105','10.10.10.15','');
insert into vicidial_conferences values('8600106','10.10.10.15','');
insert into vicidial_conferences values('8600107','10.10.10.15','');
insert into vicidial_conferences values('8600108','10.10.10.15','');
insert into vicidial_conferences values('8600109','10.10.10.15','');
insert into vicidial_conferences values('8600110','10.10.10.15','');
insert into vicidial_conferences values('8600111','10.10.10.15','');
insert into vicidial_conferences values('8600112','10.10.10.15','');
insert into vicidial_conferences values('8600113','10.10.10.15','');
insert into vicidial_conferences values('8600114','10.10.10.15','');
insert into vicidial_conferences values('8600115','10.10.10.15','');
insert into vicidial_conferences values('8600116','10.10.10.15','');
insert into vicidial_conferences values('8600117','10.10.10.15','');
insert into vicidial_conferences values('8600118','10.10.10.15','');
insert into vicidial_conferences values('8600119','10.10.10.15','');
insert into vicidial_conferences values('8600120','10.10.10.15','');
insert into vicidial_conferences values('8600121','10.10.10.15','');
insert into vicidial_conferences values('8600122','10.10.10.15','');
insert into vicidial_conferences values('8600123','10.10.10.15','');
insert into vicidial_conferences values('8600124','10.10.10.15','');
insert into vicidial_conferences values('8600125','10.10.10.15','');
insert into vicidial_conferences values('8600126','10.10.10.15','');
insert into vicidial_conferences values('8600127','10.10.10.15','');
insert into vicidial_conferences values('8600128','10.10.10.15','');
insert into vicidial_conferences values('8600129','10.10.10.15','');
insert into vicidial_conferences values('8600130','10.10.10.15','');
insert into vicidial_conferences values('8600131','10.10.10.15','');
insert into vicidial_conferences values('8600132','10.10.10.15','');
insert into vicidial_conferences values('8600133','10.10.10.15','');
insert into vicidial_conferences values('8600134','10.10.10.15','');
insert into vicidial_conferences values('8600135','10.10.10.15','');
insert into vicidial_conferences values('8600136','10.10.10.15','');
insert into vicidial_conferences values('8600137','10.10.10.15','');
insert into vicidial_conferences values('8600138','10.10.10.15','');
insert into vicidial_conferences values('8600139','10.10.10.15','');
insert into vicidial_conferences values('8600140','10.10.10.15','');
insert into vicidial_conferences values('8600141','10.10.10.15','');
insert into vicidial_conferences values('8600142','10.10.10.15','');
insert into vicidial_conferences values('8600143','10.10.10.15','');
insert into vicidial_conferences values('8600144','10.10.10.15','');
insert into vicidial_conferences values('8600145','10.10.10.15','');
insert into vicidial_conferences values('8600146','10.10.10.15','');
insert into vicidial_conferences values('8600147','10.10.10.15','');
insert into vicidial_conferences values('8600148','10.10.10.15','');
insert into vicidial_conferences values('8600149','10.10.10.15','');
insert into vicidial_conferences values('8600150','10.10.10.15','');
insert into vicidial_conferences values('8600151','10.10.10.15','');
insert into vicidial_conferences values('8600152','10.10.10.15','');
insert into vicidial_conferences values('8600153','10.10.10.15','');
insert into vicidial_conferences values('8600154','10.10.10.15','');
insert into vicidial_conferences values('8600155','10.10.10.15','');
insert into vicidial_conferences values('8600156','10.10.10.15','');
insert into vicidial_conferences values('8600157','10.10.10.15','');
insert into vicidial_conferences values('8600158','10.10.10.15','');
insert into vicidial_conferences values('8600159','10.10.10.15','');
insert into vicidial_conferences values('8600160','10.10.10.15','');
insert into vicidial_conferences values('8600161','10.10.10.15','');
insert into vicidial_conferences values('8600162','10.10.10.15','');
insert into vicidial_conferences values('8600163','10.10.10.15','');
insert into vicidial_conferences values('8600164','10.10.10.15','');
insert into vicidial_conferences values('8600165','10.10.10.15','');
insert into vicidial_conferences values('8600166','10.10.10.15','');
insert into vicidial_conferences values('8600167','10.10.10.15','');
insert into vicidial_conferences values('8600168','10.10.10.15','');
insert into vicidial_conferences values('8600169','10.10.10.15','');
insert into vicidial_conferences values('8600170','10.10.10.15','');
insert into vicidial_conferences values('8600171','10.10.10.15','');
insert into vicidial_conferences values('8600172','10.10.10.15','');
insert into vicidial_conferences values('8600173','10.10.10.15','');
insert into vicidial_conferences values('8600174','10.10.10.15','');
insert into vicidial_conferences values('8600175','10.10.10.15','');
insert into vicidial_conferences values('8600176','10.10.10.15','');
insert into vicidial_conferences values('8600177','10.10.10.15','');
insert into vicidial_conferences values('8600178','10.10.10.15','');
insert into vicidial_conferences values('8600179','10.10.10.15','');
insert into vicidial_conferences values('8600180','10.10.10.15','');
insert into vicidial_conferences values('8600181','10.10.10.15','');
insert into vicidial_conferences values('8600182','10.10.10.15','');
insert into vicidial_conferences values('8600183','10.10.10.15','');
insert into vicidial_conferences values('8600184','10.10.10.15','');
insert into vicidial_conferences values('8600185','10.10.10.15','');
insert into vicidial_conferences values('8600186','10.10.10.15','');
insert into vicidial_conferences values('8600187','10.10.10.15','');
insert into vicidial_conferences values('8600188','10.10.10.15','');
insert into vicidial_conferences values('8600189','10.10.10.15','');
insert into vicidial_conferences values('8600190','10.10.10.15','');
insert into vicidial_conferences values('8600191','10.10.10.15','');
insert into vicidial_conferences values('8600192','10.10.10.15','');
insert into vicidial_conferences values('8600193','10.10.10.15','');
insert into vicidial_conferences values('8600194','10.10.10.15','');
insert into vicidial_conferences values('8600195','10.10.10.15','');
insert into vicidial_conferences values('8600196','10.10.10.15','');
insert into vicidial_conferences values('8600197','10.10.10.15','');
insert into vicidial_conferences values('8600198','10.10.10.15','');
insert into vicidial_conferences values('8600199','10.10.10.15','');
insert into vicidial_conferences values('8600200','10.10.10.15','');

### insert test vicidial leads, you may want to replace 7275551212
### with a real number to test in these records
insert into vicidial_list values('','2004-01-06','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead01','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');
insert into vicidial_list values('','2004-01-06','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead02','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');
insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead03','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');
insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead04','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');
insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead05','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');
insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead06','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');
insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead07','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0');

### these first 5 must be in all VICIDIAL systems for it to work properly #
insert into vicidial_statuses values('NEW','New Lead','N','N','UNDEFINED');
insert into vicidial_statuses values('QUEUE','Lead To Be Called','N','N','UNDEFINED');
insert into vicidial_statuses values('INCALL','Lead Being Called','N','N','UNDEFINED');
insert into vicidial_statuses values('DROP','Agent Not Available','N','Y','UNDEFINED');
insert into vicidial_statuses values('NA','No Answer AutoDial','N','N','UNDEFINED');

insert into vicidial_statuses values('CALLBK','Call Back','Y','Y','UNDEFINED');
insert into vicidial_statuses values('A','Answering Machine','Y','N','UNDEFINED');
insert into vicidial_statuses values('AA','Answering Machine Auto','N','N','UNDEFINED');
insert into vicidial_statuses values('AM','Answering Machine Sent to Mesg','N','N','UNDEFINED');
insert into vicidial_statuses values('AL','Answering Machine Msg Played','N','N','UNDEFINED');
insert into vicidial_statuses values('B','Busy','Y','N','UNDEFINED');
insert into vicidial_statuses values('DC','Disconnected Number','Y','N','UNDEFINED');
insert into vicidial_statuses values('DEC','Declined Sale','Y','Y','UNDEFINED');
insert into vicidial_statuses values('DNC','DO NOT CALL','Y','Y','UNDEFINED');
insert into vicidial_statuses values('SALE','Sale Made','Y','Y','UNDEFINED');
insert into vicidial_statuses values('N','No Answer','Y','N','UNDEFINED');
insert into vicidial_statuses values('NI','Not Interested','Y','Y','UNDEFINED');
insert into vicidial_statuses values('NP','No Pitch No Price','Y','Y','UNDEFINED');
insert into vicidial_statuses values('XFER','Call Transferred','Y','Y','UNDEFINED');

quit

   run this command from command line:
	- /usr/share/astguiclient/ADMIN_area_code_populate.pl

######------ END Mysql data entry ------######

NOTE: if you are not installing using default user/pass or have MySQL on another 
server, you will need to edit either the /etc/astguiclient.conf file or the 
dbconnect.php files in the astguiclient, vicidial and agc directories of your 
webroot.

3. Enter the astguiclient administration page:
http://10.10.10.15/vicidial/admin.php
NOTE: if you click on the Logout button you must leave the user/pass empty and click OK
   - Here you will enter the login and password that you inserted into the mysql 
database in the vicidial_users table (above [6666/1234])
   - Now that you are logged into the astGUIclient administration system we can 
add a new phone entry for each of the sipura lines we created.
	- click on the "PHONES" link at the top, then the "ADD PHONE" link below
that and enter in the proper information for each of the new phone lines. 
Here's what we entered for spa2000:
   - Phone extension: spa2000
   - Dialplan Number: 2000
   - Voicemail Box: 2000
   - Phone IP address: 10.10.10.17
   - Computer IP address: 10.10.9.17
   - Server IP: 10.10.10.15
   - Login: spa2000
   - Password: test
   - Status: ACTIVE
   - Active Account: Y	
   - Phone Type: Sipura SPA-2000 line 1
   - Full Name: Sipura line 1 test
   - Company: TEST
   - Picture:
   - Protocol: SIP
   - for the next phone simply replace 2000 with 2001 in the above example
   - now your phones are all all set up in the astguiclient system and you can 
use this website to add new phones to be used with astguiclient and monitor 
the number of calls people are making.
	- click on the "LIST ALL SERVERS" link at the top then click on the
	server to modify. Verify that the GMT time zone and all other fields 
	are what you want them to be. There is a setting(Max VICIDIAL Trunks)
	that can be modified to limit the number of VICIDIAL outbound trunks 
	that will be allowed to use on this server.

**OPTIONAL** For Zap clients you will need to use full Zap Channel name as the
extension on the admin page entry: "1-1" for our Zap phone example 
previously. And do not forget to set the protocol on this page to Zap





PHASE 5: ADDING STARTUP ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS

1. Make several entries in the rc.local of your system:
   - on the command line type:
	- vi /etc/rc.d/rc.local
	   - add the following entries(here's what we used):

### Path to local asterisk-perl_0.08 module if needed
PERL5LIB="/usr/share/astguiclient/libs"; export PERL5LIB

### start time server
/usr/local/bin/ntpdate -u 18.145.0.30
/usr/sbin/ntpd

### start up the MySQL server
/usr/local/mysql/bin/mysqld_safe --user=mysql --skip-name-resolve --skip-host-cache &

### roll the Asterisk logs upon reboot
/usr/share/astguiclient/ADMIN_restart_roll_logs.pl

### clear the server-related records from the database
/usr/share/astguiclient/AST_reset_mysql_vars.pl

### start up the apache web server
/usr/local/apache2/bin/apachectl start

### load digium zaptel 4xT1 drivers into system
# if using Sangoma card, put wanrouter start in place or modprobes
modprobe zaptel
modprobe wct4xxp
/sbin/ztcfg -vvvvvvvvvvvv

### sybsys local login
touch /var/lock/subsys/local

### sleep for 10 seconds before launching Asterisk
sleep 10

### start up asterisk
/usr/share/astguiclient/start_asterisk_boot.pl

   - you are done





PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS

1. Make several entries in the cron of your system:
   - on the command line type:
	- cd /usr/share/astguiclient
	- crontab -e
	   - add the following entries(here's what we used):
	      (Note if you have not edited the AST_CRON_mix_recordings.pl script 
to FTP to a different server, then you should use the 
AST_CRON_mix_recordings_BASIC.pl file in it's place)

### recording mixing for Asterisk run every 5 minutes
1,6,11,16,21,26,31,36,41,46,51,56 * * * 1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl

### keepalive script for astguiclient processes
* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl

### kill Hangup script for Asterisk updaters
* * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl

### updater for voicemail
* * * * * /usr/share/astguiclient/AST_vm_update.pl

### updater for conference validator
* * * * * /usr/share/astguiclient/AST_conf_update.pl

### flush queue DB table every hour for entries older than 1 hour
11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q

### fix the vicidial_agent_log once every hour
33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl

### updater for VICIDIAL hopper
* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q

### adjust the GMT offset for the leads in the vicidial_list table
1 1,7 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --debug --postal-code-gmt

### reset several temporary-info tables in the database
2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl

### optimize the database tables within the asterisk database
3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl

## adjust time on the server with ntp
30 * * * * /usr/local/bin/ntpdate -u 18.145.0.30 2>/dev/null 1>&2

### VICIDIAL agent time log weekly summary report generation
2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl

### remove old recordings more than 7 days old
24 0 * * * /usr/bin/find /var/spool/asterisk/monitor -maxdepth 2 -type f -mtime +7 -print | xargs rm -f

### remove old vicidial logs and asterisk logs more than 2 days old
28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f
29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f



   - once your system starts up you can attach to the screen running asterisk by 
typing "screen -r <screen>" find which screen by typing "screen -r" and 
looking for the lowest screen number. Then to detach again from the screen 
while you are in it type 'Ctrl+a' then 'd'
   - you are done





PHASE 7: ADDING TEST LEADS TO VICIDIAL AND CONFIGURING A TEST CAMPAIGN AND USERS

First we will add a few test leads to the vicidial_list table so that we can 
test our system. There is also an application included with the distribution 
that will accept a delimited file of leads placed in the /usr/share/astguiclient/VICIDIAL/LEADS_IN/
directory and load it into the database automatically(VICIDIAL_IN_new_leads_file.pl
[a sample lead file in the proper format is included with this release:
 - test_VICIDIAL_lead_file.txt])
If you want to use the lead import script I suggest looking at the code to make
sure it is entering what you want it to. We are not going to go over that 
particular script in this document.

Also, there is a web-based lead loader available and is accessible from the 
VICIDIAL admin.php web page(click on the "LOAD NEW LEADS" link in the LIST 
section at the top of the admin page). To get to this page you must have 
permissions in the vicidial_user table(Load Leads set to 1). Instructions on 
it's use are included on the page through the help question mark link.

NOTE: in PHP you must have "fileuploads" enabled for this page to work.
NOTE: it is important to have your proper country code in the phone_code field 
of your leads so that the GMT offset encodding will properly code the time 
zones for your leads. For the USA/Canada/Caribbean this would be 1. For the 
UK this is 44 and Mexico is 52 and so on.

Now that the sample leads have been entered, we can go into the VICIDIAL 
administration website and set up our campaigns, lists and users.
But first let's make sure that they have the right GMT offset:
	run this on the command line:
	 - /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --postal-code-gmt

3. Enter the astguiclient administration page:
http://10.10.10.15/vicidial/admin.php
(use the username and password created when we entered a record into the 
vicidial_users table in SUBPHASE 6.3, In our case this is 6666 and 1234)
NOTE: if you click on the Logout button you must leave the user/pass empty and click OK
   - Now that you are logged into the vicidial administration system we can add 
new user entries for each of the new users and enter new campaigns and new 
lists.
	- The first step is to enter your new users, Click on the ADD A NEW USER 
and fill in the appropriate information for each now user you want to 
add.
	- Next, you need to create a new campaign, click on the ADD A NEW 
CAMPAIGN link and fill in what you want the campaign to be called as 
well as a description
	- Next, you need to define a new list, click on the ADD A NEW LIST link 
and fill in what you want the list to be called as well as a using the 
list ID of the leads that we loaded in the previous step "101" and 
select the new campaign from the pull-down menu that we just created.
	- Now that you have created your list, make it active by changing active to Y
	- now modify your campaign ang change the first status to be called to 
NEW and submit. Now your system is ready to dial.
   - you are done





PHASE 8: astGUIclient and VICIDIAL WEB CLIENTS

The browser requirements for the web-client interfaces are:
- Firefox 0.9 or greater (Firefox 1.0.7 is the recommended browser)
- Mozilla 1.7 or greater
- Netscape 8 or greater
- Opera 8.5 or greater
- Microsoft Internet Explorer 5.0 or greater (we have noticed some serious
  memory leaks in IE5 and IE6 when using this program, they do not occur in
  Firefox which is why we recommend it overall.)

To log into this app you will need a login setup in the vicidial_users table 
as well as an entry for the phone you are using in the phones table. You will 
first get a login prompt for the vicidial login then you will have the phone 
login where you enter the Login and Password for that phone entry. From there 
the app should display and you will see the MAIN screen with your login 
information at the top.

The example web page you would go to on this installation would be:
http://10.10.10.15/agc/astguiclient.php
http://10.10.10.15/agc/vicidial.php

Another thing to note is that you can have the agc folder(with the .php files 
in it) copied to multiple web servers, you just need to make sure that the 
MySQL database connection works (check the settings in the dbconnect.php file
that is in the agc directory). We have had astguiclient.php running on 3 
separate web servers for the same DB server and Asterisk server. This is an 
easy way to allow for auto failover and/or redundancy. Also, this client will 
work over SSL connections(https) for encrypted communications with the server.

New in astGUIclient release 1.1.7 is multi-language support. multi-language 
versions of web-clients and admin pages are available in the LANG_agc.zip and 
LANG_www directries and can be copied into your webroot directory. 

One more feature that the VICIDIAL web-client offers is the ability to set up 
an EXTERNAL phone extension in the astguiclient admin section so that you can 
have agents log in to vicidial.php wherever they have access to a phone with 
an external phone number and a web browser. To do this follow these steps:
- "ADD PHONE" in the admin.php web page and enter whatever name you want
- For the dialplan number field put in the full digits that you would dial from
  the Asterisk server to get to that agent's external phone(with 91 if used)
- For the Protocol select EXTERNAL
- make sure the agent knows the login and password set for this phone entry.
Then the agent will go to the vicidial.php page and enter in their phone 
login/pass, their vicidial user/pass/campaign and their phone should ring in a 
few seconds, and they are logged in and ready to take calls.

Admin Note: If you want to enable your agents to login with only their user/pass
you can hardcode the phone_login and phone_pass into the query string(URL) and
use a bookmark on their desktop, taking one more step out of their login process
example: http://10.10.10.15/agc/vicidial.php?pl=gs102&pp=test

It is recommended if you are in a call center environment that you would disable
the "Saved Form Information" option in Firefox settings. This is a checkbox in 
the Privacy settings under the Options menu.





PHASE 9: VICIDIAL REMOTE AGENTS

With v1.0 of VICIDIAL we have the ability to use a simple web form to give
remote agents a way to receive calls to whatever number they happen to be at, 
and they can view/edit call details and see a call log all through a web page
(vdremote.php) or http://10.10.10.15/vicidial/vdremote.php on this installation.
Remote Agents is only recommended for inbound calls because of the extra time 
needed to dial a number out to transfer the call to. To set up remote agents,
just go to the vicidial admin.php page and ADD NEW REMOTE AGENTS(Make sure the 
userID start also has a user login so they can get to the vdremote page). You 
will see that you can set up a remote agent entry to take multiple lines if you
wish meaning that, for example, if you need to send all of your calls to another
location because of a massive snowstorm(and none of your agents showed up at work)
you just log in that remote agent record with say 10 lines and then all of those
calls will be directed to the same number you set up for the remote agent. Then 
again you could just get your agents to log in from home if they have a phone 
and computer





PHASE 10: You are done with installation

If you have problems and it is not working right(and are NOT celebrating right
now), feel free to take a look at the FAQ for solutions to common installation 
errors, read the SCRATCH_INSTALL document, visit the VICIDIAL forum or send an
email to the mailing list:
http://www.eflo.net/VICIDIALforum/index.php
https://lists.sourceforge.net/lists/listinfo/astguiclient-users

Also, check out our weblog: http://astguiclient.blogspot.com/


**** IMPORTANT - In order for vicidial/astguiclient to function correctly please
read the REQUIREMENTS.txt for a minimum requirements list. ***

End-user Manuals for Agents and Managers are available from http://www.eflo.net
