Sunday, November 1, 2009

Vicidial Multi Server Quick Guide

Hello guys, due to heartwarming Yahoo Messenger requests I am posting a quick guide on a multi server setup on ubuntu server 8.0.4 LTS. This is a preview of some ebook im working on.

Variables to be used on the installation process:

Database / Webserver a.k.a Fate = 192.168.1.69
Asterisk Server a.k.a Laisa = 192.168.1.88

Now lets begin with installing the first server which is the Database / Web server since this is the simplest, here are the things to get you started:




* The notes are taken from the UBUNTU_INSTALL.txt

Login to your db/web server

$ sudo su
$ passwd (set the root user's password)

# apt-get update (retrieves the latest repository information)
# apt-get upgrade (upgrades any out of date packages
# apt-get install linux-headers-server (Used for zaptel compil)
# reboot (reboot to use the new kernel)

* We just want to make sure everything is updated before we move forward to installing the others.

Now login back again and apt-get install this packages and be sure to answer Yes if it requires you to download and install other packages required.

apache2 (web server)
apache2-mpm-prefork (multi threaded portion to apache2)
php5 (base php files)
php5-cli (php command line interface (allows us to run php -v for eaccelerator))
php5-dev (development tools for php5 allows us to compile eaccelerator
php5-mysql (allows php5 to connect to a mysql server)
phpmyadmin (vicidial uses apache2 as its webserver please select this)
ploticus (this is what creates the graphs for the server performance screen)
ntp (time synchronization utility)
phpmyadmin (vicidial uses apache2 as its webserver please select this)
mysql-client-5.0 (command for connecting to mysql)
mysql-doc-5.0 (documentation for mysql)
mysql-server-5.0 (this will ask for a password you can just press enter a bunch of times)
mytop (utility for monitoring mysql)
ploticus (this is what creates the graphs for the server performance screen)
subversion (code versioning tool)
subversion-tools

Installing eaccelerator:

# cd /usr/src
# wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.zip
# unzip eaccelerator-0.9.5.3.zip
# cd eaccelerator-0.9.5.3
# phpize
# ./configure
# make
# make install
# cd /etc/php5/conf.d/
# vim eaccelerator.ini
> add the following to the eaccelerator.:
extension="eaccelerator.so"
eaccelerator.shm_size="48"
eaccelerator.cache_dir="/var/lib/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
# mkdir /var/lib/eaccelerator
# chmod 0777 /var/lib/eaccelerator
# php -v

NOTE: You should see a line mentioning eaccelerator. If you do not or you get an error you have done something wrong

Now that were done installing the package, the next thing were going to do on this server is create the asterisk database and populate the tables.

We will need to download the astguiclient scripts from the eflo repository through subversion, we are only going to use the sql scripts that will create the database and the tables, we will also be copying the www folders to the webservers root directory.

WE ARE STILL ON THE DB/WEB SERVER!!!!

Now we checkout the astguiclient files, you can choose between 2.0.5 or 2.2, i am currently using 2.2 for my latest deployments, very nice call transfer interface and many more.

**** for SVN 2.0.5 branch:
# mkdir /usr/src/astguiclient
# cd /usr/src/astguiclient
# svn checkout svn://svn.eflo.net:43690/agc_2-X/branches/agc_2.0.5

**** for SVN 2.2.0 trunk:
# mkdir /usr/src/astguiclient
# cd /usr/src/astguiclient
# svn checkout svn://svn.eflo.net:43690/agc_2-X/trunk


CREATING THE ASTERISK DATABASE

# mysql -p (enter the mysql root user's password you set earlier)
> CREATE DATABASE `asterisk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
> 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
> \. /usr/src/astguiclient/trunk/extras/first_server_install.sql
> \. /usr/src/astguiclient/trunk/extras/sip-iax_phones.sql
> quit

* If you will be using 2.0.5 your this will be used:

> \. /usr/src/astguiclient/agc_2.0.5/extras/MySQL_AST_CREATE_tables.sql
> \. /usr/src/astguiclient/agc_2.0.5/extras/first_server_install.sql
> \. /usr/src/astguiclient/agc_2.0.5/extras/sip-iax_phones.sql
> quit


* Lets fine tune your mysql server with a new my.cnf

# cd /etc/mysql/
# wget http://download.vicidial.com/ubuntu/ubuntu-my-vici.cnf
# mv ubuntu-my-vici.cnf my.cnf
# /etc/init.d/mysql restart

LET US NOW COPY THE VICIDIAL AND AGC FOLDERS Under the astguiclient directory

If you have downloaded 2.0.5 their location is at /usr/src/astguiclient/agc_2.0.5/www you need to copy all the files under this directory to /var/www/ directory

If you have downloaded 2.2 their location is at /usr/src/astguiclient/trunk/www you need to copy all the files under this directory to /var/www/ directory

You also need to edit the dbconnect.php , it can be found under the AGC and VICIDIAL directories. The lines your going to edit will look like this:

-----------------------------
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
---------------------------------

You need to change $VARDB_server value to the IP Address of the DB/Web Server which is 192.168.1.69, the default value actually is ok because your mysql server lies in this machine.

You would also need to change $WeBServeRRooT value to '/var/www' since that is the default webroot path of ubuntu server.

You need to do this on the 2 dbconnect.php files under AGC and VICIDIAL folders.


* NOW WE ARE DONE WITH THE DATABASE SERVER!!!!!
* MAKE SURE YOUR SERVERS HAVE BOTH THE SAME TIMEZONE AND THE SAME TIME.
_________________

Now lets setup our asterisk / vicidial server, first lets setup the server with new packages and update the kernel and reboot.

WE ARE NOW ON THE ASTERISK/VICIDIAL SERVER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# sudo su
# passwd (set the root user's password)

#apt-get update (retrieves the latest repository information)
# apt-get upgrade (upgrades any out of date packages
# apt-get install linux-image-server linux-source linux-headers-server (Used for zaptel compil)
# reboot (reboot to use the new kernel)

After that we do an apt-get install this packages:

WE ARE NOW ON THE ASTERISK/VICIDIAL SERVER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


build-essential (this is the build tool chain for gcc)
iftop (this is a useful tool for looking at the network interface)
lame (this is a mp3 encoding tool)
libmysqlclient15-dev (library that lets programs connect to mysql)
libncurses5-dev
libploticus0-dev
libsox-fmt-all (encoding and decoding libraries for sox)
linux-source (needed if you are going to recompile the linux kernel)
mpg123 (mp3 playback utility for the commandline)
mtop (utility for monitoring mysql)
mysql-client-5.0 (command for connecting to mysql)
mysql-doc-5.0 (documentation for mysql)
mytop (utility for monitoring mysql)
ntp (time synchronization utility)
openssh-server (ssh server allows for remote connection)
php5 (base php files)
php5-cli (php command line interface (allows us to run php -v for eaccelerator))
php5-dev (development tools for php5 allows us to compile eaccelerator
php5-mysql (allows php5 to connect to a mysql server)
screen (vicidial runs its core scripts in screen so this is REQUIRED)
sipsak (tool for sending various information to sip phones)
sox (command line encoding and decoding tool)
subversion (code versioning tool)
subversion-tools
unzip
libcurl3
curl
vim


Now lets install the other perl modules and packages:

# cd /usr/src
# tar -xjf linux-source-*.tar.bz2 (where * is the kernel version)
# cpan
(press enter to go through the prompts. If you have a multi cored system you should enter the -j option when specified with n+1 as the value, where n is the number of CPUs you have in your system. Also enter UNINST=1 when asked. until you get to the mirror selection portion)
(select 3 mirror sites in your area)
> install MD5
> install Digest::SHA1
> install readline
> install Bundle::CPAN (do not change settings)
> quit
$ cpan (enter through questions until you get to the cpan prompt)
> o conf commit (saves the config changes)
> force install Scalar::Util
> install DBI
> force install DBD::mysql
> install Net::Server
> install Time::HiRes
> install Net::Telnet
> install Unicode::Map
> install Jcode
> install OLE::Storage_Lite
> install Spreadsheet::WriteExcel
> install Proc::ProcessTable
> install Spreadsheet::ParseExcel
> install Mail::Sendmail
> quit

ASTERISK PERL PACKAGE, THIS IS A MUST

# cd /usr/src
# wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz
# tar xzf asterisk-perl-0.08.tar.gz
# cd asterisk-perl-0.08
# perl Makefile.PL
# make all
# make install

TTYLOAD PACKAGE

# cd /usr/src
# wget http://www.daveltd.com/src/util/ttyload/ttyload-0.5.tar.gz
# tar xzf ttyload-0.5.tar.gz
# cd ttyload-0.5
# make
# make install


NOW WE INSTALL ASTERISK

# mkdir /usr/src/asterisk
# cd /usr/src/asterisk

****FOR 1.2 asterisk run the following

# wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.2.30.2.tar.gz
# wget http://downloads.digium.com/pub/zaptel/releases/zaptel-1.2.27.tar.gz
# wget http://downloads.digium.com/pub/libpri/releases/libpri-1.2.8.tar.gz
# tar xzf asterisk-1.2.30.2.tar.gz
# tar xzf zaptel-1.2.27.tar.gz
# tar xzf libpri-1.2.8.tar.gz
# cd libpri-1.2.8
# make clean && make && make install
# cd ../zaptel-1.2.27
# make clean&& make && make install
# cd ../asterisk-1.2.30.2
# 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
# 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 # 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 ../ # wget http://www.eflo.net/files/cli_chan_concise_delimiter.patch # patch -p1 < ./cli_chan_concise_delimiter.patch File to patch: cli.c # wget http://www.eflo.net/files/app_waitforsilence.c # mv app_waitforsilence.c apps/app_waitforsilence.c # 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 # vi codecs/gsm/Makefile add OPTIMIZE=-O2 to the file before the ifneq section, to fix GSM audio problems # make clean; make; make installation # make samples # modprobe zaptel # modprobe ztdummy ****FOR 1.4 asterisk do the following: # wget http://downloads.vicidial.com/required-apps/asterisk-1.4.21.2-vic.tar.gz # wget http://downloads.digium.com/pub/zaptel/zaptel-1.4.12.1.tar.gz # wget http://downloads.asterisk.org/pub/telephony/libpri/old/libpri-1.4.10.1.tar.gz # tar xzf asterisk-1.4.21.2-vici.tar.gz # tar xzf zaptel-1.4.12.1.tar.gz # tar xzf libpri-1.4.9.tar.gz # cd libpri-1.4.9 # make clean; make; make install # cd ../zaptel-1.4.12.1 # ./configure; make clean; make; make install # cd ../asterisk-1.4.21.2 # ./configure; make clean; make; make install # make samples # modprobe zaptel # modprobe ztdummy VERIFYING ASTERISK INSTALLATION # asterisk -vvvvvvvvvvvvvvvvvvvvvvvvvvvvgc > show version
> zap show status
> show application meetme
> stop now
_________________

WE ARE NOW ON THE ASTERISK/VICIDIAL SERVER


**** for SVN 2.0.5 branch:

# mkdir /usr/src/astguiclient
# cd /usr/src/astguiclient
# svn checkout svn://svn.eflo.net:43690/agc_2-X/branches/agc_2.0.5
# cd agc_2.0.5
# perl install.pl

**** for SVN 2.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

: manual configuration [y]
: press enter until you get to webroot and set that to the following: /var/www
: press enter through to the Sample configuration files and set that to 'y'
: press enter through to the end of the script

Also be sure to set the DB SERVER IP ADDRESS to 192.168.1.69 which is the DB/WEB Servers IP address instead of localhost which is the default value.

NOW LETS TELL THE DATABASE SERVER THAT YOU WILL UPDATE YOUR IP ADDRESS FROM THE DEFAULT FIRST SERVER INSTALL SCRIPT

# /usr/share/astguiclient/ADMIN_update_server_ip.pl --old-server_ip=10.10.10.15 (Just answer Y to all steps after this, this will actually replace 10.10.10.15 with the ip address of your asterisk/vicidial server)

WE INSERT THE AREA CODES TO THE DATABASE SERVER

# /usr/share/astguiclient/ADMIN_area_code_populate.pl

WE DO THE PERFORMANCE TEST

# cp /usr/src/astguiclient/trunk/extras/performance_test_leads.txt /usr/share/astguiclient/LEADS_IN/

# /usr/share/astguiclient/VICIDIAL_IN_new_leads_file.pl --forcelistid=107 --forcephonecode=1


Now some post install processes:

# cd /var/lib/asterisk/sounds
# wget http://downloads.vicidial.com/conf/conf.gsm
# cp conf.gsm park.gsm

EDIT THE CRONTAB AND ADD THE FOLLOWING LINES:

# crontab -e
Add the following lines:
### recording mixing/compressing/ftping scripts
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
#0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl
1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58 * * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --MP3
#2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59 * * * * /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --MP3
### 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
### 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 pool.ntp.org 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


NOW WE DOWNLOAD THE VICIDIAL init.d service

# cd /etc/init.d/
# wget http://download.vicidial.com/ubuntu/vicidial
# chmod +x vicidial
# update-rc.d -f vicidial defaults
# shutdown -r 0


AFTER REBOOTING

# screen -ls (should show at least 6 screens, one of which should be asterisk)


In a web browser, go to (http://192.168.1.69/vicidial/admin.php) to see if everything is working. You should also reboot at this point to make sure everything will start back up properly.
From here on you should follow the tutorials in the VICIDIAL Manager Manual(available at eflo.net)
_________________

POST INSTALLATION TIPS:


Launch firefox and go to http://192.168.1.69/vicidial/admin.php the default username is 6666 and password is 1234

The 6666 username does not have all the permissions yet as administrator so you need to modify the user so you could have access to all the administrative functions, to do this you.

To do this when you login click on the 6666 username and it will show his user details, scroll down to ADMIN INTERFACE OPTIONS and set everything from 0 to 1, that will give you permission to all the features of the admin interface.

Ohh and dont forget to click on SUBMIT after you make the changes.


After that you need to change the asterisk server version and the other details. On the left menu click on ADMIN then SERVERS sub menu, you can change your asterisk servers name and description and other settings, you would want to change the version of your asterisk server to the version of the asterisk software you installed on your asterisk/vicidial server, by default the value of Asterisk Version is 1.2.30.4, if you installed asterisk 1.4.21.1 you need to change that value.


Again one more tip, dont rely on auto installers, real IT guys are not dumb, they want to dig in on how stuff works and understand the whole step. Automation makes you DUMB DUMB DUMB DUMB DUMB DUMB DUMB DUMB DUMB

5 comments:

  1. sir,

    for my asterisk/vicidial = 192.168.2.5
    for my Apache/Mysql = 192.168.2.6

    den yung astguiclient.conf ko nakapoint yung
    ftp sa = 192.168.2.5

    pag e click ko yung sa user stat nga sir gaya nito..

    RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)
    # LEAD DATE/TIME SECONDS RECID FILENAME LOCATION
    1 536646 2009-11-05 14:20:31 37 55836 CRES_20091105-142030_7187380490
    2 536630 2009-11-05 14:20:13 12 55829 CRES_20091105-142012_7188435503 http://192.168.2.5/RECORDIN...
    3 536628 2009-11-05 14:20:04 5 55826 CRES_20091105-142003_7188452673 http://192.168.2.5/RECORDIN...
    4 536560 2009-11-05 14:18:50 71 55805 CRES_20091105-141849_7188437253
    5 536518 2009-11-05 14:18:10 33 55791 CRES_20091105-141809_7188480708
    6 516935 2009-11-05 14:15:58 120 55760 CRES_20091105-141557_7187368093 http://192.168.2.5/RECORDIN...
    7 536379 2009-11-05 14:15:31 20 55749 CRES_20091105-141530_7186413718 http://192.168.2.5/RECORDIN...
    8 536356 2009-11-05 14:15:09 5 55740 CRES_20091105-141508_7187382898 http://192.168.2.5/RECORDIN...
    9 424227 2009-11-05 14:14:26 27 55728 CRES_20091105-141425_7182647245 http://192.168.2.5/RECORDIN...
    10 512073 2009-11-05 14:13:19 50 55710 CRES_20091105-141318_7182171951 http://192.168.2.5/RECORDIN...
    11 516214 2009-11-05 14:12:06 56 55693 CRES_20091105-141205_7184681828 http://192.168.2.5/RECORDIN...
    12 370181 2009-11-05 14:11:16 28 55678 CRES_20091105-141115_6314243865 http://192.168.2.5/RECORDIN...
    13 536120 2009-11-05 14:09:56 67 55657 CRES_20091105-140955_7186410084 http://192.168.2.5/RECORDIN...
    14 536094 2009-11-05 14:09:15 37 55649 CRES_20091105-140914_7188459693 http://192.168.2.5/RECORDIN...
    15 516935 2009-11-05 12:43:07 1706 54905 CRES_20091105-124306_7187368093 http://192.168.2.5/RECORDIN...

    ganito po error nya..ayaw mag display:

    Not Found

    The requested URL /RECORDINGS/CRES_20091105-141425_7182647245-all.wav was not found on this server.
    Apache/2.2.8 (Ubuntu) Server at 192.168.2.5 Port 80

    ano po problem nito..?

    ReplyDelete
  2. Hi!
    can we install DB/Web server and Asterisk server on the same machine?
    because my project is callcenter system, so i don't need to install on 2 different machine.
    can u help me.
    thanks

    ReplyDelete
  3. @quockhanh yes you can, either search the google for goautodial or vicibox or you can follow the scratch install here: http://astguiclient.sourceforge.net/scratch_install.html

    for recordings, instead of following the apache portion, you can create a symbolic link pointing to your /var/spool/asterisk/monitorDONE/ORIG or /MP3 or /GSM folder.
    example:
    cd /var/www/html
    ln -s /var/spool/asterisk/monitorDONE/MP3 /var/www/html/RECORDINGS

    ReplyDelete
  4. after installation unable to access the server with login 6666 and password 1234. Can someone help with directions.

    ReplyDelete
  5. How to play a casino game at a casino - Drmcd
    When you play online 전라남도 출장마사지 casino 파주 출장샵 games on a computer, you are most likely to find this 태백 출장샵 game entertaining, with 논산 출장안마 many games including 포항 출장마사지 slot machine games,

    ReplyDelete