Rate this page:

Processing calls in a scenario

This article will help you to make and receive calls in a scenario.

A scenario is the cloud part of your Voximplant application, which is responsible of making and receiving calls, and directing the calls between endpoints. Before you start writing your scenario, create an application first and create a scenario itself.

Contents

Copy URL

How to call a Voximplant user

Copy URL
How to create a user

Follow this guide to learn how to create a Voximplant user.

To call another 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 callerid parameter. See the example scenario to understand how it works:

Call a Voximplant user

Call a Voximplant user

You can make a peer-to-peer call, which connects two devices directly instead of routing through Voximplant servers. It provides better connection security and audio/video quality. To make a peer-to-peer call, use the callUserDirect method:

Peer-to-peer call

Peer-to-peer call

How to call a phone number

Copy URL
Destination restrictions

Calls that cost more than 20 cents per minute and calls to Africa are restricted for security reasons. To enable them, contact us: support@voximplant.com

To call a phone number, use the callPSTN method in your scenario. Specify the phone number you want to call to the number parameter, and the caller ID to show to the callerid parameter.

You can use the following numbers as your caller ID:

  1. A real phone number that is rented from Voximplant (you cannot use test numbers)
  2. Any phone number that is verified via an automated call from Voximplant and confirmation code
  3. A phone number from an inbound call to the rented number. You can retrieve it as Caller ID

See the example scenario to understand how it works:

Call a phone number

Call a phone number

How to call a SIP address

Copy URL

To call a SIP address, use the callSIP method in your scenario.

UDP/TCP transport

Voximplant uses UDP as the default protocol for SIP calls. If you want to use TCP protocol, specify it in the callSIP method as shown below in the code example

Call SIP

Call SIP

To enable TLS support for your SIP calls, change the sip: prefix of your address to the sips: prefix or simply specify the TLS transport type. See the code example:

Enable TLS for SIP calls

Enable TLS for SIP calls

Refer to the SIP calls article to learn more about SIP calls in Voximplant.

How to process inbound calls

Copy URL

To process inbound calls, subscribe to the CallAlerting event in the scenario. Use the call.answer method to answer the call, or the call.reject method to decline the call.

You can use the call.startEarlyMedia method to cast early media to the call before it is answered. It allows you to play music or synthesize speech such a voicemail prompt.

Early media limit

A call can be in the early media state for up to 60 seconds.

Answer a call in a scenario

Answer a call in a scenario