Multi-Tenant
Mutli-tenant is done using Fully Qualified domain names (FQDN). They can be full domains or sub-domains are used. The domains separate the information between tenants. The domains need to be pointed to the FusionPBX server.
Contents
Advanced -> System Settings
To setup multi-tenant all domains under advanced -> system settings need to add the domain to the following paths.
The paths below assumes that the FreeSWITCH conf directory is installed to /usr/local/freeswitch/conf/
Extensions Directory::
/usr/local/freeswitch/conf/directory/tenant1.example.com
Dialplan Default Directory:
/usr/local/freeswitch/conf/dialplan/tenant1.example.com
Dialplan Public Directory:
/usr/local/freeswitch/conf/dialplan/public/tenant1.example.com
Recordings Directory:
/usr/local/freeswitch/recordings/tenant1.example.com
XML Editor -> directory -> default.xml
(a.k.a. /usr/local/freeswitch/conf/directory/default.xml) Change the following from...
<include> <!--the domain or ip (the right hand side of the @ in the addr--> <domain name="$${domain}">
to...
<include> <!--the domain or ip (the right hand side of the @ in the addr--> <domain name="<IP>">
where <IP> is the public or private IP of your FreeSWITCH/FusionPBX install.
Advanced -> SIP Profiles -> Internal
Edit the internal.xml file and comment out <!-- and --> for the following 3 entries.
Original looks like this.
<!--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}"/>
Modified to look like this:
<!--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}"/>-->
System -> Variables
Disable the domain variable so that it is not applied system wide.
User Manager
Accounts -> User Manager when adding a user you have the domain select option that assigns the user to the domain. Tenant admin's highest level of access should not exceed the 'admin' group. Users in the 'superadmin' group are able to view and manage all tenants.
Convert Old Systems
The easiest way to get started with multi-tenant is to begin using it before configuring the system. However if you find that you need to switch an existing system to multi-tenant you will need to do the following.
- The context for each extension needs to be changed to the domain name
- On old system you have to either add some additional variables or recreate your inbound and outbound routes
- Need to re-save gateways so that they use the new domain. You may need to manually remove the gateway xml files.
Other
If transfering calls (blind) aren't working for you...
to top of: conf/dialplan/domain.example.com.xml
<include> <context name="domain.example.com.xml"> <extension name="setdomain" continue="true"> <!-- The channel variable isn't passing on calls Not sure why, but this is a workaround --> <condition field="destination_number" expression="^.*$"> <action application="info"/> <action application="set" data="domain=domain.example.com.xml"/> <action application="set" data="domain_name=${domain}"/> <action application="log" data="INFO NOW WE HAVE SET domain_name"/> <action application="info"/> </condition> </extension>
ABOVE fixes for all calls generated internally, for inbound calls we need to fix the public profile:
Change in conf/dialplan/public.xml:
<extension name="public_extensions"> <condition field="destination_number" expression="^(10[01][0-9])$"> <action application="info"/> <!-- <action application="transfer" data="$1 XML default"/> changed to get inbound calls to transfer properly--> <action application="transfer" data="$1 XML ${domain_name}"/> </condition> </extension>
You still cannot transfer to internal conferences (*3000). Probably need to set something up under conf/diaplan/public/domain.example.com/internal_conferences.xml or some such.
Otherwise, just use a conference that you did set up through apps->Conferences, and add it to the inbound routes page... could also add a *3000 whatever route there too.
If you changed your extensions from the default 1000-1019, you will need to edit these as well.