Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save attiqmscs004/6e815db046efd30fe05e9126c43386c7 to your computer and use it in GitHub Desktop.
Save attiqmscs004/6e815db046efd30fe05e9126c43386c7 to your computer and use it in GitHub Desktop.
Install Vicidial from scratch on Debian Wheezy with xtables Geoip and 1000 Hz Realtime Kernel
Tom Barthel`s Vicidial on Debian Wheezy 7.5 Scratch install
This Tutorial is testet on a 5 Dollar KVM VPS on http://www.vultr.com/?ref=6804483
Vultr is great for testing. you can set up a Vicidial server from scratch or
Vicibox in shortest time. On 4 Continents total of 12 cities.
For production use, please use a dedicated server, for example,
of www.ovh.com My customer number is bt81421-ovh you can specify
when ordering., then I get a small commission
First you need a netinstall Disk from Debian:
http://cdimage.debian.org/debian-cd/7.5.0/amd64/iso-cd/debian-7.5.0-amd64-netinst.iso
after Installing a minimal system make:
apt-get update && apt-get dist-upgrade
next install realtime Kernel and Kernel Headers:
apt-get install -y linux-image-rt-amd64 linux-headers-rt-amd64
remove the old kernel
apt-get remove -y linux-image-3.2.0-4-amd64 linux-headers-3.2.0-4-amd64
update-grub ##reconfigure the bootloader for the new Kernel
reboot ## start the sytstem with the new Kernel
uname -r ## check the new Kernel is loaded >>3.2.0-4-rt-amd64
Install Xtables Geoip Firewall:
apt-get install xtables-addons-common libtext-csv-xs-perl unzip
mkdir -p /usr/share/xt_geoip
cd /usr/lib/xtables-addons
./xt_geoip_dl
./xt_geoip_build -D /usr/share/xt_geoip *.csv
reboot
make some iptables rules for xtables geoip:
iptables -I INPUT 1 -m state --state NEW -m geoip ! --source-country DE,US -j DROP ## alow Traffic only from Germany and US
iptables -I INPUT 1 -s 127.0.0.1 -j ACCEPT ## allow internel Traffic
iptables -I INPUT 1 -s 77.72.174.132 -j ACCEPT ## allow Traffic from Voipprovider
Now save the rules:
iptables-save > /root/geoip.fw
Make a Entry in rc.local for Start the geip Firewall at System Start:
nano /etc/init.d/rc.local
Append the line:
/sbin/iptables-restore < /root/geoip.fw
save the rc.local file and reboot the System
after reboot show the rules:
/sbin/iptables -L -v -n
Now lets install the Asterisk and Vicidial prerequisites:
wget http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8o-4squeeze14_amd64.deb
dpkg -i libssl0.9.8_0.9.8o-4squeeze14_amd64.deb ## The package not exist on Wheezy, only on Squeeze
apt-get install perl libproc-processtable-perl libmysqlclient-dev php5-dev php5 php5-mcrypt libxml2-dev \
apache2 bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev make libedit2 \
libncurses5 libncurses5-dev unzip zip libnewt-dev libnewt0.52 gcc g++ perl libreadline5 \
libterm-readline-perl-perl readline-common mysql-client mysql-server libi18n-charset-perl \
libunicode-map-perl libunicode-map8-perl libunicode-maputf8-perl libreadline5 libterm-readline-perl-perl \
readline-common libole-storage-lite-perl libspreadsheet-parseexcel-perl libspreadsheet-writeexcel-perl \
libjcode-perl libjcode-pm-perl libproc-pid-file-perl libio-stringy-perl libnet-telnet-perl libnet-server-perl \
apache2-mpm-prefork build-essential iftop lame libmysqlclient-dev libncurses5-dev \
libploticus0-dev libsox-fmt-all mpg123 mytop ntp openssh-server php5 php5-cli php5-dev php5-mysql \
phpmyadmin ploticus screen sipsak sox subversion subversion-tools lame chkconfig rdate htop
Install cpam Modules: first type cpan and then install the modules
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install YAML
cpan> install MD5
cpan> install Digest::MD5
cpan> install Digest::SHA1
cpan> install readline
cpan> reload cpan
cpan> install DBI
cpan> force install DBD::mysql
cpan> install Net::Telnet
cpan> install Time::HiRes
cpan> install Net::Server
cpan> install Switch
cpan> install Mail::Sendmail
cpan> install Unicode::Map
cpan> install Jcode
cpan> install Spreadsheet::WriteExcel
cpan> install OLE::Storage_Lite
cpan> install Proc::ProcessTable
cpan> install IO::Scalar
cpan> install Spreadsheet::ParseExcel
cpan> install Curses
cpan> install Getopt::Long
cpan> install Net::Domain
cpan> install Term::ReadKey
cpan> install Term::ANSIColor
cpan> install Spreadsheet::XLSX
cpan> install Spreadsheet::Read
cpan> install LWP::UserAgent
cpan> install HTML::Entities
cpan> install HTML::Strip
cpan> install HTML::FormatText
cpan> install HTML::TreeBuilder
cpan> install Time::Local
cpan> install MIME::Decoder
cpan> install Mail::POP3Client
cpan> install Mail::IMAPClient
cpan> install Mail::Message
cpan> install IO::Socket::SSL
cpan> install MIME::Base64
cpan> install MIME::QuotedPrint
cpan> install Crypt::Eksblowfish::Bcrypt
cpan> quit
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
Install mtop
cd /usr/src
wget http://download.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
Installing eAccelerator for PHP
Install the php module:
cd /usr/src
wget https://github.com/eaccelerator/eaccelerator/zipball/master
unzip master
cd eaccelerator-eaccelerator-42067ac/
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
make install
nano /etc/php5/conf.d/eaccelerator.ini
extension="eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/var/cache/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"
and save the new eaccelerator.ini file
mkdir /var/cache/eaccelerator
chmod 777 /var/cache/eaccelerator
/etc/init.d/apache2 restart
Configure php.ini
nano /etc/php5/apache2/php.ini
Change the following values in your php.ini file.
Customize the date.timezone so you don't end up with a bunch of php errors complaining about it not being defined.
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
date.timezone = Europe/Berlin
Installing Asterisk
Any time you upgrade the Linux kernel you must recompile/install dahdi for the new kernel.
Asterisk must be compiled with dahdi support.
Note: The install MUST be done in the following order:
Minor note: dahdi-linux-complete-current.tar.gz and libpri-1.4-current.tar.gz may contain an updated version than what I am currently using, therefore the directory names may be different than shown below.
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-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
tar -zxf asterisk-1.8.23.0-vici.tar.gz
tar -zxf dahdi-linux-complete-current.tar.gz
tar -zxf libpri-1.4-current.tar.gz
cd dahdi-linux-complete-*
make
make install
make config
cd tools
make clean
make
make install
make config
cd /usr/src/asterisk/libpri-*
make clean
make
make install
cd ../asterisk-1.8.23.0
./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
chkconfig asterisk on
* Confirm DAHDI works properly.
* You do not need dahdi_dummy anymore, because it has not been required since DAHDI-Linux 2.3.0.
* The core of DAHDI is now able to use the kernel timers automatically if no telephony hardware is installed.
* http://www.voip-info.org/wiki/view/DAHDI
* http://www.voip-info.org/wiki/view/chan_dahdi.conf
* http://www.voip-info.org/wiki/view/Asterisk+CLI
service dahdi restart
chkconfig dahdi on
modprobe dahdi
lsmod | grep dahdi
dahdi_genconf
dahdi_cfg -vvv
dahdi_test
Installing audio files
Download the audio 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
Place the audio files in their proper places
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
ln -s /var/lib/asterisk/mohmp3 /var/lib/asterisk/default
cd /var/lib/asterisk/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 -f CHANGES*
rm -f LICENSE*
rm -f CREDITS*
cd /var/lib/asterisk/moh
rm -f CHANGES*
rm -f LICENSE*
rm -f CREDITS*
cd /var/lib/asterisk/sounds
rm -f CHANGES*
rm -f LICENSE*
rm -f 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 (ViciDial)
mysql
CREATE DATABASE `asterisk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'cron'@'localhost' IDENTIFIED BY '1234';
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;
quit
I am going to install the latest 2.x SVN trunk which happens to be version 2.8 at the time of writing this guide
mkdir /usr/src/astguiclient
cd /usr/src/astguiclient
svn checkout svn://svn.eflo.net:3690/agc_2-X/trunk
cd trunk
perl install.pl
You will have to define various things like IP address of the server and FTP username/password.
It will also ask you where is the web root, use /var/www/
Leave the other login settings as-is unless you already know how to update the database and other asterisk config files.
Import sample data
Login to mysql to run some commands
mysql
SET GLOBAL connect_timeout=60;
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
In the Linux terminal, enter these commands
cd /usr/src/astguiclient/trunk/bin/
chmod 777 *
/usr/src/astguiclient/trunk/bin/ADMIN_area_code_populate.pl
cp /usr/src/astguiclient/trunk/extras/performance_test_leads.txt /usr/share/astguiclient/LEADS_IN/
/usr/src/astguiclient/trunk/bin/VICIDIAL_IN_new_leads_file.pl --forcelistid=107 --forcephonecode=1
nano /etc/init.d/rc.local
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
/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 --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 +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
### 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
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
make rocordet files brousable:
nano /etc/apache2/sites-available/default (add the following lines)
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>
make changes in mysql configuration
nano /etc/mysql/my.cnf
Coment this line out with a # : bind-address = 127.0.0.1
At last make a small php file for forwarding to vicidial Welcome.php
nano /var/www/index.php
<?php
header("Location: /vicidial/welcome.php");
?>
and remove the index.html file
rm /var/www/index.html
Make changes to mysql database
nano /etc/mysql/my.cnf coment the line bindadress out with a #
Set a root password for mysql admin
mysqladmin -u root password NEWPASSWORD
reboot
now you can go to the Webinterface http://yourserverip
Start using vicidial
Login to vicidial and configure it.
Add users, campaigns, in-group, DID's, server, etc....
The default username is: 6666 and the password is: 1234
Additional notes
Dont forget to purchase the Agent and Managers Manual from www.eflo.net.
If you are going to use phpMyAdmin, then put it in a folder with a unique name that cannot be guessable
created on 06.21.2014
I have the instructions written very quickly. I make no claim to completeness. /
If you have questions or suggestions write me simply by email [email protected] /
or add me in skype : AssetButler
visit my Stes http://www.assetbutler and http://www.goautodiel.de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment