FreeSWITCH 安裝

語言: CN / TW / HK

[TOC]

FreeSWITCH 安裝

FreeSWITCH

FreeSWITCH 是一個電話的軟交換解決方案,包括一個軟電話和軟交換機用以提供語音和聊天的產品驅動。FreeSWITCH 可以用作交換機引擎、PBX、多媒體閘道器以及多媒體伺服器等。

版本

  • FreeSWITCH 1.10.1

環境

  • Ubuntu 18.04_64位

軟體包

  • cmake-3.13.3-Linux-x86_64.tar.gz

  • freeswitch-1.10.1.-release.tar.xz

  • freeswitch-sounds-en-us-callie-*-1.0.52.tar.gz

  • freeswitch-sounds-music-*-1.0.52.tar.gz

  • freeswitch-sounds-zh-cn-sinmei-*-1.0.51.tar.gz

    下載地址

參考指令碼

#install freeswitch 1.10.1 for ubuntu 18.04 64位
# 建立ubuntu使用者
useradd -d "/home/ubuntu" -m -s "/bin/bash" ubuntu 
passwd ubuntu
chmod u+w /etc/sudoers
vi /etc/sudoers
# ubuntu            ALL=(ALL)                ALL
chmod u-w /etc/sudoers
# 使用ubuntu
mkdir soft
# 拷貝軟體包到 soft
# ...
# 安裝依賴模組
sudo apt-get update
sudo apt-get install -y autoconf 
sudo apt-get install -y git 
sudo apt-get install -y libtool 
sudo apt-get install -y g++ 
sudo apt-get install -y zlib1g-dev 
sudo apt-get install -y libjpeg-dev 
sudo apt-get install -y libsqlite3-dev  
sudo apt-get install -y libcurl4-openssl-dev 
sudo apt-get install -y libpcre3-dev 
sudo apt-get install -y libspeex-dev 
sudo apt-get install -y libspeexdsp-dev  
sudo apt-get install -y libldns-dev 
sudo apt-get install -y libedit-dev 
sudo apt-get install -y libssl-dev  
sudo apt-get install -y pkg-config 
sudo apt-get install -y yasm 
sudo apt-get install -y liblua5.2-dev 
sudo apt-get install -y libopus-dev 
sudo apt-get install -y libsndfile-dev 
sudo apt-get install -y libpq-dev 
sudo apt-get install -y uuid-dev
sudo apt-get install libtiff-dev
sudo apt-get install libavformat-dev
sudo apt-get install libswscale-dev
# 建立連結
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0 /usr/lib/x86_64-linux-gnu/liblua.so
sudo mv /usr/include/lua5.2/lua* /usr/include/
sudo mv /usr/include/opus/opus* /usr/include/
sudo mv /usr/lib/x86_64-linux-gnu/libsndfile* /usr/lib/
sudo ldconfig -v
# 解壓並建立連結cmake
tar xf cmake-3.13.3-Linux-x86_64.tar.gz
sudo ln -sf /home/ubuntu/soft/cmake-3.13.3-Linux-x86_64/bin/cmake /usr/local/bin/
# 下載並編譯libks
git clone https://github.com/signalwire/libks.git
cd libks
sudo cmake .
sudo make
sudo make install
cd ..
# 下載並編譯signalwire-c
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c/
sudo cmake .
sudo make
sudo make install
cd ..
# 解壓並編譯freeswitch
tar -xf freeswitch-1.10.1.-release.tar.xz
mv freeswitch-sounds-* freeswitch-1.10.1.-release/
cd freeswitch-1.10.1.-release/
# 編輯 modules.conf
sudo ./configure
sudo make -j 4
sudo make install
sudo make cd-sounds-install
sudo make cd-moh-install
# 建立連結
sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
# 啟動和關閉
sudo freeswitch -nc
sudo freeswitch -stop

#測試撥打以下號碼
#號碼          說明
#------------- --------
#9664          保持音樂
#9196          echo,迴音測試
#9195          echo,迴音測試,延遲5秒
#9197          噪音生成
#9198          鈴音生成示例
#9180          鈴音測試,生成的回鈴音
#9181          鈴音測試,產生英式鈴音
#9183          先應答,然後傳送英式鈴音
#9184          先應答,然後傳送音樂鈴音
#5000          示例IVR
#4000          聽取語音信箱

# G729轉碼
cd src/mod/endpoints 
# 下載bcg729的原始碼
git clone https://github.com/xadhoom/mod_bcg729.git
mv mod_bcg729 mod_g729
# 編譯mod_g729  
cd mod_g729
vim Makefile
# FS_INCLUDES=/usr/local/freeswitch/include/freeswitch
# FS_MODULES=/usr/local/freeswitch/mod
sudo make
sudo cp -pr mod_bcg729.so /usr/local/freeswitch/mod
sudo vim /usr/local/freeswitch/conf/vars.xml
# <X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA,G729,OPUS,G722"/>
# <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,VP8,G729,OPUS,G722"/>
# ...
# <X-PRE-PROCESScmd="set"data="media_mix_inbound_outbound_codecs=true"/>

sudo vim /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
# <!--<load module="mod_g729"/>-->
# <load module="mod_bcg729"/>

# 重啟freeswitch 或者 載入模組 load mod_bcg729