FreeSWITCH是一个开源的电话软交换平台,支持实时音视频通信及会议,支持SIP及WebRTC等多种通信协议。
编写Dockerfile1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56FROM debian:bullseye
RUN sed -i 's/http:\/\/deb.debian.org/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install git
RUN git clone https://github.com/signalwire/freeswitch /usr/src/freeswitch
RUN git clone https://github.com/signalwire/libks /usr/src/libs/libks
RUN git clone https://github.com/freeswitch/sofia-sip /usr/src/libs/sofia-sip
RUN git clone https://github.com/freeswitch/spandsp /usr/src/libs/spandsp
RUN git clone https://github.com/signalwire/signalwire-c /usr/src/libs/signalwire-c
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install \
# build
build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \
# general
libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \
# core
libpcre3-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev nasm \
# core codecs
libogg-dev libspeex-dev libspeexdsp-dev \
# mod_enum
libldns-dev \
# mod_python3
python3-dev \
# mod_av
libavformat-dev libswscale-dev libavresample-dev \
# mod_lua
liblua5.2-dev \
# mod_opus
libopus-dev \
# mod_pgsql
libpq-dev \
# mod_sndfile
libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \
# mod_shout
libshout3-dev libmpg123-dev libmp3lame-dev
RUN cd /usr/src/libs/libks && cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 && make install
RUN cd /usr/src/libs/sofia-sip && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr && make -j`nproc --all` && make install
RUN cd /usr/src/libs/spandsp && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr && make -j`nproc --all` && make install
RUN cd /usr/src/libs/signalwire-c && PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install
# Enable modules
RUN sed -i 's|#formats/mod_shout|formats/mod_shout|' /usr/src/freeswitch/build/modules.conf.in
RUN cd /usr/src/freeswitch && ./bootstrap.sh -j
RUN cd /usr/src/freeswitch && ./configure
RUN cd /usr/src/freeswitch && make -j`nproc` && make install
# Cleanup the image
RUN apt-get clean
# Uncomment to cleanup even more
#RUN rm -rf /usr/src/*
制作镜像1
docker build -t fs:latest .
启动镜像1
docker run -itd --net=host --name fs fs:latest
启动freeswitch1
2
3
4docker exec -it fs bash
cd /usr/local/freeswitch
./bin/freeswitch
开放端口
| FireWall Ports | Network Protocol | Application Protocol | Description |
| — | — | — | — |
| 1719 | UDP | H.323 Gatekeeper RAS port | |
|1720 | TCP | H.323 Call Signaling | |
|2855-2856 | TCP | MSRP | Used for call with messaging |
|3478 | UDP | STUN service | Used for NAT traversal |
|3479 | UDP | STUN service | Used for NAT traversal |
|5002 | TCP | MLP protocol server | |
|5003 | UDP | Neighborhood service | |
|5060 | UDP & TCP | SIP UAS | Used for SIP signaling (Standard SIP Port, for default Internal Profile) |
|5070 | UDP & TCP | SIP UAS | Used for SIP signaling (For default “NAT” Profile) |
|5080 | UDP & TCP | SIP UAS | Used for SIP signaling (For default “External” Profile) |
|8021 | TCP | ESL | Used for mod_event_socket * |
|16384-32768 | UDP | RTP/ RTCP multimedia streaming | Used for audio/video data in SIP, Verto, and other protocols |
|5066 | TCP | Websocket | Used for WebRTC |
|7443 | TCP | Websocket | Used for WebRTC |
|8081-8082 | TCP | Websocket | Used for Verto |
本文标题:freeswitch制作docker镜像
本文链接:https://xxzkid.github.io/2025/freeswitch-docker/