Contact and Presence Sharing

Wazo allow the administrator to share presence and statuses between multiple installations. For example, an enterprise could have a Wazo in each office and still be able to search, contact and view the statuses of colleagues in other offices.

This page will describe the steps that are required to configure such use case.

../_images/presence_sharing_diagram.png

Prerequisite

  1. All Wazo that you interconnect should be on the same version
  2. All ports necessary for communication should be open Network

Warning

If you are cloning a virtual machine or copy the database, the UUID of the two Wazo will be the same, you must regenerate them in the infos table of the asterisk database and restart all services. You must also remove all consul data that included the old UUID.

Warning

Telephony will be interrupted during the configuration period.

Warning

The configuration must be applied to each Wazo you want to interconnect. For example, if 6 different Wazo are to be connected, the configuration for all other Wazo should be added. This does not apply to the message bus which can use a ring policy, each Wazo talking to its two neighbours.

Warning

You should use your firewall to restrict access to the HTTP ports of consul and xivo-ctid, because they don’t have any authentication mechanism enabled.

Note

In an architecture with a lot of Wazo, we recommend that you centralize some services, such as xivo-dird, to make your life easier. Don’t forget redundancy. This applies also to RabbitMQ and Consul. In this case, the configuration will have to be done entirely manually in YAML config files.

For this procedure, the following name and IP addresses will be used:

  • Wazo 1: 192.168.1.124
  • Wazo 2: 192.168.1.125

Add a Web Service User

The first thing to do is to create a new web service access to be able to search users and get there presences using the following ACL.

  • ctid-ng.lines.*.presences.read
  • ctid-ng.users.*.presences.read
  • confd.users.read

This can be done in Configuration ‣ Management ‣ Web Services Access

../_images/create_user_ws.png
../_images/create_user_ws_acl.png

Configuring the directories

Add New Directory Sources for Remote Wazo

For each remote Wazo a new directory has to be created in Configuration ‣ Management ‣ Directories

Note

We recommend doing a working configuration without certificate verification first. Once you get it working, enable certificate verification.

../_images/list_directory.png
../_images/create_directory.png

Add a Directory Definition for Each New Directories

To add a new directory definition, go to Services ‣ CTI Server ‣ Directories ‣ Definitions

../_images/list_definition.png

In each directory definition, add the fields to match the configured Display filters

../_images/create_definition.png

Add the New Definitions to Your Dird Profiles

At the moment of this writing xivo-dird profiles are mapped directly to the user’s profile. For each internal context where you want to be able to see user’s from other Wazo, add the new directory definitions in Services ‣ CTI Server ‣ Directories ‣ Direct directories.

../_images/list_direct_directories.png
../_images/create_direct_directories.png

Restart xivo-dird

To apply the new directory configuration, you can either restart from:

  • Services ‣ IPBX
  • on the command line service xivo-dird restart

Check that the Configuration is Working

At this point, you should be able to search for users on other Wazo from the People Xlet.

Configuring RabbitMQ

Create a RabbitMQ user

rabbitmqctl add_user xivo xivo
rabbitmqctl set_user_tags xivo administrator
rabbitmqctl set_permissions -p / xivo ".*" ".*" ".*"
rabbitmq-plugins enable rabbitmq_federation

Restart RabbitMQ

systemctl restart rabbitmq-server

Setup Message Federation

rabbitmqctl set_parameter federation-upstream xivo-dev-2 '{"uri":"amqp://xivo:xivo@192.168.1.125","max-hops":1}'  # remote IP address
rabbitmqctl set_policy federate-xivo 'xivo' '{"federation-upstream-set":"all"}' --priority 1 --apply-to exchanges

Check That Service Discovery is Working

apt-get install consul-cli
consul-cli agent services --ssl --ssl-verify=false

The output should include a service names xivo-ctid with an address that is reachable from other XiVO.

{"consul": {"ID": "consul",
            "Service": "consul",
            "Tags": [],
            "Port": 8300,
            "Address": ""},
 "e546a652-e290-47e2-8519-ec3642daa6e6": {"ID": "e546a652-e290-47e2-8519-ec3642daa6e6",
                                          "Service": "xivo-ctid",
                                          "Tags": ["xivo-ctid",
                                                   "607796fc-24e2-4e26-8009-cbb48a205512"],
                                          "Port": 9495,
                                          "Address": "192.168.1.124"}}

Configure Ctid-ng

Add a configuration file on ctid-ng conf.d directory named discovery.yml with your configuration.

The service_id and service_key are the ones you defined earlier in the web interface.

remote_credentials:
  xivo-2:
    xivo_uuid: 1cc7fbf2-5f13-4898-9869-986990cb9b0a
    service_id: remote-directory
    service_key: supersecret

To get the xivo_uuid information on your second Wazo, use the command:

echo $XIVO_UUID

Restart xivo-ctid-ng

systemctl restart xivo-ctid-ng

Configure Consul

Stop Wazo

xivo-service stop

Remove All Consul Data

rm -rf /var/lib/consul/raft/
rm -rf /var/lib/consul/serf/
rm -rf /var/lib/consul/services/
rm -rf /var/lib/consul/tmp/
rm -rf /var/lib/consul/checks/

Configure Consul to be Reachable from Other Wazo

Add a new configuration file /etc/consul/xivo/interconnection.json with the following content where advertise_addr is reachable from other Wazo.

{
"client_addr": "0.0.0.0",
"bind_addr": "0.0.0.0",
"advertise_addr": "192.168.1.124"  // The IP address of this Wazo, reachable from outside
}

Check that the Configuration is Valid

consul configtest --config-dir /etc/consul/xivo/

No output means that the configuration is valid.

Start Consul

systemctl start consul

Start Wazo

xivo-service start

Join the Consul Cluster

Join another member of the Consul cluster. Only one join is required as members will be propagated.

consul join -wan 192.168.1.125

Check that Consul Sees other Consul

List other members of the cluster with the following command

consul members -wan

Check consul logs for problems

consul monitor

Check That Everything is Working

There is no further configuration needed, you should now be able to connect your XiVO Client and search contacts from the People Xlet. When looking up contacts of another Wazo, you should see their phone status, their user availability, and agent status dynamically.

Troubleshooting

Chances are that everything won’t work the first time, here are some interesting commands to help you debug the problem.

tail -f /var/log/xivo-dird.log
tail -f /var/log/xivo-ctid-ng.log
tail -f /var/log/xivo-confd.log
consul monitor
consul members -wan
consul-cli agent services --ssl --ssl-verify=false
rabbitmqctl eval 'rabbit_federation_status:status().'

What’s next?

One you get this part working, check out Phonebook Sharing.