docker 部署freeswitch(非编译方式)

一:安装部署

1.拉取镜像

参考:https://hub.docker.com/r/safarov/freeswitch

复制代码
 docker pull safarov/freeswitch

2.启动镜像

复制代码
docker run --net=host --name freeswitch \
           -e SOUND_RATES=8000:16000 \
           -e SOUND_TYPES=music:en-us-callie \
           -v /home/xx/freeswitch-sounds:/usr/share/freeswitch/sounds \
           -v /etc/freeswitch/:/etc/freeswitch \
           safarov/freeswitch

启动后出错:

这里的错误影响不是很大,可以不用管,主要是把语音相关文件补回去,不然拨打后拿文件会出错

手动下载:freeswitch-sounds-en-us-callie-8000-1.0.51.tar 解压到/home/xx/freeswitch-sounds

操作后重启镜像

3.宿主机关防火墙

复制代码
  sudo systemctl stop firewalld
  sudo systemctl disable firewalld
  sudo systemctl status firewalld

4.至此基本能用了,使用方式

账号:1000到1019

密码:/etc/freeswitch/vars.xml

查找关键字:default_password,就能看到

服务器地址:宿主机ip:5060,例如:1.1.1.1:5060

二:添加账号

参考目录:/etc/freeswitch/directory/default

下面1000.xml,拷贝把文件名和内容的1000全部替换,例如1020

添加后进入容器

复制代码
  docker exec -it freeswitch  /bin/bash

执行

复制代码
fs_cli -x "reloadxml"

生效

三:拨打定制特定号码服务端的响应计划

举例:想要配置拨打10086的时候,先振铃5秒,再拨打一段语音,然后挂断

打开/etc/freeswitch/dialplan/default.xml

添加下面的配置

复制代码
  <extension name="zhauto_answer">
        <condition field="destination_number" expression="^10086$">
            <action application="ring_ready"/>
            <action application="sleep" data="5000"/>
            <action application="answer"/>
            <action application="sleep" data="1000"/>
            <action application="playback" data="/usr/share/freeswitch/sounds/partita-no-3-in-e-major-bwv-1006-1-preludio.wav"/>
            <action application="hangup"/>
        </condition>
    </extension>

重启容器即可

相关推荐
江湖有缘40 分钟前
【Docker项目实战】在Docker环境下部署go-file文件分享工具
docker·容器·golang
小和尚同志11 小时前
26.4k Star 的开源自托管仪表盘,关注你想关注的一切
docker·容器·开源
Franciz小测测11 小时前
proxmox 解决docker容器MongoDB创建报错MongoDB 5.0+ requires a CPU with AVX support
运维·docker·容器
果子⌂12 小时前
Kubernetes 服务发布进阶
linux·运维·服务器·云原生·容器·kubernetes·云计算
鹿先森AI探索之路14 小时前
Windows11 本地安装docker Desktop 部署dify 拉取镜像报错
运维·docker·容器
UsamaBinLaden14 小时前
在 Alpine Linux 中创建虚拟机时 Cgroup 挂在失败的现象
linux·容器·虚拟化·incus·lxd·alpine
都叫我大帅哥15 小时前
Docker Compose:让多容器应用一键起飞 🚀
docker
Gold Steps.15 小时前
K8s WebUI 选型:国外 Rancher vs 国内 KubeSphere vs 原生 Dashboard,从部署到使用心得谁更适合企业级场景?
云原生·容器·kubernetes
<花开花落>17 小时前
解决 WSL 中无法访问 registry-1.docker.io/v2/,无法用 docker 拉取 image
docker
云游18 小时前
K8s:离线部署Kubernetes1.26.12及采用外部Harbor
云原生·容器·kubernetes