Vicidial install on Ubuntu 14.04

Updated: Sep-04-2020

Note: Below steps only cover standalone server installation on Ubuntu 14.04. AND Ubuntu 18.04 with Vicidial not supported yet.

I am using Digitalocean VPC. Installation should be similar in AWS EC2 instances.

Make sure to open 8088,8089,80,443 TCP and 10000 -20000 UDP ports Open in your firewall..

Standard Packages:

sudo apt-get install build-essential

apt-get install linux-headers-`uname -r`

apt-get install subversion libjansson-dev sqlite autoconf automake  libxml2-dev libncurses5-dev -y

sudo add-apt-repository ppa:ondrej/php

#Press ENTER

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E5267A6C 

#Press ENTER

sudo apt update

sudo apt-get install apache2 apache2-bin apache2-data libapache2-mod-php5.6 php5.6 php5.6-cli php5.6-common php5.6-json php5.6-mysql php5.6-readline sox lame screen libnet-telnet-perl php5.6-mysqli  -y

apt-get install libasterisk-agi-perl

apt-get install mysql-server

apt-get install libelf-dev

apt-get install autogen libtool shtool

Special package for ASTblind and ASTloop(ip_relay need this package)

apt-get install libc6-i386

#This Setup is painful, but you need to do it.(will try to add the packages)

[email protected]:~# cpan
Loading internal logger. Log::Log4perl recommended for better logging

There seems to be running another CPAN process (pid 9731). Contacting...
Other job is running.
Shall I try to run in downgraded mode? (Y/n) [y] 
Running in downgraded mode (experimental).
Please report if something unexpected happens

cpan shell -- CPAN exploration and modules installation (v2.26)

nolock_cpan>  

#install below modules

install CPAN::Meta::Requirements
install CPAN
reload cpan
install YAML
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
install Spreadsheet::XLSX
install Spreadsheet::Read
install LWP::UserAgent
install HTML::Entities
install HTML::Strip
install HTML::FormatText
install HTML::TreeBuilder
install Time::Local
install MIME::Decoder
install Mail::POP3Client
install Mail::IMAPClient
install Mail::Message
install IO::Socket::SSL
install MIME::Base64
install MIME::QuotedPrint
install Crypt::Eksblowfish::Bcrypt

Install Asterisk and Dhadi:

#Install dahdi

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

tar -xvf dahdi-linux-complete-2.11.1-rc1+2.11.1-rc1.tar.gz

cd dahdi-linux-complete-2.11.1-rc1+2.11.1-rc1/ 

make all &&  make install && make config

cp /etc/dahdi/system.conf.sample /etc/dahdi/system.conf

#reboot system

reboot

#test dahdi 

modprobe dahdi

[email protected]:~# /usr/sbin/dahdi_cfg -vvvvvvvvvvvvv

DAHDI Tools Version - 2.11.1-rc1

DAHDI Version: 2.11.1-rc1

Echo Canceller(s): 

Configuration

======================

Channel map:

0 channels to configure.


#Install Asterisk 

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz

tar -xvf asterisk-13-current.tar.gz

cd asterisk-13.25.0/

./contrib/scripts/install_prereq install && ./bootstrap.sh 


#This could take time..

# if you need WebRtc Support 

./configure --libdir=/usr/lib --with-gsm=internal --enable-opus --enable-srtp --with-ogg=/usr/lib64/ --with-ssl --enable-asteriskssl --with-pjproject-bundled

make && make menuconfig

#select app_meetme in Applications(Vicidial Need this for conference)
#select res_http_websocket,res_srtp for WebRTC support.



# If you want Regualr setup with Softphone

./configure  && make && make menuconfig


#select app_meetme in Applications(Vicidial Need this for conference)

make install && make samples

asterisk

asterisk -r


vici*CLI> dahdi show channels

   Chan Extension       Context         Language   MOH Interpret        Blocked    In Service Description                     

pseudo                 default                    default                         Yes                                        



#WebRTC Extra steps(IF YOU DONT NEED WEBRTC SKIP BELOW STEPS)
Note: Since WebRTC need SSL i am using my Public Domain to Generate SSL from Let's Encrypt.
How to Generate SSL: Link here 

