Rate this page:

Processing voice calls in SDKs

This article will help you to make and receive calls on your web or mobile application.

Before you implement calling functionality in your web or mobile application, you need to create your application, import our SDK, connect to Voximplant, and log in with your user. See this guide to learn how to do this.

Contents

Copy URL

How to make a voice call

Copy URL

In your application, prepare the call settings before you make a call. Then use the call method to make a call from the application to the scenario.

Specify the destination you want to call to the first parameter of the call method. This can be either a user, phone number, or sip address.

Call a user from an application

Call a user from an application

After you start a call in your mobile or web application, you receive this call in the platform. Create a proper routing rule to match the destination in the first parameter of the call method in your SDK.

In the scenario, depending on your destination (a user/phone number/sip), call one of the methods described in this article to create a proper call. You can retrieve your call destination value from the e.destination property. Then unite the application call and the scenario call via the easyProcess method.

Scenario example

Scenario example

Call legs

Please note, that if you are making a call via web or mobile SDK, it consists of two call legs: SDK → scenario and scenario → destination. In this case, the SDK → scenario call leg is considered an incoming call in the scenario, so you need to process it via the CallAlerting event as well. Read the How to process calls in a scenario article to learn more about processing incoming and outgoing calls in scenarios.

Use the hangup method in your application to end the call.

How to process an incoming call

Copy URL

All the incoming calls in Voximplant are processed by routing rules. Before you process an incoming call, create a routing rule and set it up for your specific scenario. Follow this guide to learn how to do this.

To make calls into an application, you need to call a user that is currently logged into the application.

Then, in the application, subscribe to the IncomingCall event, and use the call.answer event to answer a call or the call.decline event to decline a call.

Refer to the API Reference of your platform to find information about the methods. Here is a code example of how to answer and decline a call in a Web/iOS/Android application:

Answer a call in an application

Answer a call in an application

Frequently asked questions

Copy URL

Q: What happens if I close the app on iOS/Android during an active call?
A: On iOS, if you want a call to continue while the app is in the background mode, you need to specify the background modes while creating the app. When you close the app by swiping it from the app manager, the app coses and the access to camera and microphone terminates. The call will end by the timeout (30 sec) on the Voximplant Cloud side. You can specify to hangup the call at app closing in the AppDelegate, then closing the app leads to immediate call termination.
On Android, if you want a call to continue while the app is in the background mode, you need to specify the foreground mode as it is shown in this demo. With the foreground mode, when the call starts, a notification about an active call appears. Then, even if you close the app by swiping it from the app manager, the call remains active because the foreground service still executes the part of the application.

Q: I want to make a button for my website that accepts some data, like phone number and customer name, and makes a call. How can I implement this?
A: You can implement it manually from scratch using our Web SDK or use our ready-to-use Click-to-call widget for websites.

Q: Can I call stationary or mobile numbers without a caller ID?
A: No, you cannot. You need a caller ID to make calls to phone numbers. You can use your own phone number, but this feature has limitations, for example, you cannot use Russian mobile numbers. If you rent a phone number from Voximplant, there are no limitations.

Q: I want to integrate VoIP calls into my existing application to make user-to-user calls. I have thousands of users, do they need to be registered as Voximplant users? How do I authorize the users?
A: The VoIP calls are available only between registered users. If you have large numbers of users, you can use the Management API's AddUser method to register users on our platform. You can use the one-time key for your user authorization and then use the callUser or callUserDirect to make calls.

Download our demos

Copy URL

Here you can download our voice calls demos for multiple platforms for your instance: