Making outbound calls from the cloud

Voximplant supports calls from any endpoint to the cloud and from the cloud to any endpoint. This way, a traditional phone-to-phone call is split into two "call legs": from the first phone (or SDK) to the Voximplant cloud and from the Voximplant cloud to the second phone (or SDK), with the audio streams from both calls connected to each other via a cloud-based JavaScript code. This quickstart step demonstrates a simple one-leg case where the Voximplant cloud calls a phone number and then generates an audio stream toward the phone via the built-in "text-to-speech" feature.
Modify your cloud-side JavaScript scenario created in the previous quickstart step so that it will initiate an outgoing call to your phone number and synthesize speech. Use the call log for debugging.
While technically no source phone is involved in calling a target phone number from the cloud, some phone number should be displayed to the callee so that a person can call back. You can specify a number rented from Voximplant or any number you own if you confirm it in the Voximplant control panel.
VoxEngine.addEventListener(AppEvents.Started, (e) => {
  const numberToCall = "+12345678"; // change this
  const confirmedCallerId = "+76543210"; // and this
  const out = VoxEngine.callPSTN(numberToCall, confirmedCallerId);
  out.addEventListener(CallEvents.Connected, () => {
    out.say("hello from the cloud", Language.US_ENGLISH_FEMALE);
  out.addEventListener(CallEvents.Disconnected, VoxEngine.terminate);

To start the cloud-side JavaScript code, open the applications control panel section, click the Application, then Rules, and click Start scenario:

The "Execute Scenarios" windows will be displayed there you can specify a custom data to the scenario (the custom data can also be sent via the HTTP API as demonstrated in the next quickstart step). 

Click the run button to start the scenario.

After some time a call will land on the phone number specified in the JavaScript code. Answer the call and you will hear a synthesized voice from the Voximplant cloud. In case of errors, check the Voximplant JavaScript session log for details.

Next: Using HTTP API to make calls