從零構建實時通信引擎:Freeswitch源碼編譯與深度優化指南

在這里插入圖片描述

  • 一、構建工具:編譯FreeSWITCH及其依賴庫的基礎
    • 1. CMake
    • 2. Autoconf
  • 二、匯編器:提升音視頻處理性能
    • 3. YASM / NASM
  • 三、音視頻編解碼器:支撐實時媒體傳輸
    • 4. Opus
    • 5. x264 (可選)
    • 6. libvpx / libvpx2 (可選)
  • 四、多媒體框架與工具庫:處理音視頻流的核心
    • 7. FFmpeg / libav(可選)
    • 8. PortAudio (可選)
    • 9. SDL2(Simple DirectMedia Layer)
  • 五、其他關鍵庫
    • 10. libks
  • 綜上
  • 六、FreeSwitch的編譯準備和安裝
    • 11.Spandsp(可選)
    • 12.Sofia-sip
    • 12.freeswitch
  • 七、服務的啟動和訪問
    • 前臺
    • 后臺
    • 訪問命令行

測試安裝基礎環境:

  • CentOS 7.9
  • Freeswitch 1.10.12
  • gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
  • cmake version 3.29.8
  • autoconf (GNU Autoconf) 2.71

首先需要明確:FreeSWITCH是一款開源的實時通信服務器,支持語音、視頻通話、即時消息等功能,依賴大量音視頻處理、跨平臺編譯、媒體I/O等工具和庫

額外在源碼構建Freeswitch之前,由于需要使用諸多音視頻處理、編解碼等方面的組件,因此需要引入一些依賴包,默認系統中可能不帶有或者版本較低需要升級,最好依次確認。

如果不需要會議能力,視頻相關依賴可自行省略。

一、構建工具:編譯FreeSWITCH及其依賴庫的基礎

1. CMake
  • 基本功能:跨平臺的構建系統生成器,可根據目標平臺(如Linux、Windows)生成Makefile、Visual Studio項目等構建腳本,簡化跨平臺編譯流程。
  • 在FreeSWITCH中的作用:FreeSWITCH支持多平臺部署,CMake用于解析其源碼中的編譯規則,生成適配當前系統的構建文件,確保源碼能在不同操作系統中正確編譯。

如果發現沒有cmake或版本較低,可以通過yum的方式來安裝或升級

yum install cmake
yum update cmake
2. Autoconf
  • 基本功能:生成跨平臺的配置腳本(configure),通過檢測系統環境(如依賴庫是否存在、編譯器特性)自動調整編譯參數,是傳統Unix/Linux下的經典構建工具(常與Automake配合使用)。
  • 在FreeSWITCH中的作用:部分FreeSWITCH依賴庫(如老舊版本的音視頻庫)可能使用Autoconf生成配置腳本,FreeSWITCH在編譯這些依賴時,通過configure腳本適配系統環境,確保依賴庫正確安裝。
wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.71.tar.gz
tar xzvf autoconf-2.71.tar.gz
cd autoconf-2.71
./configure 
make
make install
----
autoconf -V
autoconf (GNU Autoconf) 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>, <https://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.Written by David J. MacKenzie and Akim Demaille.

二、匯編器:提升音視頻處理性能

3. YASM / NASM
  • 基本功能:x86/x64架構的匯編器,將匯編語言代碼轉換為機器碼。音視頻處理對性能要求極高,很多庫會用匯編編寫核心優化代碼(如循環、數學運算),比C語言更高效。
  • 在FreeSWITCH中的作用:FreeSWITCH依賴的音視頻庫(如FFmpeg、x264、libvpx)包含大量匯編優化代碼(如針對CPU指令集的優化),YASM/NASM用于編譯這些匯編代碼,提升音視頻編解碼、格式轉換的效率。

yasm:

$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
--2025-07-17 10:00:23--  http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
正在解析主機 www.tortall.net (www.tortall.net)... 69.55.235.23
正在連接 www.tortall.net (www.tortall.net)|69.55.235.23|:80... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:1492156 (1.4M) [application/octet-stream]
正在保存至: “yasm-1.3.0.tar.gz”100%[==================================================================================================================================================================>] 1,492,156   46.2KB/s 用時 25s    2025-07-17 10:00:59 (58.6 KB/s) - 已保存 “yasm-1.3.0.tar.gz” [1492156/1492156])
$ tar -xvf yasm-1.3.0.tar.gz
yasm-1.3.0/
yasm-1.3.0/libyasm/
yasm-1.3.0/libyasm/cmake-module.c
yasm-1.3.0/libyasm/bitvect.h
yasm-1.3.0/libyasm/section.h
yasm-1.3.0/libyasm/mergesort.c
yasm-1.3.0/libyasm/strcasecmp.c
yasm-1.3.0/libyasm/value.c
……
$ cd yasm-1.3.0
$ ./configurechecking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
……
$ make && make install
gcc -std=gnu99  -I.  \-c -o genperf.o `test -f tools/genperf/genperf.c || echo './'`tools/genperf/genperf.c
gcc -std=gnu99  -I.  \-c -o gp-perfect.o `test -f tools/genperf/perfect.c || echo './'`tools/genperf/perfect.c
gcc -std=gnu99  -I.  \-c -o gp-phash.o `test -f libyasm/phash.c || echo './'`libyasm/phash.c
gcc -std=gnu99  -I.  \-c -o gp-xmalloc.o `test -f libyasm/xmalloc.c || echo './'`libyasm/xmalloc.c
……
yasm --version
yasm 1.3.0
Compiled on Jul 17 2025.
Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.
Run yasm --license for licensing overview and summary.

nasm:

$ wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
--2025-07-17 10:01:06--  https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
正在解析主機 www.nasm.us (www.nasm.us)... 198.137.202.136, 2607:7c80:54:3::136
正在連接 www.nasm.us (www.nasm.us)|198.137.202.136|:443... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:1248463 (1.2M) [application/gzip]
正在保存至: “nasm-2.14.tar.gz”100%[==================================================================================================================================================================>] 1,248,463   56.0KB/s 用時 16s    2025-07-17 10:01:32 (77.7 KB/s) - 已保存 “nasm-2.14.tar.gz” [1248463/1248463])
$ tar -zxvf nasm-2.14.tar.gznasm-2.14/
nasm-2.14/AUTHORS
nasm-2.14/TODO
nasm-2.14/headers/
nasm-2.14/headers/c
nasm-2.14/headers/mac
nasm-2.14/headers/perl
nasm-2.14/headers/doc
nasm-2.14/test/
nasm-2.14/test/objtest.asm
nasm-2.14/test/float8.asm
nasm-2.14/test/avx512cd.asm
nasm-2.14/test/br890790_i.asm
……
$ cd nasm-2.14
$ ./configure
checking for prefix by checking for nasm... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
……
$ make && make install
[1] 6452
perl -I./perllib -I. tools/mkdep.pl -M Makefile.in -- . include config x86 rdoff stdlib nasmlib output asm disasm x86 common macros
perl -I./perllib -I. tools/mkdep.pl -M Makefile.in -- . include config x86 rdoff stdlib nasmlib output asm disasm x86 common macros
gcc -std=gnu99 -c  -g -O3 -fwrapv -U__STRICT_ANSI__ -fno-common -Werror=attributes -fvisibility=hidden -W -Wall -pedantic -Wno-long-long -Werror=implicit -Werror=missing-braces -Werror=return-type -Werror=trigraphs -Werror=pointer-arith -Werror=missing-prototypes -Werror=missing-declarations -Werror=comment -Werror=vla -fgnu89-inline -DHAVE_CONFIG_H -I. -I. -I./include -I./include -I./x86 -I./x86 -I./asm -I./asm -I./disasm -I./disasm -I./output -I./output -o asm/nasm.o asm/nasm.c
gcc -std=gnu99 -c  -g -O3 -fwrapv -U__STRICT_ANSI__ -fno-common -Werror=attributes -fvisibility=hidden -W -Wall -pedantic -Wno-long-long -Werror=implicit -Werror=missing-braces -Werror=return-type -Werror=trigraphs -Werror=pointer-arith -Werror=missing-prototypes -Werror=missing-declarations -Werror=comment -Werror=vla -fgnu89-inline -DHAVE_CONFIG_H -I. -I. -I./include -I./include -I./x86 -I./x86 -I./asm -I./asm -I./disasm -I./disasm -I./output -I./output -o asm/nasm.o asm/nasm.c
……
nasm --version
NASM version 2.14 compiled on Jul 17 2025

三、音視頻編解碼器:支撐實時媒體傳輸

4. Opus
  • 基本功能:開源的高性能音頻編解碼器,支持語音(窄帶/寬帶)和音樂,低延遲(20-50ms)、高壓縮率,是實時通信(如VOIP、WebRTC)的首選音頻編碼。
  • 在FreeSWITCH中的作用:作為核心音頻編碼之一,FreeSWITCH用Opus處理實時語音流的壓縮和解壓縮,確保語音通話的低延遲和高質量(尤其在網絡帶寬有限時)。
$ wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
--2025-07-17 10:08:02--  https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
正在解析主機 archive.mozilla.org (archive.mozilla.org)... 199.232.151.19, 2a04:4e42:1a::787
正在連接 archive.mozilla.org (archive.mozilla.org)|199.232.151.19|:443... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:1040054 (1016K) [application/x-tar]
正在保存至: “opus-1.3.1.tar.gz”100%[==================================================================================================================================================================>] 1,040,054   20.0KB/s 用時 42s    2025-07-17 10:08:55 (24.1 KB/s) - 已保存 “opus-1.3.1.tar.gz” [1040054/1040054])
$ tar -zxvf opus-1.3.1.tar.gz 
opus-1.3.1/
opus-1.3.1/COPYING
opus-1.3.1/README
opus-1.3.1/config.h.cmake.in
opus-1.3.1/config.guess
opus-1.3.1/NEWS
opus-1.3.1/ltmain.sh
opus-1.3.1/install-sh
……
$ ./configure 
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
……
configure:
------------------------------------------------------------------------opus 1.3.1:  Automatic configuration OK.Compiler support:C99 var arrays: ................ yesC99 lrintf: .................... yesUse alloca: .................... no (using var arrays)General configuration:Floating point support: ........ yesFast float approximations: ..... noFixed point debugging: ......... noInline Assembly Optimizations: . No inline ASM for your platform, please send patchesExternal Assembly Optimizations: Intrinsics Optimizations: ...... x86 SSE SSE2 SSE4.1 AVXRun-time CPU detection: ........ x86 SSE4.1 AVXCustom modes: .................. noAssertion checking: ............ noHardening: ..................... yesFuzzing: ....................... noCheck ASM: ..................... noAPI documentation: ............. yesExtra programs: ................ yes
------------------------------------------------------------------------Type "make; make install" to compile and installType "make check" to run the test suite
$ make; make install
make  install-recursive
make[1]: 進入目錄“/data/software/freeswitch/opus”
……
libtool: finish: PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/bin:/usr/lib64:/usr/local/go/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:/usr/local/libIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:- add LIBDIR to the 'LD_LIBRARY_PATH' environment variableduring execution- add LIBDIR to the 'LD_RUN_PATH' environment variableduring linking- use the '-Wl,-rpath -Wl,LIBDIR' linker flag- have your system administrator add LIBDIR to '/etc/ld.so.conf'See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: 進入目錄“/data/software/freeswitch/opus/doc”
make[5]: 進入目錄“/data/software/freeswitch/opus/doc”
make[5]: 對“install-exec-am”無需做任何事。
make[5]: 對“install-data-am”無需做任何事。
make[5]: 離開目錄“/data/software/freeswitch/opus/doc”
make[4]: 離開目錄“/data/software/freeswitch/opus/doc”/usr/bin/mkdir -p '/usr/local/share/aclocal'/usr/bin/install -c -m 644 opus.m4 '/usr/local/share/aclocal'/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'/usr/bin/install -c -m 644 opus.pc '/usr/local/lib/pkgconfig'/usr/bin/mkdir -p '/usr/local/include/opus'/usr/bin/install -c -m 644 include/opus.h include/opus_multistream.h include/opus_types.h include/opus_defines.h include/opus_projection.h '/usr/local/include/opus'
make[3]: 離開目錄“/data/software/freeswitch/opus”
make[2]: 離開目錄“/data/software/freeswitch/opus”
make[1]: 離開目錄“/data/software/freeswitch/opus”
cp /usr/local/lib/pkgconfig/opus.*   /usr/lib64/pkgconfig/
# 安裝libsndfile-devel
yum install libsndfile-devel
5. x264 (可選)
  • 基本功能:開源的H.264視頻編碼器,支持將原始視頻流壓縮為H.264格式(目前應用最廣泛的視頻編碼標準之一),平衡壓縮效率和畫質。
  • 在FreeSWITCH中的作用:若FreeSWITCH啟用視頻通話功能,x264用于將原始視頻流編碼為H.264格式(或解碼H.264流),實現高效的視頻傳輸(H.264在同等畫質下帶寬占用更低)。

如果需要使用會議視頻等功能,是需要進行安裝的。

