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

若是将FreeSWITCH用于云端, 支持大规模并发呼叫, 就要用到 多域/多租户 技术了, FreeSWITCH 自己能够直接支持.并发

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

配置方式以下:ide

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

<能够创建多个 profile>spa

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中配置的)code

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

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

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

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

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

<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 使用不一样的端口了

相关文章
相关标签/搜索