debian11編譯安裝freeswitch


前言

  • 環境:
    • 系統版本:debian 11 x86_64
    • FreeSWITCH版本:1.10.6

安裝步驟

  1. 安裝依賴(安裝之前最好換apt軟件源為國內的)
apt install -y gnupg2 wget autoconf lsb-release libtool libtool-bin libtiff-dev uuid-dev pkg-config openssl libssl-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libspeexdsp-dev libldns-dev libedit-dev yasm nasm ffmpeg libswscale-dev libavformat-dev lua5.4 liblua5.4-dev libopus-dev libpq-dev libmariadb-dev unixodbc unixodbc-dev libsndfile1-dev
  1. 下載FreeSWITCH源碼包
git clone https://github.com/signalwire/freeswitch.git -bv1.10 freeswitch
cd freeswitch
./bootstrap.sh -j
  1. 編譯安裝spandsp
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
./bootstrap.sh -j
./configure
make
make install
ldconfig
  1. 編譯安裝sofia-sip
git clone https://github.com/freeswitch/sofia-sip.git
cd sofia-sip
./bootstrap.sh -j
./configure
make
make install
ldconfig
  1. 編譯安裝FreeSWITCH
# 預編譯
./configure --prefix=/usr/local/freeswitch
# 編譯。如果是多核處理器,比如4核,可以用make -j4,能加快編譯速度
# 編譯時可以編輯modules.conf,取消編譯mod_signalwire、mod_opus
make
make install
  1. 啟動
# 啟動服務端
/usr/local/freeswitch/bin/freeswitch -nosql -nonat -nc
# 如果有ipv6相關報錯,需要刪掉/usr/local/freeswitch/etc/freeswitch/sip_profiles目錄下名字帶ipv6的目錄和文件
# 進入控制台
/usr/local/freeswitch/bin/fs_cli

創建軟鏈接

ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/

FreeSWITCH連接MySQL

mysql版本:5.7

從版本1.10.0開始,FreeSWITCH通過mod_mariadb原生支持MySQL

  1. 編譯時修改module.conf.xml,取消mod_mariadb的注釋
  2. 編輯autoload_configs/pre_load_modules.conf,注釋掉mod_pgsql,取消mod_mariadb的注釋
<configuration name="pre_load_modules.conf" description="Modules">
  <modules>
    <!-- Databases -->
    <load module="mod_mariadb"/>
    <!-- <load module="mod_pgsql"/> -->
  </modules>
</configuration>
  1. 編輯autoload_configs/switch.conf.xml,添加下面一行內容。注意修改IP、端口、數據庫名、用戶名、用戶密碼。如果有postgresql相關的配置信息,需要注釋掉。
<param name="core-db-dsn" value="mariadb://Server=192.168.0.10;Port=3307;Database=freeswitch;Uid=root;Pwd=123456;" />
  1. 編輯sip_profile,添加下面內容,注意修改IP、端口、數據庫名、用戶名、用戶密碼。
<param name="core-db-dsn" value="mariadb://Server=192.168.0.10;Port=3307;Database=freeswitch;Uid=root;Pwd=123456;" />
  1. 測試啟動:
/usr/local/freeswitch/bin/freeswitch -nonat
# 啟動時會自動創建數據表
# 一些報錯如"Specified key was too long; max key length is 3072 bytes"、"Duplicate key name"可忽略
  1. 使用軟電話如MicroSIP注冊,查看數據表registrations中有沒有注冊信息,有的話說明FreeSWITCH已連接MySQL
  2. 在FreeSWITCH控制台執行shutdown關閉FreeSWITCH,重新啟動
/usr/local/freeswitch/bin/freeswitch -nonat -nosql -nc


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM