Saturday, August 17, 2013

Database Auto-Backup Script And Procedures



Database Auto-Backup Script And Procedures
STEP 1:
mkdir /var/www/html/backup

STEP 2: Edit the file below.
nano /root/dbbackup.sh

STEP 3: Install mutt. Mutt is a text-based mail client along the lines of Pine or Elm.
yum -y install mutt

STEP 4: Paste the script below.

#!/bin/bash
echo "Starting to backup database"
mysqldump --opt -uroot -ppassword asterisk > /var/www/html/backup/vicidial-db_`date '+%Y-%m-%d'`.sql
echo "backup done..."
echo "Please wait, Compressing backup file..."
gzip /var/www/html/backup/vicidial-db_`date '+%Y-%m-%d'`.sql
echo "gzip done..."
echo " -- sending mail"
echo | mutt -s "Mysql Backup Done" emailaddress
echo "DONE"

STEP 5:
Save and exit.

STEP 6:
chmod 755 /root/dbbackup.sh

STEP 7:
crontab -e

STEP 8: Copy and paste the script below at the lower part of crontab.

### Fixing and Optimizing Database
30 1 * * 0 /usr/bin/mysqlcheck -ucron -p1234 --auto-repair --check --optimize --all-databases

### Weekend Database Back-up after operation every Sunday 2PM
0 2 * * 0 /root/dbbackup.sh

### Delete Database backup
24 0 * * 0 /usr/bin/find /var/www/html/backup -maxdepth 1 -name "vicidial-db*.*" -mtime +30 -print | xargs rm -f

STEP 9:
Save and exit

e-mail alert for every root logins

get email for every root logins


