Ubuntu16.04編譯安裝Freeswitch 1.10

一、添加第三方源

echo "deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse" >> /etc/apt/source.list
echo "deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse">> /etc/apt/source.list
echo "deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse" >> /etc/apt/source.list
echo "deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse" >> /etc/apt/source.list
echo "deb http://cz.archive.ubuntu.com/ubuntu xenial main universe" >> /etc/apt/source.list

二、安裝Video LAN程序包

apt-get update
apt-get install -y software-properties-common tzdata
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
add-apt-repository ppa:videolan/stable-daily

三、安裝部分依賴包

apt-get update && apt-get install -y autoconf automake bison build-essential fail2ban gawk git-core groff groff-base erlang-dev libasound2-dev libavcodec-dev libavutil-dev libavformat-dev libav-tools libavresample-dev libswscale-dev liba52-0.7.4-dev libssl-dev libdb-dev libexpat1-dev libcurl4-openssl-dev libgdbm-dev libgnutls-dev libjpeg-dev libmp3lame-dev libncurses5 libncurses5-dev libperl-dev libogg-dev libsnmp-dev libtiff5-dev libtool libvorbis-dev libx11-dev libzrtpcpp-dev make portaudio19-dev python-dev snmp snmpd subversion unixodbc unixodbc-dev uuid-dev zlib1g-dev libsqlite3-dev libpcre3-dev libspeex-dev libspeexdsp-dev libldns-dev libedit-dev libladspa-ocaml-dev libmemcached-dev libmp4v2-dev libpq-dev libvlc-dev libv8-dev liblua5.2-dev libyaml-dev libpython-dev odbc-postgresql sendmail wget yasm libldap2-dev libcodec2-dev vim net-tools nmap

四、配置使用gawk

update-alternatives --set awk /usr/bin/gawk

五、編譯安裝程序依賴包

1.安裝cmake

# mkdir /opt/software 
# wget https://github.com/Kitware/CMake/releases/download/v3.17.2/cmake-3.17.2.tar.gz -P /opt/software

# cd /opt/software
# tar -zxvf cmake-3.17.2.tar.gz
# cd cmake-3.7.2
./bootstrap --prefix=/usr
make && make install

2.安裝libks

# git clone https://github.com/signalwire/libks.git /opt/software/ 
# cd /opt/software/libks
cmake .
make && make install

3.安裝signalwire-c

# git clone https://github.com/signalwire/signalwire-c.git /opt/software 
# cd /opt/software/signalwire-c
cmake .
make && make install

4.安裝mod_mariadb依賴包

# wget https://downloads.mariadb.com/Connectors/c/connector-c-3.1.7/mariadb-connector-c-3.1.7-linux-x86_64.tar.gz -P /opt/software
# cd /opt/software

