RPM安装

  1. # yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
  2. # yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-*
  3. ....

DockerFile

  1. FROM debian:buster
  2. RUN apt update && apt -y --quiet upgrade && apt install -y --quiet gnupg2 wget \
  3. && wget -O - https://files.freeswitch.org/repo/deb/debian-release/fsstretch-archive-keyring.asc | apt-key add - \
  4. && echo "deb http://files.freeswitch.org/repo/deb/debian-release/ buster main" > /etc/apt/sources.list.d/freeswitch.list \
  5. && echo "deb-src http://files.freeswitch.org/repo/deb/debian-release/ buster main" >> /etc/apt/sources.list.d/freeswitch.list \
  6. && apt update && apt clean && rm -rf /var/lib/apt/lists/*
  7. RUN groupadd -r freeswitch && useradd -r -g freeswitch freeswitch
  8. RUN apt -y --quiet update && apt install -y --quiet freeswitch-meta-all \
  9. && cp -a /usr/share/freeswitch/conf/vanilla /etc/freeswitch \
  10. && rm -rf /usr/share/freeswitch/conf \
  11. && mkdir -p /docker-entrypoint.d /certs /db /recordings /scripts /var/lib/freeswitch /var/run/freeswitch \
  12. && apt clean && rm -rf /var/lib/apt/lists/*
  13. COPY docker-entrypoint.sh /
  14. ENTRYPOINT ["/docker-entrypoint.sh"]
  15. CMD ["freeswitch"]

docker-entrypoint.sh

  1. #!/bin/bash
  2. set -e
  3. if [ "$1" = 'freeswitch' ]; then
  4. chown -R freeswitch:freeswitch /etc/freeswitch
  5. chown -R freeswitch:freeswitch /var/{run,lib}/freeswitch
  6. chown -R freeswitch:freeswitch /{db,certs,scripts,recordings,tmp}
  7. if [ -d /docker-entrypoint.d ]; then
  8. for f in /docker-entrypoint.d/*.sh; do
  9. [ -f "$f" ] && . "$f"
  10. done
  11. fi
  12. exec freeswitch freeswitch -u freeswitch -g freeswitch -c \
  13. -sounds /sounds -recordings /recordings -conf /etc/freeswitch \
  14. -certs /certs -db /db -scripts /scripts -log /tmp
  15. fi
  16. exec "$@"

直接使用主机地址

  1. docker run -d --net=host --name fs readytalk/freeswitch-docker:latest

后台启动

  1. freeswitch -nc

判断FreeSWITCH是否运行,看进程是否存在。如果进程已经启动,下列命令能列出所有与FreeSWITCH相关的进程:

  1. # ps aux|grep freeswitch
  2. root 18356 1.5 18.9 1817120 741356 ? S<Ll Nov17 420:02 freeswitch -nc

查看进程信息

  1. # netstat -anp |grep 5060
  2. tcp 0 0 172.17.0.2:5060 0.0.0.0:* LISTEN 18356/freeswitch
  3. tcp6 0 0 ::1:5060 :::* LISTEN 18356/freeswitch
  4. udp 0 0 172.17.0.2:5060 0.0.0.0:* 18356/freeswitch
  5. udp6 0 0 ::1:5060 :::* 18356/freeswitch

端口

查看所有占有端口

  1. # netstat -tulnp|grep freeswitch
  2. tcp 0 0 172.17.0.2:5060 0.0.0.0:* LISTEN 4438/freeswitch
  3. tcp 0 0 172.17.0.2:5061 0.0.0.0:* LISTEN 4438/freeswitch
  4. tcp 0 0 172.17.0.2:2855 0.0.0.0:* LISTEN 4438/freeswitch
  5. tcp 0 0 172.17.0.2:2856 0.0.0.0:* LISTEN 4438/freeswitch
  6. tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4438/freeswitch
  7. tcp 0 0 172.17.0.2:7443 0.0.0.0:* LISTEN 4438/freeswitch
  8. tcp 0 0 0.0.0.0:8020 0.0.0.0:* LISTEN 4438/freeswitch
  9. tcp 0 0 172.17.0.2:7480 0.0.0.0:* LISTEN 4438/freeswitch
  10. udp 0 0 172.17.0.2:29360 0.0.0.0:* 4438/freeswitch
  11. udp 0 0 172.17.0.2:23294 0.0.0.0:* 4438/freeswitch
  12. udp 0 0 172.17.0.2:5060 0.0.0.0:* 4438/freeswitch
  13. udp 0 0 172.17.0.2:25864 0.0.0.0:* 4438/freeswitch
  14. udp 0 0 172.17.0.2:19786 0.0.0.0:* 4438/freeswitch
  15. udp 0 0 172.17.0.2:24742 0.0.0.0:* 4438/freeswitch

端口

  1. FireWall Ports Network Protocol Application Protocol Description
  2. 1719 UDP H.323 Gatekeeper RAS port
  3. 1720 TCP H.323 Call Signaling
  4. 3478 UDP STUN service Used for NAT traversal
  5. 3479 UDP STUN service Used for NAT traversal
  6. 5002 TCP MLP protocol server
  7. 5003 UDP Neighborhood service
  8. 5060 UDP & TCP SIP UAS Used for SIP signaling (Standard SIP Port, for default Internal Profile)
  9. 5070 UDP & TCP SIP UAS Used for SIP signaling (For default "NAT" Profile)
  10. 5080 UDP & TCP SIP UAS Used for SIP signaling (For default "External" Profile)
  11. 8021 TCP ESL Used for mod_event_socket *
  12. 16384-32768 UDP RTP/ RTCP multimedia streaming Used for audio/video data in SIP and other protocols
  13. 5066 TCP Websocket Used for WebRTC
  14. 7443 TCP Websocket Used for WebRTC

在10上占有的端口

  1. # ps -aux|grep freeswitch
  2. root 5195 0.5 2.5 1344996 98720 ? S<Ll 14:57 0:02 freeswitch -nc
  3. # netstat -anp | grep "5195"
  4. tcp 0 0 172.17.0.2:8081 0.0.0.0:* LISTEN 5195/freeswitch
  5. tcp 0 0 172.17.0.2:8082 0.0.0.0:* LISTEN 5195/freeswitch
  6. tcp6 0 0 :::8021 :::* LISTEN 5195/freeswitch
  7. tcp6 0 0 ::1:8081 :::* LISTEN 5195/freeswitch
  8. tcp6 0 0 ::1:8082 :::* LISTEN 5195/freeswitch
  9. udp 0 0 0.0.0.0:1337 0.0.0.0:* 5195/freeswitch
  10. udp 0 0 172.17.0.2:42613 172.17.0.1:5351 ESTABLISHED 5195/freeswitch

开发环境搭建

使用第三方docker:https://github.com/BetterVoice/freeswitch-container

关闭主机防火墙

  1. $systemctl stop firewalld
  2. $firewall-cmd --state

或者设置开机禁用防火墙

  1. $systemctl disable firewalld
  2. Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
  3. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

安装 使用宿主机网络

  1. $ docker run -d --name=freeswitch --net=host -v /etc/localtime:/etc/localtime:ro bettervoice/freeswitch-container:1.6.6

或者具体的端口地址映射

  1. 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

查看端口情况

  1. 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/