Cài đặt tổng đài Freeswitch FusionPBX

CentOS v7
Freeswitch v1.6
FusionPBX v4.4
MariaDB v5.5
Apache v2.4
PHP v7.1

Tắt Selinux

sestatus
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

Reboot server

yum -y update && yum -y install epel-release
yum -y install git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libmemcached-devel nano httpd unixODBC mysql-connector-odbc memcached ghostscript libtiff-devel libtiff-tools at mariadb mariadb-server tftp-server

Time Zone

timedatectl set-timezone Asia/Ho_Chi_Minh
​timedatectl status

PHP

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install epel-release yum-utils -y
yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt 
yum-config-manager --enable remi-php71
yum -y install php php-common php-pdo php-soap php-xml php-xmlrpc php-mysqlnd php-cli php-imap php-mcrypt php-gd php-odbc php-opcache php-json

Memmcached

nano /etc/sysconfig/memcached

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1"

Lấy Personal Token tại đây https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Installation/HOWTO-Create-a-SignalWire-Personal-Access-Token_67240087/

Cài Freeswitch 

echo "signalwire" > /etc/yum/vars/signalwireusername
echo "TOKEN" > /etc/yum/vars/signalwiretoken
yum install -y https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@freeswitch.signalwire.com/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
yum install -y freeswitch-config-vanilla freeswitch-sounds* freeswitch-lang* freeswitch-lua freeswitch-xml-cdr

Database

systemctl start mariadb
password=somepassword
mysql -e "CREATE DATABASE freeswitch;"
mysql -e "CREATE DATABASE fusionpbx;"
mysql -e "GRANT ALL PRIVILEGES ON freeswitch.* TO fusionpbx@localhost IDENTIFIED BY '$password';"
mysql -e "GRANT ALL PRIVILEGES ON fusionpbx.* TO fusionpbx@localhost IDENTIFIED BY '$password';"
mysql -e "flush privileges;"

ODBC

nano /etc/odbc.ini

[freeswitch]
Driver = MySQL
SERVER = 127.0.0.1
PORT = 3306
DATABASE = freeswitch
OPTION = 67108864
Socket = /var/lib/mysql/mysql.sock
threading=0
MaxLongVarcharSize=65536
[fusionpbx]
Driver = MySQL
SERVER = 127.0.0.1
PORT = 3306
DATABASE = fusionpbx
OPTION = 67108864
Socket = /var/lib/mysql/mysql.sock
threading=0

Test odbc driver

odbcinst -s -q

Kiểm tra odbc kết nối

isql -v freeswitch fusionpbx somepassword
quit

Fusionpbx

cd /var/www/html
git clone -b 4.4 https://github.com/powerpbx/fusionpbx.git .
mv /etc/freeswitch /etc/freeswitch.orig
mkdir /etc/freeswitch
cp -R /var/www/html/resources/templates/conf/* /etc/freeswitch
mkdir -p /usr/share/freeswitch/sounds/music/default
mv /usr/share/freeswitch/sounds/music/*000/ /usr/share/freeswitch/sounds/music/default/

Apache

usermod -a -G apache freeswitch
sed -i "s/User apache/User freeswitch/" /etc/httpd/conf/httpd.conf
sed -i "s/Group apache/Group daemon/" /etc/httpd/conf/httpd.conf
sed -i ':a;N;$!ba;s/AllowOverride None/AllowOverride All/2' /etc/httpd/conf/httpd.conf

Ownership

chown -R freeswitch.daemon /etc/freeswitch /var/lib/freeswitch /var/log/freeswitch /usr/share/freeswitch /var/www/html
 
find /etc/freeswitch -type d -exec chmod 770 {} \;
find /var/lib/freeswitch -type d -exec chmod 770 {} \;
find /var/log/freeswitch -type d -exec chmod 770 {} \;
find /usr/share/freeswitch -type d -exec chmod 770 {} \;
find /var/www/html -type d -exec chmod 770 {} \;
 
find /etc/freeswitch -type f -exec chmod 664 {} \;
find /var/lib/freeswitch -type f -exec chmod 664 {} \;
find /var/log/freeswitch -type f -exec chmod 664 {} \;
find /usr/share/freeswitch -type f -exec chmod 664 {} \;
find /var/www/html -type f -exec chmod 664 {} \;

Taọ file cấu hình hệ thống cho freeswitch

nano /etc/systemd/system/freeswitch.service

[Unit]
Description=FreeSWITCH
Wants=network-online.target
After=syslog.target network-online.target
After=mariadb.service httpd.service
[Service]
Type=forking
User=freeswitch
ExecStartPre=/usr/bin/mkdir -m 0750 -p /run/freeswitch
ExecStartPre=/usr/bin/chown freeswitch:daemon /run/freeswitch
WorkingDirectory=/run/freeswitch
PIDFile=/run/freeswitch/freeswitch.pid
EnvironmentFile=-/etc/sysconfig/freeswitch
ExecStart=/usr/bin/freeswitch -ncwait -nonat $FREESWITCH_PARAMS
ExecReload=/usr/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

Enable services

systemctl daemon-reload
systemctl enable mariadb
systemctl enable httpd
systemctl enable freeswitch
systemctl enable memcached
systemctl restart httpd
systemctl restart freeswitch
systemctl restart memcached

Firewall

firewall-cmd --permanent --zone=public --add-service={http,https}
firewall-cmd --permanent --zone=public --add-port={5060,5061,5080,5081}/tcp
firewall-cmd --permanent --zone=public --add-port={5060,5061,5080,5081}/udp
firewall-cmd --permanent --zone=public --add-port=16384-32768/udp
firewall-cmd --reload
firewall-cmd --list-all

Mở trình duyệt web và nhập địa chỉ IP của server để mở giao diện cài đặt
Chọn ngôn ngữ để sử dụng.


Tiến hành cài đặt các thông số:
Username
Password
Database Name: fusionpbx
Database Username: fusionpbx
Database Password: password
Không Check “Create the database”

CentOS 7 and RHEL 7 | FreeSWITCH Documentation (signalwire.com)

Freeswitch install — FusionPBX Docs documentation

Hướng dẫn cài đặt FusionPBX v4.4 Freeswitch v1.6 CentOS v7 MariaDB Apache – Vietcalls Blog

Cài đặt FusionPBX v4.4 trên CentOS 7 – TEL4VN – Đào tạo tổng đài

 

 

 

Leave a Reply

You must be logged in to post a comment.