How to connect WebRTC to Zoom and make calls 2 times cheaper


    The Zoom service stormed the video conferencing industry - simply because the guys were able to offer good video quality and “always work”. The competitors both the first and second somehow did not stick. Whoever tried to make a video conference for five or more people in Skype or an analogue will understand me. The authors of the service adequately evaluate its popularity and offer “premium” opportunities not cheap: the ability to connect participants with regular phones to conferences costs from $ 100 per month . But SIP connection costs half the price. And under the cut, I want to show how to connect Voximplant to similar services so that I can receive inexpensive calls all over the world and our voice automation in a few lines of JavaScript code.

    Zoom setting


    All that needs to be done on the Zoom side is to buy integration with SIP, which is called the H.323 / SIP Room Connector and is bought at this link . We will need only one port, since all the “telephone magic” will be implemented using JavaScript on the side of Voximplant.

    Setting up Voximplant


    The idea is to create a web interface that through the HTTP API will instruct the Voximplant cloud to connect to the desired Zoom conference. And then the cloud will be able to connect participants from phones to this conference: both by calling on its own and by providing a number for the call. To make the decision even cheaper, we will use the numbers in the “sandbox” of Gotham City, which are almost like real ones, but work through additional ones.

    You can register as a Voximplant developer here , after which you have at your full disposal the manage.voximplant.com control panel , in which the further configuration steps will be carried out.

    Using the “applications” section of the top menu, create a new application and name it zoomconnector. Then, using the Scripts section, create ZoomBridge and ZoomCall-In scripts with the following source code:

    A bit of code under the spoiler


    So that conference participants can call Gotham, go to the "numbers" section, click on the "real" / "debug" switch and buy for yourself one cent a number in a non-existent city. For this example, we will use 699100266 in Gotham City. This is an extension number. To call it, you first need to call a single access number for virtual numbers (indicated in the "my numbers" section) and after a voice greeting dial this number. Also in the “my numbers” section you need to link the number and the application:


    The last thing to do is to indicate which JavaScript scripts should be executed in which situations. To do this, go to the “applications” section, select the zoomconnector application and click on “rules”. You need to create two rules. The first will execute the ZoomCall-In script on an incoming call to a virtual number, and the second will execute the ZoomBridge script to organize a conference and interact with Zoom. Note that the order in which the scripts are specified matters. More specific (for one number) should be placed higher than less specific (for all calls).

    and a few more screenshots under the spoiler



    You can call!


    Launch the Zoom application and open Zoom Meeting:


    Running Meeting has a Meeting ID that is used when connecting. The JavaScript demos you copied above allow you to connect to Zoom in two ways:

    1. The user calls the access number in Gotham City, dials the extension and gets into the ZoomCall-In script , which already synthesizes “enter the Meeting number”. The user enters the number as he entered the extension. After that, the script makes an internal call to the script of the ZoomBridge conference , which, when the call comes in for the first time, connects to Zoom and then starts mixing the participants' voices “from the phone” and transfers all this to Zoom and vice versa. The same scenario is responsible for the Voximplant cloud itself to call the specified number and add a call to the conference. Thus, you can add to the conference up to 100 (!!!) participants from phones.
    2. Voximplant Cloud can create a conference without an incoming call. To do this, you need to make a startconference HTTP request , passing the Meeting number to Zoom and application information as a parameter. The resulting JavaScript session with ZoomBridge script will establish a connection to Zoom and will wait for incoming calls or commands for an outgoing call.


    Adding Participants by Callback


    Pay attention to this code snippet in the ZoomBridge script :


    After the Voximplant cloud has launched a JavaScript session by an incoming call or by a command from the HTTP API, you can interact with this session by making HTTP requests to a special access url (the session itself, by the way, can also communicate with the outside world by doing HTTP inquiries). In our example, we use this opportunity to instruct the JavaScript session of the conference to call the specified number and add it to the conversation with Zoom Meeting:


    We get the “Access URL” for communicating with the session either by starting the session via the HTTP API (method number 2 above), or by subscribing to the Started session event and passing it to ourselves with an HTTP call from the session to our backend. In our example, the command to start the callback will look something like this:


    Also popular now: