Context separation

Without context separation, you only need one contact source for all the users of your XiVO.

However, if you need context separation, each context is considered as a separate independant source of contacts, each with a different context filter. For this, you need:

  • one contact source per context (a file in /etc/xivo-dird/sources.d), so that we have a source containing only the contacts from one context
  • one profile per context (equivalent to Services ‣ CTI Server ‣ Directories ‣ Direct directories) so that users in one context only see people from the same context.

Each source should look like this one, e.g. the context is named INSIDE:

confd_config:
  host: localhost
  https: false
  port: 9487
  timeout: 4
  verify_certificate: false
  version: '1.1'
first_matched_columns: [exten]
format_columns:
  directory: "R\xE9pertoire XiVO Interne"
  location: '{description}'
  mobile: '{mobile_phone_number}'
  name: '{firstname} {lastname}'
  number: '{exten}'
  sda: '{userfield}'
  voicemail: '{voicemail_number}'
searched_columns: [firstname, lastname, userfield, description]
type: xivo
unique_column: id
name: internal_INSIDE  # <--- each source has a different name, one per context
extra_search_params:
  context: INSIDE      # <--- each source filters users according to one context

The parameters in this file have the same effect than Configuration ‣ Directories and Services ‣ CTI Server ‣ Directories ‣ Direct directories put together.

You may generate these config files from xivo-confgen dird/sources.yml. Be sure to have name and extra_search_params correct for each source file.

Now that we have our contact sources, we need our search profiles.

Create a new file to override the profiles generated by xivo-confgen. You only need one file, which will define all your profiles at once.

xivo-confgen dird/services.yml >> /etc/xivo-dird/conf.d/001-context-separation.yml

In this file, there is a list of services (favorites, lookup, ...) where each profile has a set of sources. You need to match one profile to the right internal source for each service. For example, to have context separation between contexts INSIDE and INDOORS:

services:
  favorites:
    __default_phone:
      sources: [xivodir, internal, ldaptest, personal]
    __switchboard_directory:
      sources: [xivodir, ldaptest, personal]
    INSIDE:
      sources: [xivodir, internal_INSIDE, ldaptest, personal]   # <--- profile INSIDE uses the source internal_INSIDE
    INDOORS:
      sources: [xivodir, internal_INDOORS, ldaptest, personal]  # <--- profile INDOORS uses the source internal_INDOORS
  lookup:
    __default_phone:
      sources: [xivodir, internal, ldaptest, personal]
    __switchboard_directory:
      sources: [xivodir, ldaptest, personal]
    INSIDE:
      sources: [xivodir, internal_INSIDE, ldaptest, personal]   # <--- same HERE
    INDOORS:
      sources: [xivodir, internal_INDOORS, ldaptest, personal]  # <--- and HERE