RPM安装
# yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release# yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-*....
DockerFile
FROM debian:busterRUN apt update && apt -y --quiet upgrade && apt install -y --quiet gnupg2 wget \&& wget -O - https://files.freeswitch.org/repo/deb/debian-release/fsstretch-archive-keyring.asc | apt-key add - \&& echo "deb http://files.freeswitch.org/repo/deb/debian-release/ buster main" > /etc/apt/sources.list.d/freeswitch.list \&& echo "deb-src http://files.freeswitch.org/repo/deb/debian-release/ buster main" >> /etc/apt/sources.list.d/freeswitch.list \&& apt update && apt clean && rm -rf /var/lib/apt/lists/*RUN groupadd -r freeswitch && useradd -r -g freeswitch freeswitchRUN apt -y --quiet update && apt install -y --quiet freeswitch-meta-all \&& cp -a /usr/share/freeswitch/conf/vanilla /etc/freeswitch \&& rm -rf /usr/share/freeswitch/conf \&& mkdir -p /docker-entrypoint.d /certs /db /recordings /scripts /var/lib/freeswitch /var/run/freeswitch \&& apt clean && rm -rf /var/lib/apt/lists/*COPY docker-entrypoint.sh /ENTRYPOINT ["/docker-entrypoint.sh"]CMD ["freeswitch"]
docker-entrypoint.sh
#!/bin/bashset -eif [ "$1" = 'freeswitch' ]; thenchown -R freeswitch:freeswitch /etc/freeswitchchown -R freeswitch:freeswitch /var/{run,lib}/freeswitchchown -R freeswitch:freeswitch /{db,certs,scripts,recordings,tmp}if [ -d /docker-entrypoint.d ]; thenfor f in /docker-entrypoint.d/*.sh; do[ -f "$f" ] && . "$f"donefiexec freeswitch freeswitch -u freeswitch -g freeswitch -c \-sounds /sounds -recordings /recordings -conf /etc/freeswitch \-certs /certs -db /db -scripts /scripts -log /tmpfiexec "$@"
直接使用主机地址
docker run -d --net=host --name fs readytalk/freeswitch-docker:latest
后台启动
freeswitch -nc
判断FreeSWITCH是否运行,看进程是否存在。如果进程已经启动,下列命令能列出所有与FreeSWITCH相关的进程:
# ps aux|grep freeswitchroot 18356 1.5 18.9 1817120 741356 ? S<Ll Nov17 420:02 freeswitch -nc
查看进程信息
# netstat -anp |grep 5060tcp 0 0 172.17.0.2:5060 0.0.0.0:* LISTEN 18356/freeswitchtcp6 0 0 ::1:5060 :::* LISTEN 18356/freeswitchudp 0 0 172.17.0.2:5060 0.0.0.0:* 18356/freeswitchudp6 0 0 ::1:5060 :::* 18356/freeswitch
端口
查看所有占有端口
# netstat -tulnp|grep freeswitchtcp 0 0 172.17.0.2:5060 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 172.17.0.2:5061 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 172.17.0.2:2855 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 172.17.0.2:2856 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 172.17.0.2:7443 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 0.0.0.0:8020 0.0.0.0:* LISTEN 4438/freeswitchtcp 0 0 172.17.0.2:7480 0.0.0.0:* LISTEN 4438/freeswitchudp 0 0 172.17.0.2:29360 0.0.0.0:* 4438/freeswitchudp 0 0 172.17.0.2:23294 0.0.0.0:* 4438/freeswitchudp 0 0 172.17.0.2:5060 0.0.0.0:* 4438/freeswitchudp 0 0 172.17.0.2:25864 0.0.0.0:* 4438/freeswitchudp 0 0 172.17.0.2:19786 0.0.0.0:* 4438/freeswitchudp 0 0 172.17.0.2:24742 0.0.0.0:* 4438/freeswitch
端口
FireWall Ports Network Protocol Application Protocol Description1719 UDP H.323 Gatekeeper RAS port1720 TCP H.323 Call Signaling3478 UDP STUN service Used for NAT traversal3479 UDP STUN service Used for NAT traversal5002 TCP MLP protocol server5003 UDP Neighborhood service5060 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 and other protocols5066 TCP Websocket Used for WebRTC7443 TCP Websocket Used for WebRTC
在10上占有的端口
# ps -aux|grep freeswitchroot 5195 0.5 2.5 1344996 98720 ? S<Ll 14:57 0:02 freeswitch -nc# netstat -anp | grep "5195"tcp 0 0 172.17.0.2:8081 0.0.0.0:* LISTEN 5195/freeswitchtcp 0 0 172.17.0.2:8082 0.0.0.0:* LISTEN 5195/freeswitchtcp6 0 0 :::8021 :::* LISTEN 5195/freeswitchtcp6 0 0 ::1:8081 :::* LISTEN 5195/freeswitchtcp6 0 0 ::1:8082 :::* LISTEN 5195/freeswitchudp 0 0 0.0.0.0:1337 0.0.0.0:* 5195/freeswitchudp 0 0 172.17.0.2:42613 172.17.0.1:5351 ESTABLISHED 5195/freeswitch
开发环境搭建
使用第三方docker:https://github.com/BetterVoice/freeswitch-container
关闭主机防火墙
$systemctl stop firewalld$firewall-cmd --state
或者设置开机禁用防火墙
$systemctl disable firewalldRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
安装 使用宿主机网络
$ docker run -d --name=freeswitch --net=host -v /etc/localtime:/etc/localtime:ro bettervoice/freeswitch-container:1.6.6
或者具体的端口地址映射
sudo docker run -d --name freeswitch -p 5060:5060/tcp -p 5060:5060/udp -p 5080:5080/tcp -p 5080:5080/udp -p 8021:8021/tcp -p 7443:7443/tcp -p 64535-65535:64535-65535/udp bettervoice/freeswitch-container:1.6.6
查看端口情况
netstat -nultp
参考
https://freeswitch.org/confluence/display/FREESWITCH/mod_event_socket#mod_event_socket-Inbound
https://registry.hub.docker.com/r/readytalk/freeswitch-docker
https://github.com/PremiereGlobal/freeswitch-docker
https://github.com/kovalyshyn/docker-freeswitch/tree/vanilla
https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster
https://github.com/PremiereGlobal/freeswitch-docker
https://registry.hub.docker.com/r/oriaks/freeswitch/dockerfile
https://www.cnblogs.com/yjmyzz/p/install-freeswitch-on-mac.html
https://leaderli.github.io/2020/07/04/freeswitch/