wget https://codeload.github.com/ShiftMediaProject/x264/zip/refs/heads/master
unzip x264-master.zip
cd x264-master
./configure --prefix=/usr/local --enable-shared
make
make install#查看是否安裝成功
x264 --version
6. libvpx / libvpx2 (可選)
  • 基本功能:Google開源的視頻編解碼庫,支持VP8(早期WebRTC默認視頻編碼)和VP9(新一代開源視頻編碼,壓縮效率高于H.264)。
  • 在FreeSWITCH中的作用:補充H.264的視頻編碼支持,FreeSWITCH通過libvpx處理VP8/VP9格式的視頻流(如WebRTC場景中常見的VP8編碼),實現跨平臺視頻互通(尤其與開源客戶端兼容)。
    注:libvpx2通常指libvpx的更新版本或特定分支。

同樣是為了支持視頻的需求,準備的解碼包,如果你的倉庫包比較新可以直接yum安裝,但是這邊centos7.9自帶的版本還是比較老舊,可以考慮源碼安裝

yum install libvpx
or
wget https://files.freeswitch.org/downloads/libs/libvpx2-2.0.0.tar.gz
tar -zxvf libvpx2-2.0.0.tar.gz
cd libvpx2-2.0.0
./configure
make
make install

四、多媒體框架與工具庫:處理音視頻流的核心

7. FFmpeg / libav(可選)
  • 基本功能:FFmpeg是一套完整的多媒體處理框架,包含音視頻編解碼(libavcodec)、格式轉換(libavformat)、流媒體處理(libavfilter)等模塊,支持幾乎所有音視頻格式;libav是FFmpeg的衍生項目,功能類似。
  • 在FreeSWITCH中的作用:作為“媒體處理引擎”,FreeSWITCH依賴FFmpeg/libav實現復雜的音視頻處理任務,例如:
    • 將不同編碼的音頻(如G.711、G.729)轉碼為Opus(FreeSWITCH常用編碼);
    • 處理音視頻流的格式封裝(如將RTP流轉換為MP4文件存儲);
    • 解析或生成多種媒體容器格式(如RTSP、WebRTC的RTP/RTCP)。

ffmpeg:

ffmpeg是一個歷史比價悠久的工具包了,在早期各種音視頻工具編解碼、轉碼上,都不少利用了這個底層組件。

$ wget https://ffmpeg.org/releases/ffmpeg-5.1.tar.gz
--2025-07-16 17:53:31--  https://ffmpeg.org/releases/ffmpeg-5.1.tar.gz
正在解析主機 ffmpeg.org (ffmpeg.org)... 79.124.17.100
正在連接 ffmpeg.org (ffmpeg.org)|79.124.17.100|:443... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:15070588 (14M) [application/x-gzip]
正在保存至: “ffmpeg-5.1.tar.gz”100%[==================================================================================================================================================================>] 15,070,588  1.75MB/s 用時 8.4s   2025-07-16 17:53:51 (1.71 MB/s) - 已保存 “ffmpeg-5.1.tar.gz” [15070588/15070588])
$ tar xzvf ffmpeg-5.1.tar.gz
ffmpeg-5.1/
ffmpeg-5.1/Makefile
ffmpeg-5.1/libavcodec/
ffmpeg-5.1/libavcodec/roqvideo.h
ffmpeg-5.1/libavcodec/txd.c
ffmpeg-5.1/libavcodec/h264dsp_template.c
ffmpeg-5.1/libavcodec/v4l2_context.c
……
$ cd ffmpeg-5.1
./configure --enable-shared --enable-libx264 --enable-gpl --enable-sdl2 --enable-pic # 根據需求來配置,對于視頻不需要的,可不開啟libx264
$ make -j$(nproc) 
GEN	libavutil/libavutil.version
GEN	libswscale/libswscale.version
GEN	libswresample/libswresample.version
GEN	libpostproc/libpostproc.version
GEN	libavcodec/libavcodec.version
GEN	libavformat/libavformat.version
GEN	libavfilter/libavfilter.version
GEN	libavdevice/libavdevice.version
……
LD	ffmpeg_g
LD	ffprobe_g
LD	ffplay_g
STRIP	ffplay
STRIP	ffprobe
STRIP	ffmpeg
$ make install
INSTALL	libavdevice/libavdevice.a
INSTALL	libavdevice/libavdevice.so
STRIP	install-libavdevice-shared
INSTALL	libavfilter/libavfilter.a
INSTALL	libavfilter/libavfilter.so
STRIP	install-libavfilter-shared
……
INSTALL	libavutil/film_grain_params.h
INSTALL	libavutil/avconfig.h
INSTALL	libavutil/ffversion.h
INSTALL	libavutil/libavutil.pc
$ ffmpeg -version
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developersbuilt with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)configuration: --enable-shared --enable-gpl --enable-sdl2 --enable-piclibavutil      57. 28.100 / 57. 28.100libavcodec     59. 37.100 / 59. 37.100libavformat    59. 27.100 / 59. 27.100libavdevice    59.  7.100 / 59.  7.100libavfilter     8. 44.100 /  8. 44.100libswscale      6.  7.100 /  6.  7.100libswresample   4.  7.100 /  4.  7.100libpostproc    56.  6.100 / 56.  6.100

libav(可選):

同樣對于默認版本較低的情況,可自行手動安裝高等級版本,由于與ffmpeg功能類似,也不一定需要冗余安裝,多數場景下建議直接使用 FFmpeg,兼容性更佳且維護活躍。

CentOS 官方倉庫僅提供 FFmpeg(ffmpeg 包),而非 libav。若需安裝 libav,需通過第三方源(如 Nux Dextop)

sudo yum install epel-release
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum install libav-tools
8. PortAudio (可選)
  • 基本功能:跨平臺的音頻I/O庫,提供統一的API訪問操作系統的音頻設備(如麥克風、揚聲器),支持Windows、Linux、macOS等系統。
  • 在FreeSWITCH中的作用:FreeSWITCH在需要直接與本地音頻硬件交互的場景中使用PortAudio,例如:
    • 調試時播放/錄制通話音頻(如測試語音質量);
    • 軟電話功能(如FreeSWITCH客戶端模塊)中采集麥克風輸入或輸出到揚聲器。

如果需要使用軟電話功能,或是支持手動的錄音和放音等功能,可引入PortAudio,官方直達:http://www.portaudio.com/

$ tar -zxvf pa_stable_v190700_20210406.tgz
$ cd portaudio
$ ./configure
$ make
$ make install
9. SDL2(Simple DirectMedia Layer)
  • 基本功能:跨平臺多媒體開發庫,封裝了音頻、視頻、輸入設備(如鼠標、鍵盤)的底層接口,簡化多媒體應用開發。
  • 在FreeSWITCH中的作用:主要用于測試或客戶端場景,例如:
    • 調試視頻通話時顯示實時視頻流(通過SDL2的窗口渲染功能);
    • 輔助開發基于FreeSWITCH的輕量客戶端(如簡單的音視頻通話測試工具)。服務器端部署時通常不依賴SDL2。