# tar -zxvf mariadb-connector-c-3.1.7-linux-x86_64.tar.gz
cp -r mariadb-connector-c-3.1.7-linux-x86_64/include/mariadb/* /usr/include
cp -r mariadb-connector-c-3.1.7-linux-x86_64/lib/mariadb/* /lib/x86_64-linux-gnu/

# export PKG_CONFIG_PATH=/opt/software/mariadb-connector-c-3.1.7-linux-x86_64/lib/pkgconfig

5.安裝mysql數據庫連接程序

# tar -zxvf mysql-connector-odbc-8.0.19-linux-ubuntu16.04-x86-64bit.tar.gz 
cp -r mysql-connector-odbc-8.0.19-linux-ubuntu16.04-x86-64bit/lib/* /usr/lib/x86_64-linux-gnu/odbc/

ln -sf /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so /usr/lib/
ln -sf /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so /usr/lib/

6.安裝freeswitch編譯部分依賴包

# GIT_SSL_NO_VERIFY=1
# git clone https://github.com/BetterVoice/freeswitch-container.git /opt/software
# sh /opt/software/freeswitch-container/build/install-deps.sh

六、編制安裝freeswitch 1.10

# git clone https://github.com/signalwire/freeswitch.git -b v1.10 /opt/software
# cd /opt/software/freeswitch
./bootstrap.sh
./configure --prefix=/opt/freeswitch --with-gnu-ld --with-python --with-erlang --with-openssl --enable-portable-binary --enable-core-odbc-support --enable-zrtp
make && make install
make uhd-sounds-install
make uhd-moh-install

cp src/mod/databases/mod_mariadb/.libs/mod_mariadb.so /opt/freeswitch/lib/freeswitch/mod/
cp -rf debian/freeswitch-sysvinit.freeswitch.default /etc/default/freeswitch

七、添加SIP 48000Hz音頻程序

# tar -zxvf freeswitch-sounds-en-us-callie-48000-1.0.52.tar.gz -C /opt/software
# tar -zxvf freeswitch-sounds-music-48000-1.0.52.tar.gz -C /opt/software

# cd /opt/software
cp -r sounds/en/us/callie/ascii/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/ascii/48000
cp -r sounds/en/us/callie/base256/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/base256/48000
cp -r sounds/en/us/callie/conference/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/conference/48000
cp -r sounds/en/us/callie/currency/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/currency/48000
cp -r sounds/en/us/callie/digits/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/digits/48000
cp -r sounds/en/us/callie/directory/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/directory/48000
cp -r sounds/en/us/callie/ivr/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/ivr/48000
cp -r sounds/en/us/callie/misc/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/misc/48000
cp -r sounds/en/us/callie/phonetic-ascii/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/phonetic-ascii/48000
cp -r sounds/en/us/callie/time/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/time/48000
cp -r sounds/en/us/callie/voicemail/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/voicemail/48000
cp -r sounds/en/us/callie/zrtp/48000 /opt/freeswitch/share/freeswitch/sounds/en/us/callie/zrtp/48000
cp -r sounds/music/48000 /opt/freeswitch/share/freeswitch/sounds/music/48000

八、添加freeswitch用戶

# adduser --disabled-password --quiet --system --home /opt/freeswitch --gecos "FreeSwitch Voice Platform" --ingroup daemon freeswitch && adduser freeswitch audio
# chown -R freeswitch:daemon /opt/freeswitch && chmod -R o-rwx /opt/freeswitch
# ln -s /opt/freeswitch/bin/freeswitch /usr/bin/
# ln -s /opt/freeswitch/bin/fs_cli /usr/bin/

九、禁用freeswitch IPv6功能

# mv /opt/freeswitch/etc/freeswitch/sip_profiles/external-ipv6.xml /opt/freeswitch/etc/freeswitch/sip_profiles/external-ipv6.xml-bak
# mv /opt/freeswitch/etc/freeswitch/sip_profiles/internal-ipv6.xml /opt/freeswitch/etc/freeswitch/sip_profiles/internal-ipv6.xml-bak

十、配置ODBC連接

# cat > /etc/odbcinst.ini <<EOF
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc8a.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so
Setup64 = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1
EOF

# cat > /etc/odbc.ini <<EOF
[freeswitch]
DRIVER = MySQL
SERVER = 192.168.1.1      //mysql server ip
PORT = 3306
DATABASE = fs_core        //mysql freeswitch database
USER = freesw             //mysql freeswitch freesw database username
PASSWORD = freesw@123     //mysql freeswitch freesw database passwd
OPTION = 3
EOF

# isql -v freeswitch //mysql測試連接性

十一、啓動freeswitch

# /usr/bin/freeswitch -nc -nonat
# netstat -lntup
tcp        0      0 192.168.0.102:5080      0.0.0.0:*               LISTEN      30917/freeswitch
tcp        0      0 192.168.0.102:5060      0.0.0.0:*               LISTEN      30917/freeswitch
tcp        0      0 192.168.0.102:5066      0.0.0.0:*               LISTEN      30917/freeswitch
tcp        0      0 192.168.0.102:8081      0.0.0.0:*               LISTEN      30917/freeswitch
tcp        0      0 192.168.0.102:8082      0.0.0.0:*               LISTEN      30917/freeswitch
tcp        0      0 192.168.0.102:7443      0.0.0.0:*               LISTEN      30917/freeswitch
udp        0      0 192.168.0.102:5060      0.0.0.0:*                           30917/freeswitch
udp        0      0 192.168.0.102:5080      0.0.0.0:*                           30917/freeswitch
udp        0      0 0.0.0.0:1337            0.0.0.0:*                           30917/freeswitch

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章