vicidial scratch install ubuntu - to be updtd.

OS : ubuntu 16 /mariaDB/ast 1.8

apt-get update && apt-get upgrade -y && hostnamectl set-hostname viciOS && reboot


#======================VICIdial Dependencies===========================================#

sed -i ' 2 a 127.0.1.1 localhost viciOS' /etc/hosts

apt-get install git -y

apt-get install mariadb-server -y

apt-get install apache2 -y

apt-get install build-essential iftop htop lame libmysqlclient-dev libncurses5-dev libploticus0-dev libsox-fmt-all mpg123 ntp -y

apt-get install screen sipsak sox subversion subversion-tools unzip -y

sudo apt install ca-certificates apt-transport-https -y

wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -

echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list

sudo apt update

apt install php5.6-common php5.6-curl php5.6-mbstring php5.6-xml php5.6 php5.6-cli php5.6-dev php5.6-mysql -y


#----------PHP--

sed -i "s#short_open_tag = Off#short_open_tag = On#g" /etc/php/5.6/apache2/php.ini

sed -i "s#memory_limit = 128M#memory_limit = 1G#g" /etc/php/5.6/apache2/php.ini

sed -i "s#max_execution_time = 30#max_execution_time = 3600#g" /etc/php/5.6/apache2/php.ini

sed -i "s#max_input_time = 60#max_input_time = 3600#g" /etc/php/5.6/apache2/php.ini

sed -i "s#post_max_size = 8M#post_max_size = 1G#g" /etc/php/5.6/apache2/php.ini

sed -i "s#upload_max_filesize = 2M#upload_max_filesize = 64M#g" /etc/php/5.6/apache2/php.ini

sed -i "s#default_socket_timeout = 60#default_socket_timeout = 3600#g" /etc/php/5.6/apache2/php.ini

sed -i "s#error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT#error_reporting = E_ERROR#g" /etc/php/5.6/apache2/php.ini



#----------Cpan--

perl -MCPAN -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit'


cpan MD5 Digest::MD5 Digest::SHA1 readline Bundle::CPAN Pod::Usage Getopt::Long DBI DBD::mysql Net::Telnet Time::HiRes Net::Server Mail::Sendmail Unicode::Map Jcode Spreadsheet::WriteExcel OLE::Storage_Lite Proc::ProcessTable IO::Scalar Scalar::Util Spreadsheet::ParseExcel Archive::Zip Compress::Raw::Zlib Spreadsheet::XLSX Test::Tester Spreadsheet::ReadSXC Text::CSV Test::NoWarnings Text::CSV_PP File::Temp Text::CSV_XS Spreadsheet::Read LWP::UserAgent HTML::Entities HTML::Strip HTML::FormatText HTML::TreeBuilder Switch Time::Local MIME::POP3Client Mail::IMAPClient Mail::Message IO::Socket::SSL



#=======================Asterisk Installation================================================#


#Asterisk 1.8 Installation

apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev -y


echo ----------------------------------- downloading asterisk1.8 dahdi2.10 libpri 1.4.15 ------------------------------------------------

mkdir /usr/src/asterisk

cd /usr/src/asterisk

wget http://download.vicidial.com/required-apps/asterisk-1.8.23.0-vici.tar.gz

wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.10.2+2.10.2.tar.gz

wget http://downloads.asterisk.org/pub/telephony/libpri/old/libpri-1.4.15.tar.gz


tar xzf asterisk-1.8.23.0-vici.tar.gz

tar xzf dahdi-linux-complete-2.10.2+2.10.2.tar.gz

tar xzf libpri-1.4.15.tar.gz


echo ----------------------------------- building dahdi 2.10.2 ------------------------------------------------

cd /usr/src/asterisk/dahdi-linux-complete-2.10.2+2.10.2

make all

make install

modprobe dahdi

modprobe dahdi_dummy

dahdi_cfg


echo ----------------------------------- building libpri 1.14.15 ------------------------------------------------

cd /usr/src/asterisk/libpri-1.4.15

make clean

make

make install


echo ----------------------------------- building asterisk 1.8.23.0 ------------------------------------------------

cd /usr/src/asterisk/asterisk-1.8.23.0

sudo apt install g++-4.8 -y

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 1

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 1

./configure

make clean

make

make install

make samples

cp /usr/src/asterisk/asterisk-1.8.23.0/contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk


echo ----------------------------------- building asterisk-perl-0.08

cd /usr/src

wget http://download.vicidial.com/required-apps/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


echo -----------------------------------vicidial-astguitime

mkdir /usr/src/astguiclient

cd /usr/src/astguiclient

git clone https://github.com/vicigeek/trunk.git

cd trunk

mysql -uroot -e 'CREATE DATABASE `asterisk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'

mysql -uroot -e "GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234';"

mysql -uroot -e "GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234';"

mysql -uroot -e 'use asterisk; <\. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql'

mysql -uroot -e 'use asterisk; <\. /usr/src/astguiclient/trunk/extras/first_server_install.sql'


echo -----------------------------------DATABASE-uploaded

perl install.pl

chmod 777 /usr/src/astguiclient/trunk/bin/*

chmod 0777 /var/spool/asterisk/monitorDONE/MP3/

/usr/src/astguiclient/trunk/bin/ADMIN_area_code_populate.pl

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

cd /etc/init.d/

wget http://download.vicidial.com/conf/vicidial-dahdi

chmod +x vicidial-dahdi

update-rc.d -f vicidial-dahdi defaults

apt-get install libc6-i386 -y

/usr/share/astguiclient/ip_relay/ip_relay_linux_i386


# ====================================final touch========================================#

nano /etc/apache2/sites-available/000-default.conf

copy & paste the below

Alias /RECORDINGS/MP3/ "/var/spool/asterisk/monitorDONE/MP3/"

<Directory "/var/spool/asterisk/monitorDONE/MP3">

Require all granted

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from All

<files *.mp3>

Forcetype application/forcedownload

</files>

</Directory>


crontab

copy & paste the below entries

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


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


### cleanup of the scheduled callback records

25 0 * * * /usr/share/astguiclient/AST_DB_dead_cb_purge.pl --purge-non-cb -q


### GMT adjust script - uncomment to enable

#45 0 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --list-settings


### Dialer Inventory Report

#1 7 * * * /usr/share/astguiclient/AST_dialer_inventory_snapshot.pl -q --override-24hours


### inbound email parser

#* * * * * /usr/share/astguiclient/AST_inbound_email_parser.pl


reboot