$ wget https://www.libsdl.org/release/SDL2-2.0.22.tar.gz
--2025-07-16 17:56:03--  https://www.libsdl.org/release/SDL2-2.0.22.tar.gz
正在解析主機 www.libsdl.org (www.libsdl.org)... 192.241.223.99, 2604:a880:1:20::181:e001
正在連接 www.libsdl.org (www.libsdl.org)|192.241.223.99|:443... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:7250633 (6.9M) [application/x-gzip]
正在保存至: “SDL2-2.0.22.tar.gz”100%[==================================================================================================================================================================>] 7,250,633    227KB/s 用時 35s    2025-07-16 17:56:49 (201 KB/s) - 已保存 “SDL2-2.0.22.tar.gz” [7250633/7250633])
#安裝依賴
$ yum -y install libX11-devel libXext-devel libXv-devel
$ tar -zxvf SDL2-2.0.22.tar.gz
SDL2-2.0.22/
SDL2-2.0.22/WhatsNew.txt
SDL2-2.0.22/Xcode/
SDL2-2.0.22/android-project/
SDL2-2.0.22/VisualC-WinRT/
SDL2-2.0.22/configure.ac
SDL2-2.0.22/Android.mk
SDL2-2.0.22/wayland-protocols/
……
$ cd SDL2-2.0.22/
$ ./configure 
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name...
……
SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic hidapi sensor power filesystem threads timers file misc locale loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss alsa(dynamic) pulse(dynamic)
Video drivers   : dummy opengl_es2 vulkan
Input drivers   : linuxev linuxkd
Enable virtual joystick APIs : YES
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO
$ make
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs build
mkdir -p -- build
touch build/.createdCC     build/SDL.loCC     build/SDL_assert.loCC     build/SDL_dataqueue.lo
……  
$ make install
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs /usr/local/bin
/usr/bin/install -c -m 755 sdl2-config /usr/local/bin/sdl2-config
/bin/sh build-scripts/mkinstalldirs /usr/local/include/SDL2
……
/bin/sh build-scripts/mkinstalldirs /usr/local/lib/pkgconfig
/usr/bin/install -c -m 644 sdl2.pc /usr/local/lib/pkgconfig
/bin/sh build-scripts/mkinstalldirs /usr/local/lib/cmake/SDL2
mkdir -p -- /usr/local/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config.cmake /usr/local/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config-version.cmake /usr/local/lib/cmake/SDL2
$ ldconfig
$ pkg-config --modversion sdl2
2.0.22

五、其他關鍵庫

10. libks
  • 基本功能:是一個開源的輕量級 C 語言基礎庫,主要服務于實時通信和信號處理領域,尤其在多媒體通信系統(如 FreeSWITCH)中扮演核心支撐角色。其設計聚焦于跨平臺兼容性和高效性,為上層應用提供底層基礎功能模塊
  • 與FreeSWITCH的關聯
    • 作為 FreeSWITCH 的底層庫,提供線程調度、內存管理、網絡 I/O 等基礎功能,支撐 VoIP 媒體服務器的穩定運行。
$ yum -y install libatomic
$ wget https://files.freeswitch.org/downloads/libs/libks-2%202.0.2.tar.gz
$ tar –zxvf libks-2.2.0.2.tar.gz
$ cd libks-2.2.0.2
$ cmake .
$ make
$ make install

綜上

FreeSWITCH的核心功能是“實時媒體流傳輸與呼叫控制”,這些組件從編譯構建媒體處理再到功能擴展形成完整支撐:

  • 編譯階段:CMake/Autoconf處理跨平臺配置,YASM/NASM編譯匯編優化代碼,確保源碼和依賴庫能在目標系統運行;
  • 媒體編解碼:Opus(音頻)、x264/libvpx(視頻)提供高效的實時編解碼能力,是通話質量的基礎;
  • 媒體處理:FFmpeg/libav負責音視頻轉碼、格式轉換等核心任務,PortAudio/SDL2輔助硬件交互和調試;
  • 安全與兼容:libks 提供線程調度、內存管理、網絡 I/O 等基礎功能,支撐 VoIP 媒體服務器的穩定運行。

六、FreeSwitch的編譯準備和安裝

11.Spandsp(可選)
  • 基本功能:Spandsp 是一個為軟件定義的電信應用提供支持的庫,它實現了多種電信相關的功能,包括傳真(T.38)、調制解調器、文本電話等協議的支持。Spandsp 被廣泛用于需要處理傳真傳輸或傳統電話網絡(PSTN)集成的應用中
  • 與freeswitch的關聯:如果你計劃在你的 FreeSWITCH 實例中啟用傳真功能,那么你可能需要安裝并配置 Spandsp。
# 后續遷移至freeswitch安裝目錄下
$ git clone https://github.com/freeswitch/spandsp.git
$ cd spandsp
$ ./bootstrap.sh -j
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
libtoolize: copying file `config/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:48: installing 'config/config.guess'
configure.ac:48: installing 'config/config.sub'
configure.ac:46: installing 'config/install-sh'
configure.ac:46: installing 'config/missing'
Makefile.am: installing './INSTALL'
spandsp-sim/Makefile.am: installing 'config/depcomp'
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
$ make
Making all in src
make[1]: 進入目錄“/data/software/freeswitch/spandsp/src”
make  all-am
make[2]: 進入目錄“/data/software/freeswitch/spandsp/src”
$ make install
Making install in src
make[1]: 進入目錄“/data/software/freeswitch/spandsp/src”
……
----------------------------------------------------------------------
Libraries have been installed in:/usr/local/libIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:- add LIBDIR to the `LD_LIBRARY_PATH' environment variableduring execution- add LIBDIR to the `LD_RUN_PATH' environment variableduring linking- use the `-Wl,-rpath -Wl,LIBDIR' linker flag- have your system administrator add LIBDIR to `/etc/ld.so.conf'……
make[2]: 進入目錄“/data/software/freeswitch/spandsp”
make[2]: 對“install-exec-am”無需做任何事。/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'/usr/bin/install -c -m 644 spandsp.pc '/usr/local/lib/pkgconfig'
make[2]: 離開目錄“/data/software/freeswitch/spandsp”
make[1]: 離開目錄“/data/software/freeswitch/spandsp”

根據install后的提示,追加pkgconfig路徑:

