Difference between revisions of "Multi-Tenant"

From FusionPBX
Jump to: navigation, search
(Advanced -> SIP Profiles -> Internal)
(Other)
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Mutli-tenant is done using Fully Qualified domain names (FQDN). Often sub-domains are used. The domains help separate the information between tenants. The domains need to be pointed to the FusionPBX server.
+
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.
  
 
==Advanced -> System Settings==
 
==Advanced -> System Settings==
To setup multi-tenant all domains under advanced -> system settings need to use the following convention.
+
To setup multi-tenant in FusionPBX 3.x or higher add more than one domain under advanced -> domains. Choose a domain name that you are not planning on changing. It is possible to change a domain name but requires the domain to be changed in several places. After adding the second domain restart the internal sip profile this can be done at Status -> SIP Status then restart the Internal SIP Profile.
  
The paths below assumes that the FreeSWITCH conf directory is installed to /usr/local/freeswitch/conf/
+
==Alias==
 +
When adding a new tenant the domain alias will not show up until an extension has been added to the tenant and the internal sip profile has been rescanned or restarted. The alias can be viewed in Status -> SIP Status.
  
'''Set the paths'''
 
  
Extensions Directory:
+
This is done automatically for new domains.
/usr/local/freeswitch/conf/directory/example1.domain.com
 
  
Dialplan Public Directory:
+
XML Editor -> directory -> default.xml
/usr/local/freeswitch/conf/dialplan/example1.domain.com
+
(a.k.a. /usr/local/freeswitch/conf/directory/default.xml)
 +
Change the following from...
 +
<pre>
 +
<include>
 +
<!--the domain or ip (the right hand side of the @ in the addr-->
 +
<domain name="$${domain}">
 +
</pre>
  
Recordings Directory:
+
to...
/usr/local/freeswitch/recordings/example1.domain.com
 
  
==Advanced -> SIP Profiles -> Internal==
+
<pre>
Edit the internal.xml file and comment out &lt;!-- and --&gt; for the following 3 entries.
+
<include>
 +
<!--the domain or ip (the right hand side of the @ in the addr-->
 +
<domain name="<IP>">
 +
</pre>
 +
Where <IP> is the public, private IP or domain of your FreeSWITCH/FusionPBX install.
  
Original looks like this.
+
==User Manager==
&lt;!--all inbound reg will look in this domain for the users --&gt;
+
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.
<param name="force-register-domain" value="$${domain}"/&gt;
 
&lt;!--force the domain in subscriptions to this value --&gt;
 
<param name="force-subscription-domain" value="$${domain}"/&gt;
 
&lt;!--all inbound reg will stored in the db using this domain --&gt;
 
<param name="force-register-db-domain" value="$${domain}"/&gt;
 
  
Changed to look like this:
+
==Convert Old Systems==
&lt;!--all inbound reg will look in this domain for the users --&gt;
+
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.
&lt;!--<param name="force-register-domain" value="$${domain}"/>--&gt;
+
 
&lt;!--force the domain in subscriptions to this value --&gt;
+
* Each extension needs to be changed to use the correct domain name
&lt;!--<param name="force-subscription-domain" value="$${domain}"/>--&gt;
+
* Each dialplan entry will have to have its context adjusted to use the correct domain name.
&lt;!--all inbound reg will stored in the db using this domain --&gt;
+
* Need to re-save gateways so that they use the new domain. You may need to manually remove the gateway xml files.
&lt;!--<param name="force-register-db-domain" value="$${domain}"/>--&gt;
+
* On old system you have to either add some additional variables or rebuild your inbound and outbound routes
 +
 
 +
==Other==
 +
If transfering calls (blind) aren't working for you...
  
==System -> Variables==
+
to top of: conf/dialplan/domain.example.com.xml
Disable the domain variable so that it is not applied system wide.
+
<pre>
 +
<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 -->
  
==Convert Old Systems==
+
      <condition field="destination_number" expression="^.*$">
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.
+
        <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>
 +
</pre>
 +
 
 +
ABOVE fixes for all calls generated internally, for inbound calls we need to fix the public profile:
 +
 
 +
Change in conf/dialplan/public.xml:
 +
<pre>
 +
    <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>
 +
</pre>
 +
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. For *3000 add something like this to public.xml
 +
 
 +
<pre>
 +
    <extension name="public_extensions_conf">
 +
      <condition field="destination_number" expression="^^(\*300[0-9])$">
 +
        <action application="info"/>
 +
        <action application="transfer" data="$1 XML ${domain_name}"/>
 +
      </condition>
 +
    </extension>
 +
 
 +
</pre>
  
*The context for each extension needs to be changed to the domain name
+
If you changed your extensions from the default 1000-1019, you will need to edit these as well.
*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.
 

Latest revision as of 15:57, 15 October 2012

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.

Advanced -> System Settings

To setup multi-tenant in FusionPBX 3.x or higher add more than one domain under advanced -> domains. Choose a domain name that you are not planning on changing. It is possible to change a domain name but requires the domain to be changed in several places. After adding the second domain restart the internal sip profile this can be done at Status -> SIP Status then restart the Internal SIP Profile.

Alias

When adding a new tenant the domain alias will not show up until an extension has been added to the tenant and the internal sip profile has been rescanned or restarted. The alias can be viewed in Status -> SIP Status.


This is done automatically for new domains.

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, private IP or domain of your FreeSWITCH/FusionPBX install.

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.

  • Each extension needs to be changed to use the correct domain name
  • Each dialplan entry will have to have its context adjusted to use the correct domain name.
  • Need to re-save gateways so that they use the new domain. You may need to manually remove the gateway xml files.
  • On old system you have to either add some additional variables or rebuild your inbound and outbound routes

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. For *3000 add something like this to public.xml

    <extension name="public_extensions_conf">
      <condition field="destination_number" expression="^^(\*300[0-9])$">
        <action application="info"/>
        <action application="transfer" data="$1 XML ${domain_name}"/>
      </condition>
    </extension>

If you changed your extensions from the default 1000-1019, you will need to edit these as well.