Установка FreeSWITCH 1.7 — CentOS


Предварительная подготовка:

yum update
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
yum install dnsmasq wget -y
yum install git autoconf automake libtool ncurses-devel libjpeg-devel -y
yum install sqlite-devel libcurl-devel pcre-devel speex-devel libedit-devel -y
yum install expat-devel openssl-devel libtiff-devel libX11-devel unixODBC-devel python-devel zlib-devel -y
yum install alsa-lib-devel libogg-devel libvorbis-devel perl-libs gdbm-devel uuid-devel -y yum install gcc-c++ -y
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm -y
yum install ldns-devel lua-devel libshout-devel lame-devel libsndfile-devel -y

Скачаем и скомпилируем:

cd /root
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install
cd /usr/local/src
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git
cd /usr/local/src/freeswitch/
./bootstrap.sh -j
cd /usr/local/src/freeswitch/libs/
git clone https://freeswitch.org/stash/scm/sd/libyuv.git
cd libyuv
make -f linux.mk CXXFLAGS="-fPIC -O2 -fomit-frame-pointer -Iinclude/"
make install
ln -s /usr/lib/pkgconfig/libyuv.pc /usr/lib64/pkgconfig/
cd /usr/local/src/freeswitch/libs/
git clone https://freeswitch.org/stash/scm/sd/libvpx.git
cd libvpx
./configure --enable-pic --disable-static --enable-shared
make
make install
ln -s /usr/local/lib/pkgconfig/vpx.pc /usr/lib64/pkgconfig/
cd /usr/local/src/freeswitch/libs/
git clone https://freeswitch.org/stash/scm/sd/opus.git
cd opus
./autogen.sh
./configure
make
make install
ln -s /usr/local/lib/pkgconfig/opus.pc /usr/lib64/pkgconfig/
cd /usr/local/src/freeswitch/libs/
git clone https://freeswitch.org/stash/scm/sd/libpng.git
cd libpng
./configure
make
make install
ln -s /usr/local/lib/pkgconfig/libpng* /usr/lib64/pkgconfig/

cd /usr/local/src/freeswitch/
./configure -C
make
make install
make samples
make sounds-install moh-install sounds-ru-install
make hd-sounds-install hd-moh-install hd-sounds-ru-install
make uhd-sounds-install uhd-moh-install uhd-sounds-ru-install
make cd-sounds-install cd-moh-install cd-sounds-ru-install

Финальная настройка:

useradd --system --home-dir /usr/local/freeswitch -G daemon freeswitch
passwd -l freeswitch
chown -R freeswitch:daemon /usr/local/freeswitch/
chmod -R 770 /usr/local/freeswitch/
chmod -R 750 /usr/local/freeswitch/bin/*
mkdir /var/run/freeswitch
chown -R freeswitch:daemon /var/run/freeswitch
ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin/
cp /usr/local/src/freeswitch/build/freeswitch.init.redhat /etc/init.d/freeswitch
chmod 750 /etc/init.d/freeswitch
chown freeswitch:daemon /etc/init.d/freeswitch
chkconfig freeswitch on
service freeswitch start

iptables -I INPUT -p udp --dport 5060 -m string --string "friendly-scanner" --algo bm -j DROP
iptables -I INPUT -p udp --dport 5080 -m string --string "friendly-scanner" --algo bm -j DROP
iptables -I INPUT -m string --string "REGISTER sip:" --algo bm --to 65 -m hashlimit --hashlimit 4/minute
--hashlimit-burst 1 --hashlimit-mode srcip,dstport --hashlimit-name sip_r_limit -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 5060 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 5060 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 5080 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 5080 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 16384:32768 -j ACCEPT
service iptables save

Проверяем работу:


fs_cli
freeswitch@internal> status
UP 0 years, 0 days, 0 hours, 1 minute, 45 seconds, 488 milliseconds, 44 microseconds
FreeSWITCH (Version 1.7.0 git 0d6e17b 2015-10-29 22:02:14Z 64bit) is ready
0 session(s) since startup
0 session(s) - peak 0, last 5min 0
0 session(s) per Sec out of max 30, peak 0, last 5min 0
1000 session(s) max
min idle cpu 0.00/98.63
Current Stack Size/Max 240K/8192K