How to deploy a video contact center with TrueConf Server API

Dimitry Zuykov
May 12, 2020
Dimitry Zuykov
You can get acquainted with the example of HTML website and the described algorithm on GitHub.

TrueConf doesn’t only provide you with a comfortable and scalable video conferencing system, but also enables you to expand its range with the help of TrueConf Server API.

This article covers the detailed algorithm of video contact center deployment based on TrueConf Server. The main idea is to connect a website guest and an available operator in a private video conference. This method uses WebRTC technology.


The given algorithm and code example is not intended for use in an operational environment. Being deliberately simple, this example is tailored to be used without installing additional software so you can get easily acquainted with TrueConf Server API.

Both users of TrueConf Server and TrueConf Server Free can check the working capacity of the described scheme.

As TrueConf Server Free allows only one simultaneous video conference, we do not recommend using it as a full-fledged platform for the video contact center deployment.

Pre-configuring TrueConf Server

  1. Create a separate group named Operators in TrueConf Server control panel and add users who will accept calls.
  2. Configure the HTTPS connection for using WebRTC widget and performing TrueConf Server API requests.

Requests to the TrueConf Server API are used to perform the actions described in the algorithm.

Step 1. Obtaining the list of operators

Obtain the list of all users in the Operators group. It is better to do this at each iteration of the algorithm, so you will not miss the moment of adding a new operator to the group.

Step 2. Selecting an available operator

  1. Create the list of online operators (objects ObjectUser in the list will have status = 1).
  2. Randomly choose one operator from the list. TrueConf ID of the selected user must differ from the one you specified in step 5 in the previous iteration.
  3. If there is no available operator, return to step 1 after a short period of time (for example, 10 seconds).
  4. Repeat attempts to find an available operator the required number of times (e.g. 3 times) or within a specified period of time (e.g. 30 seconds).

Step 3. Creating a conference

Create a new conference with the following parameters:

Step 4. Starting a conference

After you’ve created the conference, start it. Operator will automatically receive an invitation as a participant.

Step 5. Checking the operator’s status

Some time after the conference starts (e.g., 10 seconds), check whether the selected operator is connected to the conference. If the operator didn’t accept the call, complete the following steps:

  1. Write the operator’s TrueConf ID.
  2. Stop the conference.
  3. Delete the conference.
  4. Return to the step 1.

Step 6. Obtaining the guest link

Obtain the guest link for the created conference from the client applications list to connect via WebRTC widget.

Step 7. Embedding the widget on the website

Create a widget to embed it on the website in a form of HTML element <iframe> by setting the guest link as a path for downloading content.

Step 8. Ending the call

You can track the ending of a call with the help of postMessage technology (widget will send the connectionClosed message). When the call ends, do the following steps:

  1. Delete the embedded widget.
  2. Stop the video conference.
  3. Delete the video conference from the server.

Additional settings

If necessary, you can forbid the guests to use some features of WebRTC client (e.g. content sharing).

To save the history of communication between operators and customers, you can set up automatic recording of video calls.

Still have questions? Please contact our support team directly via online chat.