Rate this page:

In-app calls

This article explains how to make in-app calls, including peer-to-peer and video calls.

Create an application and a user

Before you call a user, you need to create an application and a user first.

To create an application, go to the Voximplant control panel and log into your account or create a new one. Then choose the application section from the menu in the upper left corner and click New application in the upper right corner or Create at the bottom of page:

Create an app

This opens a New application editor window where you can set it up and save by clicking Create.

After that, you need to create a user. Go to the Applications section and choose the necessary application. Then go to the Users section and click the Create a user button in the upper right corner (or in the middle of the screen if your app has no users):

Create a user

Specify the username, password and display name for your new user, and click Create.

Create a scenario

A scenario is a JavaScript document where you execute all your application logic. See this article for more information about scenarios.

Open your application, select Scenarios on the left menu, and click on the plus icon and give your scenario a name:

Create a scenario

This opens a new tab in the online IDE on the right. This is where you write your code. If needed, you can rename the scenario or change the source code later.

How to call a Voximplant user

To call a Voximplant user, use the callUser method in your scenario.

Specify the user you want to call in the username parameter and the CallerID you want to show to the user in the callerid parameter.

VoxEngine scenario

VoxEngine scenario

How to make a peer-to-peer call

Peer-to-peer calls connect users directly, avoiding Voximplant servers. It provides better security and call quality, but less stability, because the call depends on the user's hardware and internet connection only.

To make a peer-to-peer call, use the callUserDirect method:

Peer-to-peer call example

Peer-to-peer call example

How to enable video

To enable the video support, set the video parameter of the callUser method to true.

To process incoming calls with video, you need the scheme parameter with the codecs information the AppEvents.CallAlerting event. Pass the retrieved scheme to the Call.answer method to handle calls properly:

Enable video call support

Enable video call support

How to answer calls

Subscribe to the CallAlerting event in your scenario to receive calls. Use the Call.Answer to answer the call or implement other logic in the event handler:

Receive a call

Receive a call

When the connection is established, you will hear a synthesized voice that reads the text.

See also