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"/>

 

posted @ 2018-03-15 14:19  _Ong  阅读(5412)  评论(3编辑  收藏  举报