sample http.conf

cat /etc/asterisk/http.conf 
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
enablestatic=yes
tlsenable=yes
tlsbindaddr=YOURPUBLICIP:8089
#(replace j.thojutam.com with your domain)
tlscertfile=/etc/letsencrypt/live/j.thoutam.com/cert.pem 
tlsprivatekey=/etc/letsencrypt/live/j.thoutam.com/privkey.pem


sample sip.conf 

cat /etc/asterisk/sip.conf
[general]
transport=udp,ws,wss
avpf=yes
srvlookup=yes
udpbindaddr=0.0.0.0:5060
context=trunkinbound  
allowguest=no     
allowoverlap=no
realm=j.thoutam.com  ; REPLACE YOUR DOMAIN HERE
bindport=5060 
bindaddr=0.0.0.0 
srvlookup=yes                  
disallow=all               
allow=ulaw                  
allow=alaw
mohinterpret=default
mohsuggest=default
language=en 

#check http show status 

Install VICIDIAL from Source:
cd /usr/src
mkdir astguiclient/
cd astguiclient/
svn checkout svn://svn.eflo.net/agc_2-X/trunk
cd trunk/
MySQL setup for VICIDIAL:
#start MySQL 

service mysql start

mysql -uroot -pPASSWORD

# Create Dialer DB

create database DialerDB;

#Grant all privileges to DialerDB cron which used in astguiclient.conf file 

GRANT ALL PRIVILEGES on DialerDB.* to 'cron'@'localhost' IDENTIFIED by '1234';

#Grant all privileges to custom this needed for custom tables
 
GRANT ALL PRIVILEGES on DialerDB.* to 'custom'@'localhost' IDENTIFIED by 'custom1234';

exit;

# Load the initial database

cd /usr/src/astguiclient/trunk/extras
mysql -uroot -p DialerDB <  MySQL_AST_CREATE_tables.sql

#Load First instalation setup database

mysql -uroot -p DialerDB <  first_server_install.sql

#Load sample sip and iax phones(this contain default user pass, carefull when you installing in vpc)

mysql -uroot -p DialerDB <   sip-iax_phones.sql


#Do back to root Directory of vicidial

cd ..
perl install.pl

#Fallow the setup with appropriate value.
 


#Configiguration example




#Populate ISO country codes 

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


#update the Server IP with latest IP address.(VICIDIAL DEFAULT IP IS 10.10.10.15)

perl /usr/src/astguiclient/trunk/bin/ADMIN_update_server_ip.pl --old-server_ip=10.10.10.15
#Say 'Yes' to all

#Add crontab entries(Conf generation, Autodialing, Audio mix and other keepalive processes run from here.

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

Note: Lookout for the recording removal cron. It might fill your server.

#Add entries to rc.local file to start vicidial and related services

# OPTIONAL enable ip_relay(for same-machine trunking and blind monitoring)

/usr/share/astguiclient/ip_relay/relay_control start 2>/dev/null 1>&2

### 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
#Then Reboot the server.
VICIDIAL processes run on screen. There should be 9 Processes running on the screen.
[email protected]:~# screen -ls

There are screens on:

 2240.ASTVDremote (03/21/2019 02:16:03 AM) (Detached)

 2237.ASTVDauto (03/21/2019 02:16:03 AM) (Detached)

 2234.ASTlisten (03/21/2019 02:16:02 AM) (Detached)

 2231.ASTsend (03/21/2019 02:16:02 AM) (Detached)

 2228.ASTupdate (03/21/2019 02:16:02 AM) (Detached)

 2025.ASTconf3way (03/21/2019 02:15:02 AM) (Detached)

 2019.ASTVDadapt (03/21/2019 02:15:02 AM) (Detached)

 1826.asterisk (03/21/2019 02:14:51 AM) (Detached)

 1819.astshell20190321021448 (03/21/2019 02:14:49 AM) (Detached)

