How to setup Audio and Video calls for Ozeki Chat

In today’s interconnected world, the ability to communicate seamlessly over the internet, particularly through audio and video calls, is a must for any chat application. Ozeki Chat, like many other communication platforms, requires certain network configurations to ensure high-quality real-time communication, particularly across varied and complex network environments. This is where STUN (Session Traversal Utilities for NAT) and TURN (Traversal Using Relays around NAT) servers come into play.

What is a STUN Server?

STUN stands for Session Traversal Utilities for NAT. A STUN server allows clients behind Network Address Translators (NATs) to find out their public address, the type of NAT they are behind, and the internet-side port associated by the NAT with a particular local port. This information helps to facilitate peer-to-peer (P2P) communication between clients, which is crucial for direct audio and video call streams.

What is a TURN Server?

TURN stands for Traversal Using Relays around NAT. While STUN is effective in most situations, some strict NATs may prevent STUN from functioning correctly. In such cases, a TURN server acts as a relay to transfer data between clients. Essentially, if a direct (peer-to-peer) connection fails due to NAT or firewall restrictions, TURN servers provide an alternative path for the traffic.

Why are STUN and TURN Needed?

Both STUN and TURN are necessary to handle the variety of networks that users might connect from, including private networks behind NATs, which can block incoming connections. Without these servers, the audio and video quality of calls could deteriorate, or connections might fail entirely, leading to a poor user experience.

How to choose your STUN/TURN Servers?

You can either use public STUN/TURN servers like Google's public STUN server (stun.l.google.com:19302), or you can set up your own server. For production environments, setting up a private TURN server is recommended for better control and reliability.

Quick setup instruction for an Ubuntu TURN Server

To set up your own TURN server, you will need a dedicated server with a public IP and proper software. Coturn is a widely-used open-source server that can handle both STUN and TURN functionalities. Here’s how to set it up:

  • Install Coturn: On an Ubuntu server, you can install Coturn by running sudo apt-get install coturn.
  • Configure Coturn: You need to edit the configuration file /etc/turnserver.conf:
    • Uncomment and set listening-port to 3478 (default port for TURN).
    • Uncomment fingerprint.
    • Uncomment lt-cred-mech to use long-term credential mechanism.
    • Set use-auth-secret and generate a secret key.
    • Optionally, set realm to your domain.
    • Configure external-ip if your server is behind a NAT.
  • Run Coturn: Start the TURN server using sudo turnserver -c /etc/turnserver.conf -v.

STUN and TURN Servers for Ozeki Chat to subscribers

If you sign up for the Ozeki Chat servis using a subscription, you can use Ozeki's STUN and Ozeki's TURN service. If you setup an air gapped chat system, or you wish to rely purely on your own infrastructure, you can setup your own STUN and TURN servers. Check out the following guides, that explain how to setup STUN and TURN servers on Ubuntu Linux.

How to configure the Ozeki Chat STUN and TURN service

Navigate to the settings where you configure server connections. Enter the details of your STUN or TURN server, including the IP address, port, and any required credentials.

How to test your configuration

Finally, it's crucial to test your setup to ensure that everything is working correctly. Make test calls between different network configurations to validate that the STUN and TURN servers are effectively facilitating the calls.

By setting up STUN and TURN servers, you ensure that Ozeki Chat can deliver uninterrupted, high-quality audio and video calls across all types of network configurations, enhancing user satisfaction and communication reliability.

More information