vi ~/.bashrc
#文末追加
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
source ~/.bashrc
12.Sofia-sip
  • 基本功能:Sofia-sip 是一個用于 SIP(Session Initiation Protocol)協議棧的開源庫,提供了構建基于 SIP 的應用所需的基本功能。SIP 是一種信令協議,用于控制多媒體通信會話的發起、修改和終止,常用于 VoIP 電話。Sofia-sip 庫可以用來創建支持 SIP 的客戶端或服務器端應用程序,如 IP 電話、即時通訊工具等。
  • 與freeswitch的關聯:Sofia-sip 是 FreeSWITCH 中處理 SIP 信令的核心組件之一。FreeSWITCH 使用 Sofia-sip 來管理 SIP 會話,這意味著 Sofia-sip 對于支持基本的 VoIP 功能至關重要。FreeSWITCH 中名為 sofia 的模塊就是基于 Sofia-sip 開發的,負責處理所有 SIP 相關的操作,比如注冊、呼叫建立等
# 后續遷移至freeswitch安裝目錄下
$ git clone https://github.com/freeswitch/sofia-sip.git
$ cd sofia-sip/./bootstrap.sh 
+ AUTOMAKE=automake
+ ACLOCAL=aclocal
+ export AUTOMAKE ACLOCAL
+ autoreconf -i
……
parallel-tests: installing './test-driver'
+ find . '(' -name 'run*' -o -name '*.sh' ')' -a -type f
+ xargs chmod +x
+ chmod +x scripts/coverage scripts/fix-include-sofia-sip scripts/hide_emails.sh scripts/lcov-report scripts/rpmbuild-snaphot scripts/uncovered
$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking cached information... ok
checking for a BSD-compatible install... /usr/bin/install -c
……
$ make
make[1]: 進入目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua”
Making built-sources in su
make[2]: 進入目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su”
gawk -f ../../libsofia-sip-ua/su/tag_dll.awk NODLL=1  REF=su_tag_ref.c su_tag.c
make[2]: 離開目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su”
……
make[2]: 進入目錄“/data/software/freeswitch/sofia-sip/utils”COMPILE sip-options.oLINK sip-optionsCOMPILE sip-date.oLINK sip-dateCOMPILE sip-dig.oLINK sip-dig
make[2]: 離開目錄“/data/software/freeswitch/sofia-sip/utils”
make[2]: 進入目錄“/data/software/freeswitch/sofia-sip”
make[2]: 離開目錄“/data/software/freeswitch/sofia-sip”
make[1]: 離開目錄“/data/software/freeswitch/sofia-sip”
$ make install
Making install in libsofia-sip-ua
make[1]: 進入目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua”
Making install in su
make[2]: 進入目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su”
make  install-am
make[3]: 進入目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su”
make[4]: 進入目錄“/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su”
……
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/bin:/usr/lib64:/usr/local/go/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:/usr/local/libIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:- add LIBDIR to the `LD_LIBRARY_PATH' environment variableduring execution- add LIBDIR to the `LD_RUN_PATH' environment variableduring linking- use the `-Wl,-rpath -Wl,LIBDIR' linker flag- have your system administrator add LIBDIR to `/etc/ld.so.conf'See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
……
make[2]: 進入目錄“/data/software/freeswitch/sofia-sip/utils”/usr/bin/mkdir -p '/usr/local/bin'/bin/sh ../libtool   --mode=install /usr/bin/install -c sip-options sip-date sip-dig '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/sip-options /usr/local/bin/sip-options
libtool: install: /usr/bin/install -c .libs/sip-date /usr/local/bin/sip-date
libtool: install: /usr/bin/install -c .libs/sip-dig /usr/local/bin/sip-dig
make[2]: 對“install-data-am”無需做任何事。
make[2]: 離開目錄“/data/software/freeswitch/sofia-sip/utils”
make[1]: 離開目錄“/data/software/freeswitch/sofia-sip/utils”
make[1]: 進入目錄“/data/software/freeswitch/sofia-sip”
make[2]: 進入目錄“/data/software/freeswitch/sofia-sip”
make[2]: 對“install-exec-am”無需做任何事。
make[2]: 對“install-data-am”無需做任何事。
make[2]: 離開目錄“/data/software/freeswitch/sofia-sip”
make[1]: 離開目錄“/data/software/freeswitch/sofia-sip”
12.freeswitch

安裝包可以提供github等多種途徑獲得

解壓安裝包:

$ tar -zxvf freeswitch-1.10.12.tar.gz 
freeswitch-1.10.12/
freeswitch-1.10.12/.clang-format
freeswitch-1.10.12/.drone.yml
freeswitch-1.10.12/.gitattributes
freeswitch-1.10.12/.gitconfig
freeswitch-1.10.12/.github/
……
$ ./bootstrap.sh -j

初始化完畢后,目錄下會生成 module.conf 文件,即需要引入編譯的模塊,需要自行判斷是否需要視頻、是否需要額外數據庫、是否需要http交互等,建議自行對每個模塊的功能有基礎的了解。需要額外引入的模塊,例如PG數據庫、Redis等,都需要Linux服務器上安裝必要的依賴包,比如libpq\hiredis等。初期使用,可以就依賴默認的sqlite做數據存儲,文件做基礎交互。

源碼安裝就是更能夠使用開發的需求,可以自選模塊進行編譯,更為靈活。

為了快速編譯啟動體驗,以下模塊可以做出修改:

  1. 注釋 applications/mod_signalwire: 暫不需要支持通過 SignalWire 的 API 和 SIP 中繼實現語音、短信、視頻等通信功能
  2. 注釋 applications/mod_verto: 暫不需要支持 WebRTC 的瀏覽器端實時音視頻通信能力,支持 JavaScript API

以下開始編譯構建:

$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
……-------------------------- FreeSWITCH configuration --------------------------Locations:prefix:          /usr/local/freeswitchexec_prefix:     /usr/local/freeswitchbindir:          ${exec_prefix}/binconfdir:         /usr/local/freeswitch/conflibdir:          ${exec_prefix}/libdatadir:         /usr/local/freeswitchlocalstatedir:   /usr/local/freeswitchincludedir:      /usr/local/freeswitch/include/freeswitchcertsdir:        /usr/local/freeswitch/certsdbdir:           /usr/local/freeswitch/dbgrammardir:      /usr/local/freeswitch/grammarhtdocsdir:       /usr/local/freeswitch/htdocsfontsdir:        /usr/local/freeswitch/fontslogfiledir:      /usr/local/freeswitch/logmodulesdir:      /usr/local/freeswitch/modpkgconfigdir:    ${exec_prefix}/lib/pkgconfigrecordingsdir:   /usr/local/freeswitch/recordingsimagesdir:       /usr/local/freeswitch/imagesruntimedir:      /usr/local/freeswitch/runscriptdir:       /usr/local/freeswitch/scriptssoundsdir:       /usr/local/freeswitch/soundsstoragedir:      /usr/local/freeswitch/storagecachedir:        /usr/local/freeswitch/cache------------------------------------------------------------------------------
$ make
gcc -std=gnu11 -o /data/software/freeswitch/freeswitch/build/print_git_revision /data/software/freeswitch/freeswitch/build/print_git_revision.c
cd libs/libvpx && CC="gcc -std=gnu11" CXX="g++" CFLAGS="-g -O2 -fvisibility=hidden" CXXFLAGS="-g -O2" LDFLAGS="" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384enabling picdisabling docs
……
$ make -j install
make  install-recursive
make[1]: 進入目錄“/data/software/freeswitch/freeswitch”/usr/bin/mkdir -p '/usr/local/freeswitch/lib'/bin/sh /data/software/freeswitch/freeswitch/libtool   --mode=install /usr/bin/install -c   libfreeswitch.la '/usr/local/freeswitch/lib'
libtool: install: /usr/bin/install -c .libs/libfreeswitch.so.1.0.0 /usr/local/freeswitch/lib/libfreeswitch.so.1.0.0
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so.1 || { rm -f libfreeswitch.so.1 && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so.1; }; })
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so || { rm -f libfreeswitch.so && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so; }; })
libtool: install: /usr/bin/install -c .libs/libfreeswitch.lai /usr/local/freeswitch/lib/libfreeswitch.la
libtool: finish: PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/bin:/usr/lib64:/sbin" ldconfig -n /usr/local/freeswitch/lib
----------------------------------------------------------------------
Libraries have been installed in:/usr/local/freeswitch/lib+---------- FreeSWITCH install Complete ----------++ FreeSWITCH has been successfully installed.     ++                                                 ++       Install sounds:                           ++       (uhd-sounds includes hd-sounds, sounds)   ++       (hd-sounds includes sounds)               ++       ------------------------------------      ++                make cd-sounds-install           ++                make cd-moh-install              ++                                                 ++                make uhd-sounds-install          ++                make uhd-moh-install             ++                                                 ++                make hd-sounds-install           ++                make hd-moh-install              ++                                                 ++                make sounds-install              ++                make moh-install                 ++                                                 ++       Install non english sounds:               ++       replace XX with language                  ++       (ru : Russian)                            ++       (fr : French)                             ++       ------------------------------------      ++                make cd-sounds-XX-install        ++                make uhd-sounds-XX-install       ++                make hd-sounds-XX-install        ++                make sounds-XX-install           ++                                                 ++       Upgrade to latest:                        ++       ----------------------------------        ++                make current                     ++                                                 ++       Rebuild all:                              ++       ----------------------------------        ++                make sure                        ++                                                 ++       Install/Re-install default config:        ++       ----------------------------------        ++                make samples                     ++                                                 ++                                                 ++       Additional resources:                     ++       ----------------------------------        ++       https://www.freeswitch.org                ++       https://freeswitch.org/confluence         ++       https://freeswitch.org/jira               ++       http://lists.freeswitch.org               ++                                                 ++       irc.freenode.net / #freeswitch            ++                                                 ++       Register For ClueCon:                     ++       ----------------------------------        ++       https://www.cluecon.com                   ++                                                 ++-------------------------------------------------+
.=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.
Checking module integrity in target [/usr/local/freeswitch/mod]make[2]: 離開目錄“/data/software/freeswitch/freeswitch/build”
Making install in tests/unit
make[2]: 進入目錄“/data/software/freeswitch/freeswitch/tests/unit”
make[3]: 進入目錄“/data/software/freeswitch/freeswitch/tests/unit”
make[3]: 對“install-data-am”無需做任何事。/usr/bin/mkdir -p '/usr/local/freeswitch/bin'/bin/sh /data/software/freeswitch/freeswitch/libtool   --mode=install /usr/bin/install -c switch_eavesdrop '/usr/local/freeswitch/bin'
libtool: install: /usr/bin/install -c .libs/switch_eavesdrop /usr/local/freeswitch/bin/switch_eavesdrop
make[3]: 離開目錄“/data/software/freeswitch/freeswitch/tests/unit”
make[2]: 離開目錄“/data/software/freeswitch/freeswitch/tests/unit”
make[1]: 離開目錄“/data/software/freeswitch/freeswitch”

根據最后安裝成功的提示,安裝聲音文件:

$ make sounds-install
#/data/software/freeswitch/freeswitch
# /data/software/freeswitch/freeswitch/build/getsounds.sh freeswitch-sounds-en-us-callie-8000-1.0.53.tar.gz /usr/local/freeswitch/sounds/
--2025-07-17 11:19:33--  http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.53.tar.gz
正在解析主機 files.freeswitch.org (files.freeswitch.org)... 190.102.98.174, 2803:d000:fffe::174
正在連接 files.freeswitch.org (files.freeswitch.org)|190.102.98.174|:80... 已連接。
……
$ make moh-install
#/data/software/freeswitch/freeswitch
# /data/software/freeswitch/freeswitch/build/getsounds.sh freeswitch-sounds-music-8000-1.0.52.tar.gz /usr/local/freeswitch/sounds/
--2025-07-17 11:33:36--  http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.52.tar.gz
正在解析主機 files.freeswitch.org (files.freeswitch.org)... 190.102.98.174, 2803:d000:fffe::174
正在連接 files.freeswitch.org (files.freeswitch.org)|190.102.98.174|:80... 已連接。
……

以上完成后就可以開始體驗Freeswitch的功能了

七、服務的啟動和訪問

可以前臺啟動或后臺啟動

前臺

用于測試與調試,可以看到最完整的啟動信息與交互日志,便于排查

$ freeswitch 
2025-07-17 15:14:38.811260 0.00% [INFO] switch_event.c:714 Activate Eventing Engine.
2025-07-17 15:14:38.821648 0.00% [WARNING] switch_event.c:685 Create additional event dispatch thread 0
2025-07-17 15:14:43.997438 0.00% [INFO] switch_stun.c:915 External ip address detected using STUN: 49.72.17.32
2025-07-17 15:14:54.016382 0.00% [ERR] switch_stun.c:918 STUN Failed! [Timeout]
2025-07-17 15:14:54.016425 0.00% [ERR] switch_xml.c:175 stun-set failed.
2025-07-17 15:14:54.047721 0.00% [INFO] switch_nat.c:417 Scanning for NAT
2025-07-17 15:14:54.047874 0.00% [DEBUG] switch_nat.c:170 Checking for PMP 1/5
2025-07-17 15:14:54.050407 0.00% [ERR] switch_nat.c:199 Error checking for PMP [wait sock failed]
2025-07-17 15:14:54.050446 0.00% [DEBUG] switch_nat.c:422 Checking for UPnP
2025-07-17 15:15:06.050999 0.00% [INFO] switch_nat.c:438 No PMP or UPnP NAT devices detected!
……
2025-07-17 15:18:10.552265 100.00% [CONSOLE] switch_core.c:2494 
.=============================================================.
|   _____              ______        _____ _____ ____ _   _   |
|  |  ___| __ ___  ___/ ___\ \      / /_ _|_   _/ ___| | | |  |
|  | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | |  | || |   | |_| |  |
|  |  _|| | |  __/  __/___) |\ V  V /  | |  | || |___|  _  |  |
|  |_|  |_|  \___|\___|____/  \_/\_/  |___| |_| \____|_| |_|  |
|                                                             |
.=============================================================.
|   Anthony Minessale II, Michael Jerris, Brian West, Others  |
|   FreeSWITCH (http://www.freeswitch.org)                    |
|   Paypal Donations Appreciated: paypal@freeswitch.org       |
|   Brought to you by ClueCon http://www.cluecon.com/         |
.=============================================================..=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.2025-07-17 15:18:10.552279 100.00% [INFO] switch_core.c:2503 
FreeSWITCH Version 1.10.12-release~64bit ( 64bit)FreeSWITCH Started
Max Sessions [1000]
Session Rate [30]
SQL [Enabled]
后臺

用于生產啟動,可以前往log查看啟動進展

freeswitch -nc -nonat
24676 Backgrounding.
$ tail -100f /usr/local/freeswitch/log/freeswitch.log 
2025-07-17 14:32:09.797485 98.60% [NOTICE] switch_loadable_module.c:1546 Deleting Chat interface 'sip'
2025-07-17 14:32:09.797485 98.60% [NOTICE] switch_loadable_module.c:1590 Deleting Management interface 'mod_sofia' OID[.1.3.6.1.4.1.27880.1001]
2025-07-17 14:32:09.797485 98.60% [CONSOLE] switch_loadable_module.c:2354 Stopping: mod_sofia
2025-07-17 14:32:09.797485 98.60% [NOTICE] switch_event.c:467 Subclass reservation deleted for mod_sofia.c:sofi
……
2025-07-17 15:18:10.552265 100.00% [CONSOLE] switch_core.c:2494 
.=============================================================.
|   _____              ______        _____ _____ ____ _   _   |
|  |  ___| __ ___  ___/ ___\ \      / /_ _|_   _/ ___| | | |  |
|  | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | |  | || |   | |_| |  |
|  |  _|| | |  __/  __/___) |\ V  V /  | |  | || |___|  _  |  |
|  |_|  |_|  \___|\___|____/  \_/\_/  |___| |_| \____|_| |_|  |
|                                                             |
.=============================================================.
|   Anthony Minessale II, Michael Jerris, Brian West, Others  |
|   FreeSWITCH (http://www.freeswitch.org)                    |
|   Paypal Donations Appreciated: paypal@freeswitch.org       |
|   Brought to you by ClueCon http://www.cluecon.com/         |
.=============================================================..=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.2025-07-17 15:18:10.552279 100.00% [INFO] switch_core.c:2503 
FreeSWITCH Version 1.10.12-release~64bit ( 64bit)FreeSWITCH Started
Max Sessions [1000]
Session Rate [30]
SQL [Enabled]
訪問命令行

啟動后可以采用命令行訪問,或者后續開發了java、webrtc等工具進行交互

$ fs_cli -H IP -P PORT -p "PASSWORD" -d DEBUG_LEVEL
DEBUG] esl_config.c:56 esl_config_open_file() Configuration file is /root/.fs_cli_conf.
[DEBUG] esl_config.c:56 esl_config_open_file() Configuration file is /etc/fs_cli.conf.
[DEBUG] fs_cli.c:1649 main() no profiles found, using builtin profile
=======================================================.
|            _____ ____     ____ _     ___              |
|           |  ___/ ___|   / ___| |   |_ _|             |
|           | |_  \___ \  | |   | |    | |              |
|           |  _|  ___) | | |___| |___ | |              |
|           |_|   |____/   \____|_____|___|             |
|                                                       |
.=======================================================.
| Anthony Minessale II, Ken Rice,                       |
| Michael Jerris, Travis Cross                          |
| FreeSWITCH (http://www.freeswitch.org)                |
| Paypal Donations Appreciated: paypal@freeswitch.org   |
| Brought to you by ClueCon http://www.cluecon.com/     |
.=======================================================..=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.Type /help <enter> to see a list of commands[INFO] fs_cli.c:1867 main() FS CLI Ready.
enter /help for a list of commands.
+OK log level  [7]
freeswitch@opensips>statusUP 0 years, 0 days, 0 hours, 39 minutes, 57 seconds, 346 milliseconds, 481 microseconds
FreeSWITCH (Version 1.10.12-release  64bit) is ready
0 session(s) since startup
0 session(s) - peak 0, last 5min 0 
0 session(s) per Sec out of max 30, peak 0, last 5min 0 
1000 session(s) max
min idle cpu 0.00/99.17
Current Stack Size/Max 240K/8192K

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/92354.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/92354.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/92354.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

網絡原理 HTTP 和 HTTPS

目錄 一 . HTTP 協議 二 . 抓包 三 . HTTP 請求 / 響應的基本格式 &#xff08;1&#xff09;HTTP請求的基本格式 &#xff08;2&#xff09;HTTP響應的基本格式 四 . HTTP 方法 GET 和 POST 的區別&#xff1a; 五 . 請求報頭和響應報頭 &#xff08;1&#…

基于單片機的自動條幅懸掛機

摘 要 隨著日新月異科技發展&#xff0c;在心率體溫測量方面&#xff0c;我們取得了迅速的發展&#xff0c;就近日而言&#xff0c;脈搏測量儀已經在多個領域大展身手&#xff0c;除了在醫學領域有所建樹&#xff0c;在人們的日常生活方面的應用也不斷拓展&#xff0c;如檢疫…

《C++》面向對象編程--類(中)

文章目錄一、構造函數1.1定義1.2語法1.3特性二、析構函數2.1定義2.2語法2.3特性三、拷貝構造函數3.1定義3.2語法3.3特性3.4淺拷貝3.4.1定義3.4.2淺拷貝的風險3.5深拷貝一、構造函數 1.1定義 在C中&#xff0c;構造函數&#xff08;Constructor&#xff09; 是一種特殊的成員函…

機器學習初學者理論初解

大家好! 為什么手機相冊能自動識別人臉&#xff1f;為什么購物網站總能推薦你喜歡的商品&#xff1f;這些“智能”背后&#xff0c;都藏著一位隱形高手——機器學習&#xff08;Machine Learning&#xff09;。一、什么是機器學習&#xff1f;簡單說&#xff0c;機器學習是教計…

原碼反碼補碼

在Java中&#xff0c;無論是小數還是整數&#xff0c;他們都要帶有符號&#xff08;和C語言不同&#xff0c;C語言有無符號數&#xff09;。首位就作為符號位。原碼反碼&#xff1a;正數的反碼是其原碼本身負數的反碼是在其原碼的基礎上, 符號位不變&#xff0c;其余各個位取反…

使用ubuntu:20.04和ubuntu:jammy構建secretflow環境

一、使用ubuntu:20.04構建隱語編譯環境FROM ubuntu:20.04LABEL maintainer"build SecureProtocolLib on ubuntu:20.04"ARG TARGETPLATFORM# change dash to bash as default shell RUN ln -sf /bin/bash /bin/shRUN apt update \&& apt upgrade -y \&&am…

Hinge Loss(鉸鏈損失函數)詳解:SVM 中的關鍵損失函數

&#x1f4cc; 一、什么是 Hinge Loss&#xff1f;Hinge Loss&#xff08;鉸鏈損失&#xff09;&#xff0c;是 支持向量機&#xff08;SVM, Support Vector Machine&#xff09; 中常用的一種損失函數&#xff0c;用于最大間隔分類。其核心思想是&#xff1a;當預測結果已經正…

days32 :零基礎學嵌入式之網絡2.0

一、wireshark &#xff1a;網絡抓包工具1.功能&#xff1a;抓取通過電腦網卡的網絡數據2.作用&#xff1a;排查故障、抓取數據做數據分析、3.用法&#xff1a;&#xff08;1&#xff09;sudo wireshark&#xff08;2&#xff09;選擇需要抓取的網卡》any&#xff08;3&#xf…

數字護網:一次深刻的企業安全體系靈魂演練

&#x1f9e9; 引言&#xff1a;什么是“護網”&#xff1f;—— 不止是攻防&#xff0c;更是企業安全能力的年度大考 每年&#xff0c;由國家相關部門牽頭的“護網行動”都如期而至&#xff0c;各大企事業單位的安全團隊也隨之進入高度戒備狀態。然而&#xff0c;“護網”遠非…

基于 NumPy 的高效數值計算技術解析與實踐指引

在數據處理與科學計算領域&#xff0c;高效是核心訴求。NumPy 作為 Python 生態高效數值計算的基石&#xff0c;以高性能多維數組對象及配套函數&#xff0c;成為數據從業者的必備工具。其數組支持算術、比較、邏輯等豐富運算&#xff0c;通過向量化操作直接處理每個元素&#…

Kafka MQ 控制器 broker

Kafka MQ 控制器 broker 1 控制器broker的選舉 在 Kafka 集群中會有一個或多個 broker,其中有一個 broker 會被選舉為控制器(Kafka Controller)?,它負責管理整個集群中所有分區和副本的狀態。當某個分區的leader副本出現故障時,由控制器負責為該分區選舉新的leader副本…

50天50個小項目 (Vue3 + Tailwindcss V4) ? | ImageCarousel(圖片輪播組件)

&#x1f4c5; 我們繼續 50 個小項目挑戰&#xff01;—— ImageCarousel組件 倉庫地址&#xff1a;https://github.com/SunACong/50-vue-projects 項目預覽地址&#xff1a;https://50-vue-projects.vercel.app/ 使用 Vue 3 的 <script setup> 語法以及 Tailwind CSS …

基于springboot的智能物流管理系統(源碼+論文)

一、開發環境 MYSQL數據庫 MySQL是一個真正的多用戶、多線程SQL數據庫服務器&#xff0c;基于SQL的客戶/服務器模式的關系數據庫管理系統。其特點包括&#xff1a; 功能強大&#xff1a;支持多用戶、多線程操作。使用簡單&#xff1a;管理方便&#xff0c;安全可靠性高。跨平…

Collection接口的詳細介紹以及底層原理——包括數據結構紅黑樹、二叉樹等,從0到徹底掌握Collection只需這篇文章

目錄 Collection簡介 Collection的遍歷方式 迭代器遍歷 增強for遍歷 Lambda表達式遍歷 List集合 List集合的遍歷方式 列表迭代器遍歷以及普通for循環 數據結構 棧 隊列 數組 鏈表 單向鏈表 雙向鏈表 二叉樹 遍歷方式 普通二叉樹 二叉查找樹 平衡二叉樹 旋轉…

《安順棒壘球》世界十大運動·棒球1號位

Worlds Top 10 Sports for Newbies | 棒球排第幾&#xff1f; 全球青訓體系大揭秘 ?添加圖片注釋&#xff0c;不超過 140 字&#xff08;可選&#xff09;神王棒球世界十大運動排名 Top 10 Global Sports&#xff08;按參與度/商業價值/影響力綜合排序&#xff09;足球 Footba…

什么是“差分“?

1. 什么是"差分"&#xff1f;想象兩個人在玩蹺蹺板&#xff1a;當兩人同時向上跳&#xff08;同向移動&#xff09;→ 蹺蹺板不動 → 這叫"共模"當一人向上&#xff0c;另一人向下&#xff08;反向移動&#xff09;→ 蹺蹺板傾斜 → 這叫"差分"差…

4.組合式API知識點(2)

10 組合式API - 模版引用模板引用的概念如何使用&#xff08;以獲取dom為例 組件同理&#xff09;組件實例對象defineExpose()11 組合式API - provide和inject作用和場景跨層傳遞普通數據跨層傳遞響應式數據跨層傳遞方法需求解決思考

GitLab企業版部署與許可證生成完整指南

GitLab企業版部署與許可證生成完整指南一、背景二、環境準備三、部署步驟1. 創建目錄結構2. 生成GitLab許可證2.1 克隆許可證生成器2.2 修改生成器腳本2.3 構建Docker鏡像2.4 生成許可證文件3. 創建Docker Compose配置文件4. 啟動GitLab容器4.1 初始啟動4.2 修改GitLab配置4.3 …

Jenkins 不同節點間文件傳遞:跨 Job 與 同 Job 的實現方法

在日常的 DevOps 運維實踐中&#xff0c;Jenkins 通常被用于串聯多個自動化流程&#xff0c;而這些流程往往需要在不同的構建節點&#xff08;agent&#xff09;上執行。例如&#xff0c;在以下場景中&#xff1a; &#x1f4cc; 場景需求描述&#xff08;實際問題&#xff09;…

Java中AQS原理

一、核心架構&#xff1a;AQS抽象隊列同步器二、AQS核心機制1. 三大核心組件&#xff1a;state狀態變量&#xff1a;volatile int&#xff0c;表示鎖狀態&#xff08;0未鎖定&#xff0c;≥1鎖定/重入次數&#xff09;CLH隊列&#xff1a;雙向鏈表實現的線程等待隊列Node節點&a…