9 Sockets in /var/run/screen/S-root.
All Set now. Now, You can configure web interface and logins.
Vicidial Admin login :
http://VICIDIAL_SERVER_IP/vicidial/admin.php
user: 6666
Pass: 1234
Continue On to the Initial Setup
#Add Secure Password for admin and SIP
#Give Super admin access to 6666 user
users —> 6666 –> Change all 0 to 1 in Interface Options.
#WebRTC Extra steps(IF YOU DONT NEED WEBRTC SKIP BELOW STEPS)
#Enable WebRTC from GUI and Download PBXWebPhone
cd /var/www/html/agc/
git clone https://github.com/chornyitaras/PBXWebPhone.git
# Add Web Socket URL to Server in Server settings from 6666(Admin login).



Replace j.thoutam.com with your domain.


# Goto system settings and Add WebPhone URL path




#Goto Templates --> SIP_generic and add below content to template.

type=friend
context=default
host=dynamic
trustrpid=yes
sendrpid=no
qualify=yes
qualifyfreq=600
transport=ws,wss,udp
encryption=yes
avpf=yes
icesupport=yes
rtcp_mux=yes
directmedia=no
disallow=all
allow=ulaw,opus,vp8,h264
nat=yes
directmedia=no 
dtlsenable=yes
dtlsverify=no
;Replace j.thoutam.com with your domain.
dtlscertfile=/etc/letsencrypt/live/j.thoutam.com/cert.pem
dtlsprivatekey=/etc/letsencrypt/live/j.thoutam.com/privkey.pem 
dtlssetup=actpass


#Goto to Phones --> Select cc100 --> Set As a WebPhone --> Y 


And Set Template ID: SIP_Generic




Wait for few minutes to Generate config..

#Next steps
1. Create Campaign
2. Create SIP Trunk
3. Create Dialplan
4. Upload Leads
5. Register Users to SopftPhone
6. Create Agents/users
Note: If WebRTC enable you don’t need softphone anymore.
………
And Enjoy…
Note: if you building the server for more than 30+ agents, I recommend to use bare metal servers than VPC. 
Please let me know if you have any issues.

Media parameter in SIP

m=audio 12548 RTP/AVP 0 8 101

It’s a field from SDP protocol, describing parameters of media (“m” is for “media”). Next, the type of media is “audio”, not video, for example. (m=audio). 12548 is a port address for streaming media. “RTP/AVP” means “RTP Audio/Video
Profile” and representing one of RTP profiles, which are coded by 0, 8 and 101. 0 is PCMU 8000 Hz, 8 is PCMA 8000 Hz, and 101 is payload type for DTMF digits sending.

Install OpenSIPs

Install OpenSIPs

OpenSIPS is a multi-functional, multi-purpose signaling SIP server used by carriers, telecoms or ITSPs for solutions like Class4/5 Residential Platforms, Trunking / Wholesale, Enterprise / Virtual PBX Solutions, Session Border Controllers, Application Servers, Front-End Load Balancers, IMS Platforms, Call Centers, and many others…

Platfrom : Ubuntu 14.04 +

Let’s Begin…

apt-get install build-essential openssl bison flex
apt-get install perl libdbi-perl libdbd-mysql-perl libdbd-pg-perl libfrontier-rpc-perl libterm-readline-gnu-perl libberkeleydb-perl ncurses-dev
apt-get install mysql-server libmysqlclient-dev
wget http://opensips.org/pub/opensips/latest/opensips-2.3.0.tar.gz
tar -xvf opensips-2.3.0.tar.gz
cd opensips-2.3.0/
make all
make install 
mkdir /var/run/opensips
cd packaging/debian/
cp opensips.default /etc/default/opensips
cp opensips.init /etc/init.d/opensips
chmod +x /etc/init.d/opensips
useradd opensips
update-rc.d opensips defaults 99
vim /etc/default/opensips
Here you need to replace the 'RUN_OpenSIPS' to 'Yes'. You can also change the user and group and name that you wish to use for the Opensips services and also change the shared memory to minimum 128 which is recommended for the OpenSIPS server.

 

we also need to update the daemon on OpenSIP and change it location in its startup script and update its state from ‘off’ to ‘on’ and then close the file after making changes.