[TOC]
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