From 2107ef5673b3ff31c51546158be49b2df42b87f8 Mon Sep 17 00:00:00 2001 From: Aaron Chen Date: Wed, 5 Jul 2023 14:12:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86FreeSWITCH=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/config.js | 7 +- .../ubuntu16.04安装FreeSWITCH1.6.md | 373 ++++++++++++++---- docs/freeswitch/安装freeswitch1.6.md | 307 -------------- 3 files changed, 290 insertions(+), 397 deletions(-) delete mode 100644 docs/freeswitch/安装freeswitch1.6.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 740c34b..dddd665 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -15,16 +15,17 @@ module.exports = { { title: "FreeSWITCH", children: [ - "/freeswitch/安装freeswitch1.6", + "/freeswitch/Ubuntu16.04安装FreeSWITCH1.6", "/freeswitch/Debian11安装FreeSWITCH1.10", "/freeswitch/Debian11安装FreeSWITCH1.10-参照ClueCon官方文档", "/freeswitch/Debian11安装lua和luarocks", "/freeswitch/为FreeSWITCH安装mod_unimrcp模块", "/freeswitch/FreeSWITCH对接阿里云MRCP", - "/freeswitch/freeswitch对接百度mrcp", - "/freeswitch/freeswitch配置ssl", + "/freeswitch/FreeSWITCH对接百度mrcp", + "/freeswitch/FreeSWITCH配置SSL", "/freeswitch/搭建STUN服务", "/freeswitch/恶意SIP行为IP黑名单", + "/freeswitch/Debian11中注册FreeSWITCH为系统服务", ], initialOpenGroupIndex: 0, // 可选的, 默认值是 0 sidebarDepth: 0, // 可选的, 默认值是 1 diff --git a/docs/freeswitch/ubuntu16.04安装FreeSWITCH1.6.md b/docs/freeswitch/ubuntu16.04安装FreeSWITCH1.6.md index 1f2b7c4..7d27810 100644 --- a/docs/freeswitch/ubuntu16.04安装FreeSWITCH1.6.md +++ b/docs/freeswitch/ubuntu16.04安装FreeSWITCH1.6.md @@ -1,108 +1,307 @@ -# ubuntu16.04安装FreeSWITCH1.6 +# 在ubuntu16.04系统上安装freeswitch1.6 -## 基本安装 +------ -### (可省)更换阿里源 +## 操作系统和软件版本 -```shell -vim /etc/apt/source.list +ubuntu16.04 + +freeswitch v1.6 + +python2.7 + +lua5.3 + +## 准备工作 + +### 安装系统 + +最小安装ubuntu16.04系统,安装ssh server + +### 网络等必要配置 + +根据实际网络环境和个要习惯来配置 + +- 静态IP: + +```bash +sudo vim /etc/network/interfaces ``` -```plaint -deb https://mirrors.aliyun.com/ubuntu/ xenial main -deb-src https://mirrors.aliyun.com/ubuntu/ xenial main -deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main -deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main -deb https://mirrors.aliyun.com/ubuntu/ xenial universe -deb-src https://mirrors.aliyun.com/ubuntu/ xenial universe -deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe -deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates universe -deb https://mirrors.aliyun.com/ubuntu/ xenial-security main -deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main -deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe -deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security universe +示例(根据实际情况设置,照抄大概率无效) + +```txt +auto eth0 +iface eth0 inet static +address 192.168.0.234 +netmask 255.255.255.0 +gateway 192.168.0.1 +dns-nameserver 219.148.204.66 +dns-nameserver 219.149.6.99 +dns-nameserver 114.114.114.114 ``` -### 系统更新 +- root登录: -```shell +```bash +sudo vim /etc/ssh/sshd_config +``` + +- root密码: + +```bash +sudo passwd root +``` + +- 修改更新源: + +```bash +sudo vim /etc/apt/sources.list +``` + +```txt +deb http://mirrors.aliyun.com/ubuntu/ xenial main +deb-src http://mirrors.aliyun.com/ubuntu/ xenial main + +deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main + +deb http://mirrors.aliyun.com/ubuntu/ xenial universe +deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe +deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe + +deb http://mirrors.aliyun.com/ubuntu/ xenial-security main +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main +deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe +``` + +> 在mirrors.aliyun.com里可以查看具体配置方法 + +- 更新系统 + +```bash apt update && apt upgrade -y ``` ### 安装依赖 -```shell -apt-get install -y git build-essential automake autoconf libtool g++ zlib1g-dev libjpeg-dev libncurses5-dev libsqlite3-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libspeex-dev libldns-dev libedit-dev libssl-dev pkg-config yasm lua5.2 liblua5.2-dev liblua5.2 libopus-dev libsndfile-dev libtool libpq-dev pkg-config libtiff5-dev libtiff5 libvpx-dev libvpx3 libvpx3 libopus-dev uuid-dev libsndfile-dev ffmpeg python python-dev libmpg123-dev libshout3-dev libmp3lame-dev -``` - -### 安装cmake - -> 这个过程比较消耗时间 - -```shell -cd /opt -wget https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz -tar zxvf cmake-3.25.1.tar.gz -cd cmake-3.25.1 -./bootstrap -make -make install -``` - -### 安装FreeSWITCH - -> github可能经常连不上,所以git clone这一步可以在安装依赖或者安装cmake时开新终端同步来搞,多试几次 - -```shell -cd /opt -git clone -b v1.6 https://github.com/signalwire/freeswitch.git -git clone https://github.com/signalwire/libks.git -git clone https://github.com/signalwire/signalwire-c.git -# 编译freeswitch -cd freeswitch -./bootstrap.sh -j -./configure -cd .. -# 编译安装libks -cd libks/ -cmake . -make -make install -cd .. -# 编译安装signalwire-c -cd signalwire-c -cmake . -make -make install -cp /usr/local/lib/pkgconfig/.pc /usr/lib/pkgconfig/ -cp -f /usr/local/lib/ /lib64/ -cd .. -# 安装freeswitch -cd freeswitch -make -make install -ln -s /usr/local/freeswitch/bin/* /usr/bin/ -``` - -### 安装声音 +- apt部分 ```bash -make sounds-install && \ -make moh-install && \ -make cd-sounds-install && \ -make cd-moh-install && \ -make uhd-sounds-install && \ -make uhd-moh-install +sudo apt install python-dev swig ffmpeg yasm unixodbc-dev libshout3-dev libmpg123-dev libmp3lame-dev libsndfile-dev autoconf automake devscripts libopus-dev libvorbis0a libogg0 libogg-dev libvorbis-dev gawk g++ git-core libjpeg-dev libncurses5-dev libtool-bin pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev ``` -### 安装模块 +如果需要开启mod_lua模块,还需要安装lua + +```bash +sudo apt install lua5.3 liblua5.3-dev +``` + +- pip安装 + +```bash +wget https://bootstrap.pypa.io/pip/2.7/get-pip.py +python get-pip.py +pip install pydub +pip install python-ESL +pip install pika +pip install dbutils +``` + +### 下载源码 + +```bash +git clone https://github.com/signalwire/freeswitch.git +cd freeswitch +git checkout v1.6 +git remote rm origin +``` + +> 最后一句是断开本地目录和远程代码库的关联 + +## 安装freeswitch + +- 配置lua(如果不需要mod_lua模块,可跳过) + +```bash +cp /usr/include/lua5.3/*.h src/mod/languages/mod_lua/ +``` + +```bash +sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/lib/x86_64-linux-gnu/liblua.so +``` + +- 预处理 + +```bash +sudo ./bootstrap.sh -j +``` + +- 预配置模块 ```bash -cd /opt/freeswitch vim modules.conf -# 为下面这几行解除注释 -# mod_unimrcp -# mod_shout -# mod_python -# mod_xml_curl +``` + +打开注释 + +```conf +formats/mod_shout +languages/mod_python +event_handlers/mod_cdr_pg_csv +asr_tts/mod_unimrcp +``` + +如果不需要使用lua语言模块,则将下面内容加注释 + +```conf +#languages/mod_lua +``` + +- 预编译 + +```bash +./configure --with-python=/usr/bin/python2.7 --with-lua=/usr/bin/lua5.3 --enable-core-pgsql-support +``` + +- 编译安装 + +```bash +sudo make +sudo make mod_cdr_pg_csv-install +sudo make mod_unimrcp-install +sudo make install +``` + +- 安装声音包 + +```bash +sudo make sounds-install +sudo make moh-install +sudo make cd-sounds-install +sudo make cd-moh-install +sudo make uhd-sounds-install +sudo make uhd-moh-install +``` + +- 建立软连接 + +```bash +sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/ +sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/ +``` + +- 配置mod + +```bash +vim /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml +``` + +打开注释 + +```xml + + +``` + +添加配置 + +```xml + + + +``` + +如果不需要lua支持,则注释下面内容 + +```xml + +``` + +- 配置acl白名单 + +```bash +vim /usr/local/freeswitch/conf/autoload_configs/acl.conf.xml +``` + +根据自己网络的实际情况进行配置(照抄大概率无效) + +```xml + + + + + + + + + + + + + + + + +``` + +- 配置ESL + +```bash +vim /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml +``` + +```xml + + + + + + + + + + + + + + + +``` + +- 配置VAD(可暂时省略) + +把mod_vad.so(到已经配置好的服务器上去拉)和mod_G729.so(已经有了)放到/usr/local/freeswitch/mod目录下,并给可执行权 + +```bash +chmod +x mod_vad.so +``` + +- 配置网关(可暂时省略) + +在/usr/local/freeswitch/conf/sip_profiles/external 目录下上传网关模板gw1.xml(这个模板在动态生成xml时会用到) + +手动添加网关配置(可暂时省略) + +```xml + + + + + + +``` + +## 4. 启动freeswitch + +```bash +freeswitch -nc +``` + +通过fs_cli可以进入freeswitch控制台(freeswitch服务启动需要等一段时间,而且可能会很长) + +```bash +fs_cli --password=Aicyber ``` diff --git a/docs/freeswitch/安装freeswitch1.6.md b/docs/freeswitch/安装freeswitch1.6.md deleted file mode 100644 index 7d27810..0000000 --- a/docs/freeswitch/安装freeswitch1.6.md +++ /dev/null @@ -1,307 +0,0 @@ -# 在ubuntu16.04系统上安装freeswitch1.6 - ------- - -## 操作系统和软件版本 - -ubuntu16.04 - -freeswitch v1.6 - -python2.7 - -lua5.3 - -## 准备工作 - -### 安装系统 - -最小安装ubuntu16.04系统,安装ssh server - -### 网络等必要配置 - -根据实际网络环境和个要习惯来配置 - -- 静态IP: - -```bash -sudo vim /etc/network/interfaces -``` - -示例(根据实际情况设置,照抄大概率无效) - -```txt -auto eth0 -iface eth0 inet static -address 192.168.0.234 -netmask 255.255.255.0 -gateway 192.168.0.1 -dns-nameserver 219.148.204.66 -dns-nameserver 219.149.6.99 -dns-nameserver 114.114.114.114 -``` - -- root登录: - -```bash -sudo vim /etc/ssh/sshd_config -``` - -- root密码: - -```bash -sudo passwd root -``` - -- 修改更新源: - -```bash -sudo vim /etc/apt/sources.list -``` - -```txt -deb http://mirrors.aliyun.com/ubuntu/ xenial main -deb-src http://mirrors.aliyun.com/ubuntu/ xenial main - -deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main -deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main - -deb http://mirrors.aliyun.com/ubuntu/ xenial universe -deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe -deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe -deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe - -deb http://mirrors.aliyun.com/ubuntu/ xenial-security main -deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main -deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe -deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe -``` - -> 在mirrors.aliyun.com里可以查看具体配置方法 - -- 更新系统 - -```bash -apt update && apt upgrade -y -``` - -### 安装依赖 - -- apt部分 - -```bash -sudo apt install python-dev swig ffmpeg yasm unixodbc-dev libshout3-dev libmpg123-dev libmp3lame-dev libsndfile-dev autoconf automake devscripts libopus-dev libvorbis0a libogg0 libogg-dev libvorbis-dev gawk g++ git-core libjpeg-dev libncurses5-dev libtool-bin pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev -``` - -如果需要开启mod_lua模块,还需要安装lua - -```bash -sudo apt install lua5.3 liblua5.3-dev -``` - -- pip安装 - -```bash -wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -python get-pip.py -pip install pydub -pip install python-ESL -pip install pika -pip install dbutils -``` - -### 下载源码 - -```bash -git clone https://github.com/signalwire/freeswitch.git -cd freeswitch -git checkout v1.6 -git remote rm origin -``` - -> 最后一句是断开本地目录和远程代码库的关联 - -## 安装freeswitch - -- 配置lua(如果不需要mod_lua模块,可跳过) - -```bash -cp /usr/include/lua5.3/*.h src/mod/languages/mod_lua/ -``` - -```bash -sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/lib/x86_64-linux-gnu/liblua.so -``` - -- 预处理 - -```bash -sudo ./bootstrap.sh -j -``` - -- 预配置模块 - -```bash -vim modules.conf -``` - -打开注释 - -```conf -formats/mod_shout -languages/mod_python -event_handlers/mod_cdr_pg_csv -asr_tts/mod_unimrcp -``` - -如果不需要使用lua语言模块,则将下面内容加注释 - -```conf -#languages/mod_lua -``` - -- 预编译 - -```bash -./configure --with-python=/usr/bin/python2.7 --with-lua=/usr/bin/lua5.3 --enable-core-pgsql-support -``` - -- 编译安装 - -```bash -sudo make -sudo make mod_cdr_pg_csv-install -sudo make mod_unimrcp-install -sudo make install -``` - -- 安装声音包 - -```bash -sudo make sounds-install -sudo make moh-install -sudo make cd-sounds-install -sudo make cd-moh-install -sudo make uhd-sounds-install -sudo make uhd-moh-install -``` - -- 建立软连接 - -```bash -sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/ -sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/ -``` - -- 配置mod - -```bash -vim /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml -``` - -打开注释 - -```xml - - -``` - -添加配置 - -```xml - - - -``` - -如果不需要lua支持,则注释下面内容 - -```xml - -``` - -- 配置acl白名单 - -```bash -vim /usr/local/freeswitch/conf/autoload_configs/acl.conf.xml -``` - -根据自己网络的实际情况进行配置(照抄大概率无效) - -```xml - - - - - - - - - - - - - - - - -``` - -- 配置ESL - -```bash -vim /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml -``` - -```xml - - - - - - - - - - - - - - - -``` - -- 配置VAD(可暂时省略) - -把mod_vad.so(到已经配置好的服务器上去拉)和mod_G729.so(已经有了)放到/usr/local/freeswitch/mod目录下,并给可执行权 - -```bash -chmod +x mod_vad.so -``` - -- 配置网关(可暂时省略) - -在/usr/local/freeswitch/conf/sip_profiles/external 目录下上传网关模板gw1.xml(这个模板在动态生成xml时会用到) - -手动添加网关配置(可暂时省略) - -```xml - - - - - - -``` - -## 4. 启动freeswitch - -```bash -freeswitch -nc -``` - -通过fs_cli可以进入freeswitch控制台(freeswitch服务启动需要等一段时间,而且可能会很长) - -```bash -fs_cli --password=Aicyber -```