1.cd /root
3. nano .bashrc
4. Scroll to the end of the file then add the following:
echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`"yourname@gmail.com

Replace gmail with the handle for your actual server
Replace you@yourdomain.com with your actual email address

5. CTRL+x Y

now log in as root u should get the email
to check the status of mail in the linux type mailq
tail -n 50 /var/log/maillog

Seven Steps to Better SIP Security with Asterisk



Seven Steps to Better SIP Security with Asterisk
In case any of you were wondering why there has been a fairly notable upswing in the attacks happening on SIP endpoints, the answer is “script kiddies.” In the last few months, a number of new tools have made it easy for knuckle-draggers to attack and defraud SIP endpoints, Asterisk-based systems included. There are easily-available tools that scan networks looking for SIP hosts, and then scan hosts looking for valid extensions, and then scan valid extensions looking for passwords. You can take steps, NOW, to eliminate many of these problems. I think the community is interested in coming up with an integrated Asterisk-based solution that is much wider in scope for dynamic protection (community-shared blacklists is the current thinking) but that doesn’t mean you should wait for some new tool to defend your systems. You can IMMEDIATELY take fairly common-sense measures to protect your Asterisk server from the bulk of the scans and attacks that are on the increase. The methods and tools for protection already exists – just apply them, and you’ll be able to sleep more soundly at night.


Seven Easy Steps to Better SIP Security on Asterisk:


1) Don’t accept SIP authentication requests from all IP addresses. Use the “permit=” and “deny=” lines in sip.conf to only allow a reasonable subset of IP addresess to reach each listed extension/user in your sip.conf file. Even if you accept inbound calls from “anywhere” (via [default]) don’t let those users reach authenticated elements!

2) Set “alwaysauthreject=yes” in your sip.conf file. This option has been around for a while (since 1.2?) but the default is “no”, which allows extension information leakage. Setting this to “yes” will reject bad authentication requests on valid usernames with the same rejection information as with invalid usernames, denying remote attackers the ability to detect existing extensions with brute-force guessing attacks.

3) Use STRONG passwords for SIP entities. This is probably the most important step you can take. Don’t just concatenate two words together and suffix it with “1″ – if you’ve seen how sophisticated the tools are that guess passwords, you’d understand that trivial obfuscation like that is a minor hinderance to a modern CPU. Use symbols, numbers, and a mix of upper and lowercase letters at least 12 digits long.

4) Block your AMI manager ports. Use “permit=” and “deny=” lines in manager.conf to reduce inbound connections to known hosts only. Use strong passwords here, again at least 12 characters with a complex mix of symbols, numbers, and letters.

5) Allow only one or two calls at a time per SIP entity, where possible. At the worst, limiting your exposure to toll fraud is a wise thing to do. This also limits your exposure when legitimate password holders on your system lose control of their passphrase – writing it on the bottom of the SIP phone, for instance, which I’ve seen.

6) Make your SIP usernames different than your extensions. While it is convenient to have extension “1234″ map to SIP entry “1234″ which is also SIP user “1234″, this is an easy target for attackers to guess SIP authentication names. Use the MAC address of the device, or some sort of combination of a common phrase + extension MD5 hash (example: from a shell prompt, try “md5 -s ThePassword5000″)

7) Ensure your [default] context is secure. Don’t allow unauthenticated callers to reach any contexts that allow toll calls. Permit only a limited number of active calls through your default context (use the “GROUP” function as a counter.) Prohibit unauthenticated calls entirely (if you don’t want them) by setting “allowguest=no” in the [general] part of sip.conf.


These 7 basics will protect most people, but there are certainly other steps you can take that are more complex and reactive. Here is a fail2ban recipe which might allow you to ban endpoints based on volume of requests. There is discussion on the asterisk-user and asterisk-dev mailing lists of incorporating this type of functionality into Asterisk – let’s hear your ideas!

In summary: basic security measures will protect you against the vast majority of SIP-based brute-force attacks. Most of the SIP attackers are fools with tools – they are opportunists who see an easy way to defraud people who have not considered the costs of insecure methods. Asterisk has some methods to prevent the most obvious attacks from succeeding at the network level, but the most effective method of protection are the administrative issues of password robustness and username obscurity.

To View Who has tried to Access the server through ssh try following...



grep -ir ssh /var/log/*
grep -ir breakin /var/log/*
grep -ir security /var/log/*

Tuesday, August 6, 2013

Delete Recordings Vicidial,Goautodial in Bulk

Deleting Wav Recordings in Bulk on Vicidial, Vicibox, Goautodial, Vicidialnow.

Copy Code here:
Delete Wav recordings.
rm -rf /var/spool/asterisk/monitorDONE/ORIG/*

Delete MP3 recordings
rm -rf /var/spool/asterisk/monitorDONE/MP3/*

Check Hdd Space from Root.
df -k

How To install ViciDial/astGUIclient 2.4 RC 1 With Asterisk 1.4.21.2 On CentOS 6.2


Introduction

VICIDIAL is an enterprise class, open source, call center suite in use by many large call centers around the world.
Asterisk is software that turns an ordinary computer into a voice communications server.
Together, you have a full featured predictive dialer. It can also function as an ACD for inbound calls, or closer calls coming from VICIDIAL outbound fronters. It is capable of inbound, outbound, and blended call handling. VICIDIAL even allows you to have agents logged in from remote locations.
Preliminary Notes

In this tutorial I will be installing this on a newly installed CentOS 6 64-bit dedicated server that I am leasing from a data center. It has no control panel (cPanel, Plesk, ISPconfig, etc..) because a control panel is not needed. Your should be comfortable using a command line terminal in Linux and know basic server administration. These same instructions apply to CentOS 6 32-bit except for one minor change when editing the php.ini for eAccelerator in which I pointed out in that part of the configuration.



You must login as root to install the following software.



Update the system

Make sure you update the system first, then reboot if you installed an updated kernel.

yum -y update
reboot

Install the following software

yum install gcc gcc-c++ php php-devel php-gd gd-devel php-mbstring php-mcrypt php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel httpd libpcap libpcap-devel ncurses ncurses-devel screen sox mysql-server mysql-devel ntp kernel-devel mutt

Setup MySQL


Setup default MySQL tables, start MySQL and configure root password
Replace "mypassword" with your real password.

mysql_install_db
/etc/init.d/mysqld start
chkconfig mysqld on
/usr/bin/mysqladmin -u root password 'mypassword'

Update the time zone

Configure the system time and update it. (I set the server time zone to Arizona, so this is how I did it)

rm /etc/localtime
ln -sf /usr/share/zoneinfo/US/Arizona /etc/localtime
rdate -s nist1-ny.ustiming.org
Changes take effect immediately after you run the rdate command.
Have a look inside /usr/share/zoneinfo/US/ for different time zones.

Turn off ntpd and remove it from bootup runlevels.
You will be running ntpdate from cron instead.
service ntpd stop
chkconfig ntpd off

Setup CPAN and install some modules

Run the following command

perl -MCPAN -e shell
 
You will then go through CPAN setup, just hit ENTER for most prompts except
for the mirrors list, you will want to select at least 4 mirrors
  • yes for manual configuration
  • enter for the next bunch of prompts
  • for the "make install" option, it's a good idea to add UNINST=1
  • enter for the next 4 prompts
  • select your continent and country
  • select a few cpan mirrors
  • enter for the next 2 prompts
Once you see the cpan> prompt you can begin installing modules.
This may take a while.

install MD5
install Digest::MD5
install Digest::SHA1
install readline
install Bundle::CPAN
reload cpan
install DBI
force install DBD::mysql
install Net::Telnet
install Time::HiRes
install Net::Server
install Switch
install Mail::Sendmail
install Unicode::Map
install Jcode
install Spreadsheet::WriteExcel
install OLE::Storage_Lite
install Proc::ProcessTable
install IO::Scalar
install Spreadsheet::ParseExcel
install Curses
install Getopt::Long
install Net::Domain
install Term::ReadKey
install Term::ANSIColor
quit
In the end, I usually run all these commands once again to make sure its all installed.

Installing the Asterisk-Perl module

NOTE: Do NOT use the 0.09 or any newer version, they do not work with ViciDial.

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

Installing additional software from source (optional, but highly recommended)

Next, you will download, compile and install the following software.
  • lame
  • ttyload
  • iftop
  • mtop
  • mytop
  • sipsak
  • ploticus
LAME:
LAME is an MP3 encoder used to convert audio files from WAV to MP3. Some prefer GSM usually, but others have standardized on MP3 so you would need this utility to be loaded to use that option.

cd /usr/src
wget http://downloads.sourceforge.net/project/lame/lame/3.98.2/lame-398-2.tar.gz
tar -zxf lame-398-2.tar.gz
cd lame-398-2
./configure
make
make install

TTYLOAD:
ttyload is a simple terminal application that shows the processor load in a graphical time-based scrolling graph. I use it to view how loaded the system is and it visualizes load spikes very well.

cd /usr/src
wget http://www.daveltd.com/src/util/ttyload/ttyload-0.5.tar.gz
tar -zxf ttyload-0.5.tar.gz
cd ttyload-0.5
make
ln -s /usr/src/ttyload-0.5/ttyload /usr/bin/ttyload

IFTOP:
iftop is a good console bandwidth visualization tool that shows you active connections, where they are going to/from and how much of your precious bandwidth they are using.

cd /usr/src
wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
tar -zxf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make
make install

MTOP:
mtop is a great utility for real-time monitoring of mysql and the queries that are running in it.
Note: the root mysql password must be blank before installing this

mysql -u root -p

Enter your MySQL password, then the following MySQL command:

SET PASSWORD FOR root@localhost=PASSWORD('');QUIT;
cd /usr/src
wget http://downloads.sourceforge.net/project/mtop/mtop/v0.6.6/mtop-0.6.6.tar.gz
tar -zxf mtop-0.6.6.tar.gz
cd mtop-0.6.6
perl Makefile.PL
make
make install

Enter the following MySQL command to put your root password back the way it was originally
Replace "mypassword" with your real password.

SET PASSWORD FOR root@localhost=PASSWORD('mypassword');QUIT;

MYTOP:
mytop is is an optional utility for monitoring the threads and overall performance of mysql
Note: the root mysql password must be blank before installing this

mysql -u root -p

Enter your MySQL password, then the following MySQL command:

SET PASSWORD FOR root@localhost=PASSWORD('');QUIT;
cd /usr/src
wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
tar -zxf mytop-1.6.tar.gz
cd mytop-1.6
perl Makefile.PL
make
make test
make install

Enter the following MySQL command to put your root password back the way it was originally
Replace "mypassword" with your real password.

SET PASSWORD FOR root@localhost=PASSWORD('mypassword');QUIT;

SIPSAK:
sipsak is an optional utility that VICIDIAL can use to send messages to an agent's SIP-based phone(like the Snom 320) to display text on their LCD screen.

cd /usr/src
wget http://download.berlios.de/sipsak/sipsak-0.9.6-1.tar.gz
tar -zxf sipsak-0.9.6-1.tar.gz
cd sipsak-0.9.6
./configure
make
make install
/usr/local/bin/sipsak --version

PLOTICUS:
ploticus is a free graph creation package that allows you to create line graphs within PNG files simply by creating a config file and a data file. ViciDial uses this package to generate server performance graphs that can be displayed real-time within the ViciDial reports page.

cd /usr/src
wget http://downloads.sourceforge.net/project/ploticus/ploticus/2.41/pl241src.tar.gz
tar -zxf pl241src.tar.gz
cd pl241src/src/
make clean
make
make install
mkdir -p /var/www/html/vicidial/ploticus/
cp pl /var/www/html/vicidial/ploticus/

Installing eAccelerator for PHP

Install the php module

cd /usr/src
wget http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator 0.9.6.1/eaccelerator-0.9.6.1.zip/download
unzip eaccelerator-0.9.6.1.zip
cd eaccelerator-0.9.6.1
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
make install

Configure php.ini

nano /etc/php.ini
You will want to make sure NOTICE logging is turned off:
error_reporting  =  E_ALL & ~E_NOTICE
memory_limit = 48M
short_open_tag = On
max_execution_time = 330
max_input_time = 360
post_max_size = 48M
upload_max_filesize = 42M
default_socket_timeout = 360

Add the following lines to the dynamic extensions section of php.ini:
Note: For CentOS 32-bit, use this below: zend_extension="/usr/lib/php/modules/eaccelerator.so"
zend_extension="/usr/lib64/php/modules/eaccelerator.so"
;For CentOS 32-bit: zend_extension="/usr/lib/php/modules/eaccelerator.so"
eaccelerator.shm_size="48"
eaccelerator.cache_dir="/tmp/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 /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
php -v
You should see something like this:

PHP 5.1.6 (cli) (built: Jan 13 2010 17:09:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
   with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator


Editing the Apache config file

nano /etc/httpd/conf/httpd.conf

To disable logging, change:
           
CustomLog logs/access_log common
        to this:
CustomLog /dev/null common

To enable web browsing of Recordings on Asterisk server, add this:
   
Alias /RECORDINGS/ "/var/spool/asterisk/monitorDONE/"

<Directory "/var/spool/asterisk/monitorDONE">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
        <files *.mp3>
            Forcetype application/forcedownload
        </files>
</Directory>

Restart the Apache web server to apply the changes

/etc/init.d/httpd restart

Installing Asterisk

At the time of this writing, you cannot install the latest version of Asterisk 1.6 or later.
ViciDial 2.4 RC 1 is currently compatible with Asterisk 1.4.21.2. This version of Asterisk also needs to be patched to work with vicidial correctly.

mkdir /usr/src/asterisk
cd /usr/src/asterisk
wget http://downloads.digium.com/pub/asterisk/old-releases/asterisk-1.4.21.2.tar.gz
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.6.1+2.6.1.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/old/libpri-1.4.9.tar.gz
tar -zxf asterisk-1.4.21.2.tar.gz
tar -zxf dahdi-linux-complete-2.6.1+2.6.1.tar.gz
tar -zxf libpri-1.4.9.tar.gz
cd libpri-1.4.9
make clean
make
make install
cd ../dahdi-linux-complete-2.6.1+2.6.1
./configure
make all
make install
make config

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As a side note, if you had the old zaptel drivers installed, then you can remove it now.
lsmod | grep zaptel
Check the output of the above command and remove it using modprobe -r
Do this for all the zaptel modules which are listed
.
modprobe -r zaptel
modprobe -r zap_dummy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add the following to /etc/rc.d/rc.local
nano /etc/rc.d/rc.local
modprobe dahdi
modprobe dadhi_dummy
/usr/sbin/dahdi_cfg -vvvvvvvvvvvvv

You will need to reboot the system now.
reboot
After reboot, check to see if the dahdi drivers are loaded.
lsmod | grep dahdi
Output should look similar to this:
dahdi_transcode         6697  1 wctc4xxp
dahdi_voicebus         55791  2 wctdm24xxp,wcte12xp
dahdi                 212660  11 xpp,dahdi_transcode,wcb4xxp,wctdm,wcfxo,wctdm24xxp,wcte11xp,wct1xxp,wcte12xp,dahdi_voicebus,wct4xxp
crc_ccitt               1677  2 wctdm24xxp,dahdi

You are now ready to resume the installation of asterisk.

cd /usr/src/asterisk/asterisk-1.4.21.2
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
wget http://download.vicidial.com/asterisk-patches/1.4-gsm-gcc4.2.patch
patch -p1 ./codecs/gsm/Makefile 1.4-gsm-gcc4.2.patch
wget http://download.vicidial.com/conf/res_agi_defunct.patch
patch -p1 < res_agi_defunct.patch
      File to patch: res/res_agi.c
cd apps/
rm -f app_waitforsilence.c
wget http://download.vicidial.com/conf/app_waitforsilence.c
cd ../channels/
rm chan_sip.c
wget http://download.vicidial.com/conf/chan_sip.c
cd ../
./configure
make clean
make
make install
make samples

Add init.d script and add to bootup runlevels

cp /usr/src/asterisk/asterisk-1.4.21.2/contrib/init.d/rc.redhat.asterisk /etc/init.d/asterisk
chkconfig --add asterisk

Installing Sound files


Download the sound files
cd /usr/src
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-ulaw-current.tar.gz
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-gsm-current.tar.gz
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-ulaw-current.tar.gz
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-moh-opsound-gsm-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-moh-opsound-ulaw-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-moh-opsound-wav-current.tar.gz
Set the sounds in place
cd /var/lib/asterisk/sounds
tar -zxf /usr/src/asterisk-core-sounds-en-gsm-current.tar.gz
tar -zxf /usr/src/asterisk-core-sounds-en-ulaw-current.tar.gz
tar -zxf /usr/src/asterisk-core-sounds-en-wav-current.tar.gz
tar -zxf /usr/src/asterisk-extra-sounds-en-gsm-current.tar.gz
tar -zxf /usr/src/asterisk-extra-sounds-en-ulaw-current.tar.gz
tar -zxf /usr/src/asterisk-extra-sounds-en-wav-current.tar.gz

mkdir /var/lib/asterisk/mohmp3
mkdir /var/lib/asterisk/quiet-mp3
mkdir /var/lib/asterisk/default
cd /var/lib/asterisk
ln -s mohmp3 default
ln -s moh mohmp3
cd mohmp3
tar -zxf /usr/src/asterisk-moh-opsound-gsm-current.tar.gz
tar -zxf /usr/src/asterisk-moh-opsound-ulaw-current.tar.gz
tar -zxf /usr/src/asterisk-moh-opsound-wav-current.tar.gz
rm CHANGES*
rm LICENSE*
rm CREDITS*
cd /var/lib/asterisk/moh
rm CHANGES*
rm LICENSE*
rm CREDITS*
cd /var/lib/asterisk/sounds
rm CHANGES*
rm LICENSE*
rm CREDITS*
cd /var/lib/asterisk/quiet-mp3


sox ../mohmp3/macroform-cold_day.wav macroform-cold_day.wav vol 0.25
sox ../mohmp3/macroform-cold_day.gsm macroform-cold_day.gsm vol 0.25
sox -t ul -r 8000 -c 1 ../mohmp3/macroform-cold_day.ulaw -t ul macroform-cold_day.ulaw vol 0.25
sox ../mohmp3/macroform-robot_dity.wav macroform-robot_dity.wav vol 0.25
sox ../mohmp3/macroform-robot_dity.gsm macroform-robot_dity.gsm vol 0.25
sox -t ul -r 8000 -c 1 ../mohmp3/macroform-robot_dity.ulaw -t ul macroform-robot_dity.ulaw vol 0.25
sox ../mohmp3/macroform-the_simplicity.wav macroform-the_simplicity.wav vol 0.25
sox ../mohmp3/macroform-the_simplicity.gsm macroform-the_simplicity.gsm vol 0.25
sox -t ul -r 8000 -c 1 ../mohmp3/macroform-the_simplicity.ulaw -t ul macroform-the_simplicity.ulaw vol 0.25
sox ../mohmp3/reno_project-system.wav reno_project-system.wav vol 0.25
sox ../mohmp3/reno_project-system.gsm reno_project-system.gsm vol 0.25
sox -t ul -r 8000 -c 1 ../mohmp3/reno_project-system.ulaw -t ul reno_project-system.ulaw vol 0.25
sox ../mohmp3/manolo_camp-morning_coffee.wav manolo_camp-morning_coffee.wav vol 0.25
sox ../mohmp3/manolo_camp-morning_coffee.gsm manolo_camp-morning_coffee.gsm vol 0.25
sox -t ul -r 8000 -c 1 ../mohmp3/manolo_camp-morning_coffee.ulaw -t ul manolo_camp-morning_coffee.ulaw vol 0.25

Installing Astguiclient

Installing Astguiclient 2.4 RC 1
Note: the installer will ask where your web root is located. I use /var/www/html as my web root. This is where the installer will put your web-facing files.

mkdir /usr/src/astguiclient
cd /usr/src/astguiclient
wget http://downloads.sourceforge.net/project/astguiclient/astguiclient_2.4rc1.zip
unzip astguiclient_2.4rc1.zip
cd agc_2.4rc1
perl install.pl

Download and copy a gsm file

cd /var/lib/asterisk/sounds
wget http://astguiclient.sf.net/conf.gsm
cp conf.gsm park.gsm

Create the database and import the sample data

First, login to mysql to run some commands

mysql -u root -p

Enter these MySQL commands:

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';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;

flush privileges;
SET GLOBAL connect_timeout=60;

use asterisk;

\. /usr/src/astguiclient/agc_2.4rc1/extras/MySQL_AST_CREATE_tables.sql
\. /usr/src/astguiclient/agc_2.4rc1/extras/sip-iax_phones.sql

quit

In the Linux terminal, enter these commands

/usr/share/astguiclient/ADMIN_area_code_populate.pl
cp /usr/src/astguiclient/agc_2.4rc1/extras/performance_test_leads.txt /usr/share/astguiclient/LEADS_IN/
/usr/share/astguiclient/VICIDIAL_IN_new_leads_file.pl --forcelistid=107 --forcephonecode=1

Make several entries in the rc.local of your system.

nano /etc/rc.d/rc.local
On a new system I just overwrite the file with the following:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# OPTIONAL enable ip_relay(for same-machine trunking and blind monitoring)
# /usr/share/astguiclient/ip_relay/relay_control start  2>/dev/null 1>&2

# Disable console blanking and powersaving
/usr/bin/setterm -blank
/usr/bin/setterm -powersave off
/usr/bin/setterm -powerdown

### start up the MySQL server
/etc/init.d/mysqld start

### start up the apache web server
/etc/init.d/httpd start

### 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

### load dahdi drivers
modprobe dahdi
modprobe dadhi_dummy
/usr/sbin/dahdi_cfg -vvvvvvvvvvvvv

### sleep for 20 seconds before launching Asterisk
sleep 20

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

Make several entries in the crontab of your system:

crontab -e
### 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_mix.pl --MIX
#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 --GSM
#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 --GSM

### 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 and the full day run at night
33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
## uncomment below if using QueueMetrics
#*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check

## uncomment below if using Vtiger
#1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet

### 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/sbin/ntpdate -u pool.ntp.org 2>/dev/null 1>&2

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

### VICIDIAL campaign export scripts (OPTIONAL)
#32 0 * * * /usr/share/astguiclient/AST_VDsales_export.pl
#42 0 * * * /usr/share/astguiclient/AST_sourceID_summary_export.pl

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

### roll logs monthly on high-volume dialing systems
#30 1 1 * * /usr/share/astguiclient/ADMIN_archive_log_tables.pl

### 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
30 0 * * * /usr/bin/find / -maxdepth 1 -name "screenlog.0*" -mtime +4 -print | xargs rm -f

Final Adjustments

It is important to change the externip and localnet values in the sip.conf
The externip needs to be the public ip of your server.
The localnet will consist of the public ip/netmask of your server.

nano /etc/asterisk/sip.conf
externip = 75.75.75.75
localnet=75.75.75.75/255.255.255.248

Run this perl script to update the server_ip fields in the asterisk tables (copy the command as-is)

/usr/share/astguiclient/ADMIN_update_server_ip.pl --old-server_ip=10.10.10.15

Update music on hold configuration

nano /etc/asterisk/musiconhold.conf
;
; Music on Hold -- Sample Configuration
;

[default]
mode=files
directory=/var/lib/asterisk/mohmp3

[quiet]
mode=files
directory=/var/lib/asterisk/quiet-mp3

#include musiconhold-vicidial.conf

* There are other sample configration files in /usr/src/astguiclient/docs/conf_examples/ that you might want to look at and maybe copy from and customize.

Lastly, reboot the machine

reboot

Diagnostics

After reboot, check your logs for any errors, make sure asterisk is up and running. Be proactive and look for problems before you start configuring vicidial.
Run these commands to view log files:
  • tail -f -n 50 /var/log/asterisk/messages
  • tail -f -n 50 /var/log/messages
  • more /var/log/dmesg
  • tail -f -n 40 /etc/httpd/logs/error_log
  • tail -f -n 40 /var/log/maillog
  • tail -f -n 40 /var/log/cron
Run this command:
screen -ls
The output should look similar to this:
There are screens on:
    4090.asterisk   (Detached)
    4077.ASTfastlog (Detached)
    8325.ASTsend    (Detached)
    8322.ASTupdate  (Detached)
    4004.astshell20110228193500     (Detached)
    8334.ASTVDremote        (Detached)
    8328.ASTlisten  (Detached)
    12192.ASTVDadapt        (Detached)
    8331.ASTVDauto  (Detached)
    9 Sockets in /var/run/screen/S-root.

Start using vicidial

Login to vicidial and configure it.
Add users, campaigns, in-group, DID's, server, etc....
Go to: http://youripaddress/vicidial/admin.php
The default username is: 6666 and the password is: 1234

A note about security

When you get vicidial configured and working, make sure to follow basic common sense server administration rules like setting up a firewall, changing default passwords, disallow remote mysql connections or limiting it, etc...