FreeSWITCH 启用多域(多租户)的配置

如果将FreeSWITCH用于云端, 支持大规模并发呼叫, 就要用到 多域/多租户 技术了, FreeSWITCH 本身可以直接支持.

每个域可以单独, 拥有相同的分机号也互相打不通, 各自线路, IVR , 路由等不相同.

配置方式如下:

1. conf/vars.xml

<X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}" />
<X-PRE-PROCESS cmd="set" data="domain_name=$${domain}" />

这里配置了 默认 domain(名字), 启用域(多租户)之后就没什么用啦.

2. conf/sip_profile/internal.xml

<!--all inbound reg will look in this domain for the users -->
<param name="force-register-domain" value="$${domain}"/>
<!--force the domain in subscriptions to this value -->
<param name="force-subscription-domain" value="$${domain}"/>
<!--all inbound reg will stored in the db using this domain -->
<param name="force-register-db-domain" value="$${domain}"/>

三个 强制参数, 注释掉, 重启该 profile.

<可以建立多个 profile>

3. conf/directory/default.xml

<include>
    <!--the domain or ip (the right hand side of the @ in the addr-->
    <domain name="$${domain}">

这个 domain 指定了 此用户目录配置适用于哪个 domain(名字) (默认$${domain}是vars.xml中配置的)

可以建立多个 domain 的配置(如 复制多份,每份各自配置domain_name),
这样 就有了多个域了(name 配置成指定的 domain_name)
多个域,最好每个域都有各自的用户目录及用户配置(主要是有各自的用户配置)
相应的,用户配置的加载也要改:

<users>
    <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
</users>

<另,要让各自域中的用户使用(各自)单独的 Dialplan 进行路由,还要改用户配置中的 user_context 参数>

4. conf/directory/default/<user>.xml

要让各自域中的用户使用(各自)单独的 Dialplan 进行路由,还要改用户配置中的 user_context 参数

<variables>
    <variable name="user_context" value="default"/>

<这时候,就要相应的 增加 路由了, 否则没有路由, 也是打不通的>

5. conf/dialplan/default.xml

<include>
    <context name="default">

复制这个dialplan,并更改 context_name , 与用户配置中设置的相对应

6. reloadxml, 注册,拨打测试

7. 启用域之后, 拨打就不能在使用了 `user/1000` 这样的缩写形式了,

必须使用完整形式: `user/1000@${domain_name}`
在使用 会议, fifo 等应用时,也要写完整形式,
即: 启用域(多租户)之后,拨打用户就要写完整(带域名)的了,不然就找不到用户了

8. 还可以将不同的域(租户)分到不同的 Sofia Profile 中,可以使不同的 profile 使用不同的端口了

使用端口注意:

不同的profile 要额外注意 ws 的端口, 否则可能 造成 profile启动失败, 但是 莫名其妙的不知道 为嘛失败(sip端口没有占用啊.呵呵)

    <!-- for sip over websocket support -->
    <param name="ws-binding"  value=":5066"/>

    <!-- for sip over secure websocket support -->
    <!-- You need wss.pem in $${certs_dir} for wss or one will be created for you -->
    <param name="wss-binding" value=":7443"/>

 



如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。 原文链接:https://www.cnblogs.com/lzpong/p/8573372.html
posted @   _Ong  阅读(5709)  评论(3编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示