ZxChat with a TURN server
From ZeXtras Suite Wiki
|Language:||English • español • português|
|Available since version: 1.6.4|
|Latest Version: 1.36|
|Released on: August 18th, 2016|
- 1 How WebRTC works
- 2 ZeXtras Chat over a TURN server
- 3 Annex A: Setting up a TURN server in Ubuntu 14.04
- 4 Annex B: Setting up a TURN server in CentOS 7
How WebRTC works
WebRTC, the protocol used by ZeXtras Chat for its videochat features, is a secure and scalable API set that allows Point-to-Point videocommunication without the need of browser plugins or external connectors. While this is a great benefit both in usability and ease of use - not to mention in bandwidth usage since no traffic will go through the Zimbra server - the use of client-to-client connections is subject to some possible issues related with routing: in case the two clients can't establish a direct connection (e.g. because of MAN switching or generally in any situation where NAT traversal is blocked) there is no built-in fallback and the parties are unable to communicate.
Bypassing NAT Traversal issues using TURN
The TURN protocol (Traversal Using Relays around NAT) allows to bypass NAT Traversal limitations by having a third party server acting as a medium between the clients to properly route the connections. The downside to this is that all of the videochat traffic will go through the TURN server, with the consequent bandwidth usage. Luckily enough WebRTC automatically scales the video quality based on the connection speed, so it's possible to set up a TURN server even when sub-par bandwidth is available.
ZeXtras Chat over a TURN server
As mentioned above, a TURN server acts as a medium and takes charge of routing the connection between the clients. When a client wants to initialize a connection, a request is sent to the TURN server that allocates the required resources and acts as a relay for the connection .
In order to solve many possible connection-related issues of te WebRTC protocol, TURN compatibility has been added to the ZeXtras Chat Zimlet starting from version 1.35. Thanks to this, you can set up the ZeXtras Chat Zimlet to use a TURN server for all Videochat features.
Setting up ZxChat to use a TURN server
- ZeXtras Suite 2.2.0+
- ZeXtras Chat Zimlet 1.35+
- A working TURN server.
TURN settings in ZeXtras Chat is part of the Zimlet's internal configuration, and it's not available via GUI or CLI. The only required settings are:
- TURN server address
- TURN server username
- TURN server password
Setting up TURN
Setting up ZeXtras Chat Zimlet for TURN is pretty easy:
- Switch to the "zimbra" user
su - zimbra
- Copy the /opt/zimbra/zimlets-deployed/com_zextras_chat/config_template.xml file to /tmp/ and open it with your editor of choice
SAMPLE: zimletConfig name="com_zextras_chat" version="1.36"> <global> <property name="turnUrl"/> <property name="turnCredential"/> <property name="turnUsername"/> </global> </zimletConfig>
- Remove the closing / from the three "property" entries and add your server's information followed by the closing </property> tag
SAMPLE: zimletConfig name="com_zextras_chat" version="1.36"> <global> <property name="turnUrl">turn:turn.mydomain.com:3478</property> <property name="turnCredential">password</property> <property name="turnUsername">username</property> </global> </zimletConfig>
- Save the edited file and run the following command to apply the new config:
zmzimletctl configure /tmp/config_template.xml
- Flush the zimlet's cache and you are good to go!
zmprov fc zimlet com_zextras_chat
Annex A: Setting up a TURN server in Ubuntu 14.04
A step by step guide on how to set up a TURN server on Ubuntu 14.04 can be found here.
Annex B: Setting up a TURN server in CentOS 7
A step by step guide on how to set up a TURN server on CentOS 7 can be found here