1.Backup database on your CTI server.
mysqldump -uroot -pyour_password astercc10 > astercc_backup.sql
Copy the sql file to your MySQL(192.168.1.60) sever and do import:
mysql -uroot -pyour_passwordastercc10 < astercc_backup.sql
2.set privileges on your MySQL server, to make sure you have mysql access on CTI and PHP servers Run the following commond on your mysql server mysql>
grant all privileges on astercc10.* to astercc@'192.168.1.%' identified by 'asterccpw';
Now you are supposed to have mysql access from 192.168.1.*
3.update /etc/astercc.conf on the CTI,PHP1,PHP2 servers, section [database] and [statistics]:
[database] dbtype = mysql dbhost = 192.168.1.60 dbname = astercc10 dbport = 3306 username = astercc password = asterccpw prefix= cc10_ [statistics] ;on/off status = on dbtype = mysql dbhost = 192.168.1.60 dbname = astercc10 dbport = 3306 dbuser = astercc dbpassword = asterccpw prefix= cc10_ [system] ;if Cluster no,php,asterisk,all cluster = php
4.update php database config /var/www/html/asterCC/app/config/database.php on your php servers
class DATABASE_CONFIG {
var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => '192.168.1.60', 'login' => 'astercc', 'password' => 'asterccpw', 'database' => 'astercc10', 'prefix' => 'cc10_', 'encoding' => 'utf8', );
5.Update firewall config file: /etc/sysconfig/iptables, then do service iptables restart
On CTI(Nginx):
*filter :INPUT DROP [32888:6036616] :FORWARD DROP [0:0] :OUTPUT ACCEPT [38964:13133002] -A INPUT -p udp -m udp --dport 5060 -j ACCEPT -A INPUT -p udp -m udp --dport 4569 -j ACCEPT -A INPUT -p udp -m udp --dport 5036 -j ACCEPT -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT -A INPUT -p udp -m udp --dport 2727 -j ACCEPT -A INPUT -p udp -m udp --dport 137:138 -j ACCEPT -A INPUT -p udp -m udp --dport 123 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT -A INPUT -p tcp -m tcp --dport 389 -j ACCEPT -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT -A INPUT -p tcp -m tcp --dport 5038 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT -A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT -A INPUT -m state --state ESTABLISHED -j ACCEPT COMMIT
On MySQL:
*filter :INPUT DROP [32888:6036616] :FORWARD DROP [0:0] :OUTPUT ACCEPT [38964:13133002] -A INPUT -p udp -m udp --dport 5060 -j ACCEPT -A INPUT -p udp -m udp --dport 4569 -j ACCEPT -A INPUT -p udp -m udp --dport 5036 -j ACCEPT -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT -A INPUT -p udp -m udp --dport 2727 -j ACCEPT -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p udp -m udp --dport 161 -j ACCEPT -A INPUT -p tcp -m tcp --dport 161 -j ACCEPT -A INPUT -p udp -m udp --dport 162 -j ACCEPT -A INPUT -p tcp -m tcp --dport 162 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT -A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT -A INPUT -m state --state ESTABLISHED -j ACCEPT COMMIT
On PHP1:
*filter :INPUT ACCEPT [32888:6036616] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [38964:13133002] -A INPUT -p udp -m udp --dport 5060 -j ACCEPT -A INPUT -p udp -m udp --dport 4569 -j ACCEPT -A INPUT -p udp -m udp --dport 5036 -j ACCEPT -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT -A INPUT -p udp -m udp --dport 2727 -j ACCEPT -A INPUT -p tcp -m tcp --dport 9000 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 5038 -j ACCEPT COMMIT
On PHP2: same as PHP1
Port usage: please open correct port on /etc/sysconfig/iptables 21:FTP 22:SSH 80:http, if you changed http port in nginx, please make sure you set this properly 123:NTP 137:udp samba 138:udp samba 139:tcp samba 389:tcp samba 445:tcp samba 901:tcp samba 161:SNMP的 162:SNMP-trap 443:https 2727:MGCP 3306:mysql 4569:IAX2 5036:IAX1 5038:Asterisk AMI 5060:sip 9000:php fpm 10000:20000:Asterisk rtp
6.Install samba on your CTI and php servers
yum install samba
7.Configure samba username and password, such as: sbu/123456, first:
useradd sbuthen, enter password when it prompts:
smbpasswd -a sbu
8.Update samba configure file /etc/samba/smb.conf, append the following lines:
on CTI server:
[ccastspool] path = /var/spool/asterisk comment = Home Directories browseable = no writable = yes ; valid users = %S ; valid users = MYDOMAIN\%S create mask=777 directory mask = 777 force user = asterisk [ccastetc] path = /etc/asterisk/ comment = Home Directories browseable = no writable = yes ; valid users = %S ; valid users = MYDOMAIN\%S create mask=777 directory mask = 777 force user = asterisk [ccastlib] path = /var/lib/asterisk/ comment = Home Directories browseable = no writable = yes ; valid users = %S ; valid users = MYDOMAIN\%S create mask=777 directory mask = 777 force user = asterisk [ccscripts] path = /opt/asterisk/scripts/astercc comment = Home Directories browseable = no writable = yes ; valid users = %S ; valid users = MYDOMAIN\%S create mask=777 directory mask = 777 force user = asterisk
on PHP1 server:
[ccdata] path = /var/www/html/asterCC/data comment = Home Directories browseable = no writable = yes ; valid users = %S ; valid users = MYDOMAIN\%S create mask=777 directory mask = 777 force user = asterisk [ccstatistics] path = /var/www/html/asterCC/statistics comment = Home Directories browseable = no writable = yes ; valid users = %S ; valid users = MYDOMAIN\%S create mask=777 directory mask = 777 force user = asterisk
9. restart sambe, execute:
service smb restart
10. Mount files. (Please do backup first before you mount, let's say you are going to mount ccdata to /var/www/html/asterCC/data, backup your /var/www/html/asterCC/data first)
on CTI server, execute:
mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdate /var/www/html/asterCC/data mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics
on PHP1, execute:
mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastetc /etc/asterisk
on PHP2, execute:
mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastetc /etc/asterisk mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc
11. update php-fpm config file /etc/php-fpm.d/www.conf on CTI:
[www] listen=127.0.0.1 listen.allowed_clients=127.0.0.1
on PHP1:
[www] listen=192.168.1.61:9000 listen.allowed_clients=127.0.0.1,192.168.1.61,192.168.1.62
on PHP2:
[www] listen=192.168.1.70:9000 listen.allowed_clients=127.0.0.1,192.168.1.70,192.168.1.62
12.update nginx config file /usr/local/nginx/conf/nginx.conf
on CTI:
12-1: add the following content in http section:
http{ upstream myphp { #ip_hash; PHP load balance server 192.168.1.61:9000 weight=2; server 192.168.1.70:9000 weight=2; } }
12-2:update location section:
location ~ .*\.(php|php5)?$ { #use local server for login and reloadConf action set $target myphp; if ($request_uri ~* login) { set $target 127.0.0.1:9000; } if ($request_uri ~* reloadConf) { set $target 127.0.0.1:9000; } fastcgi_pass $target; #fastcgi_pass 127.0.0.1:9000; }
13. Share licensing
on CTI:
13-1: do backup:
cp -Rp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/statistics/agentsxindesk.ctpexecute:
ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp
13-2:copy:
cp -Rp /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/statistics/database.phpexecute:
ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php
13-3:make sure /opt/asterisk/scripts/astercc/identity.astercc, /opt/asterisk/scripts/astercc/license.astercc are original files before you mount
cp -Rp /usr/local/conf/hcdesk.conf /opt/asterisk/scripts/astercc/hcdesk.conf
ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf
cp -Rp /etc/astercc.conf /opt/asterisk/scripts/astercc/astercc.conf
ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf
on PHP1:
13-4:backup agentsxindesk.ctp
mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak
ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp
13-5:
mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak
ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php
13-6: backup hcdesk.conf
mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak
ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf
13-7:backup astercc.conf
mv /etc/astercc.conf /etc/astercc.conf.bak
ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf
on PHP2:
13-8: bacup agentsxindesk.ctp
mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak
ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp
13-8:
mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak
ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php
13-9: backup hcdesk.conf
mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak
ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf
13-10: backup astercc.conf
mv /etc/astercc.conf /etc/astercc.conf.bak
ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf
14. update config files
on CTI: update /etc/asterisk/manager.conf, so other servers could access asterisk:
[astercc] secret = asterccsecret deny=0.0.0.0/0.0.0.0 permit=127.0.0.1/255.255.255.0 permit=192.168.1.0/255.255.255.0 read = system,call,agent write = system,call,agent,user,config,command,reporting,originate
apply the changes
asterisk -rx "manager reload"
update /etc/astercc.conf
[asterisk] server = 192.168.1.62 port = 5038 username = astercc secret = asterccsecret
15.make sure /etc/asterisk is owned by asterisk:asterisk
16.update crontab by “crontab -e”
on CTI:
30 12 * * * /opt/asterisk/scripts/astercc/processmonitors -d 30 20 * * * /opt/asterisk/scripts/astercc/processmonitors -d 30 23 * * * /opt/asterisk/scripts/astercc/processmonitors -d * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app asterccdelete >/dev/null 2>&1 10 2 * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app nighttask >/dev/null 2>&1 10 0 * * * /opt/asterisk/scripts/astercc/agent_report -d 20 0 * * * /opt/asterisk/scripts/astercc/agentgroup_report -d
MySQL: remove all crontabe
PHP1 and PHP2, you just need to make sure these scripts are executed on either one
* * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app checkonline >/dev/null 2>&1 * 2 * * * /opt/asterisk/scripts/astercc/astcc_backup.sh >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app monitortar >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app backupmonitor >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app export >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app asterccimport >/dev/null 2>&1 */5 * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app calculate >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app mailman >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app campaignpackgetask >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app blacklistfilter >/dev/null 2>&1 * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app asterccfilter >/dev/null 2>&1 * * * * * /opt/asterisk/scripts/astercc/astcc_historydata -d
17. make sure mount in crontabe CTI:
*/5 * * * * dfccdata=`df |grep ccdata`; [ "X${dfccdata}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data`; */5 * * * * dfccstatistics=`df |grep ccstatistics`; [ "X${dfccstatistics}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics`;
PHP1:
*/5 * * * * dfccastspool=`df |grep ccastspool`; [ "X${dfccastspool}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk/`; */5 * * * * dfastetc=`df |grep etc/asterisk`; [ "X${dfastetc}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastetc /etc/asterisk/`; */5 * * * * dfccastlib=`df |grep ccastlib`; [ "X${dfccastlib}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk/`; */5 * * * * dfccscripts=`df |grep ccscripts`; [ "X${dfccscripts}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc/`;
PHP2:
*/5 * * * * dfccdata=`df |grep ccdata`; [ "X${dfccdata}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data`; */5 * * * * dfccstatistics=`df |grep ccstatistics`; [ "X${dfccstatistics}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics`; */5 * * * * dfccastspool=`df |grep ccastspool`; [ "X${dfccastspool}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk/`; */5 * * * * dfastetc=`df |grep etc/asterisk`; [ "X${dfastetc}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastetc /etc/asterisk/`; */5 * * * * dfccastlib=`df |grep ccastlib`; [ "X${dfccastlib}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk/`; */5 * * * * dfccscripts=`df |grep ccscripts`; [ "X${dfccscripts}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc/`;
18. At last,
On CTI server:
/opt/asterisk/scripts/astercc/asterccc --RNIOn PHP1:
/opt/asterisk/scripts/astercc/asterccc --ADIon PHP2:
/opt/asterisk/scripts/astercc/asterccc --ADI
If everything is good, you will see 001 on CTI server, 002 on PHP1, 003 on PHP2, after license is issued, run service asterccd restart on CTI server.