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.
How to call a Voximplant 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:
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:
How to call a phone number
Calls that cost more than 20 cents per minute and calls to Africa are restricted for security reasons. To enable them, contact us: firstname.lastname@example.org
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:
- A real phone number that is rented from Voximplant (you cannot use test numbers)
- Any phone number that is verified via an automated call from Voximplant and confirmation code
- 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:
How to call a SIP address
To call a SIP address, use the callSIP method in your scenario.
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
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:
Refer to the SIP calls article to learn more about SIP calls in Voximplant.
How to process inbound calls
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.
A call can be in the early media state for up to 60 seconds.