Handle an Incoming Voice Call

Inbound voice calls are processed through preconfigured webhook URLs so that appropriate actions can be taken on these calls such as accept the call, play tones or voice prompts, or make onward calls to a bridge. For inbound voice calls, the Inbound Voice service must be configured for your project through the EnableX portal.

Configure Inbound Voice Call Settings

  • To set up the Inbound Voice service, you need a phone number to receive calls.
  • You can optionally configure a voice prompt for the calls. If the voice prompt is not configured, the default prompt is played. You also need a webhook to process the calls.

Handle Inbound Voice Call Events

An inbound voice call requires you to configure a webhook URL and prompt/text to get the event notification and play the prompt/text. EnableX provides a set of predefined prompts that can be readily used. If you want to use a custom prompt, upload the prompt in MP3 or WAV file format for your voice project on the EnableX portal.

The occurrence of an incoming call triggers the following events via the webhook:

  • The webhook event provides an auto-generated voice_Id that is a unique identifier for the voice call and is referenced to execute any subsequent APIs on the voice call such as accept call, hold call, disconnect call, and so on.
  • The user application can either accept the incoming call by calling related APIs.

Below is a sample of the webhook notification triggered by the voice server for an incoming call.

{
voice_id : // Unique Voice ID generated by the voice server for each Call
state : "incoming call"
from : // Calling Number
to : // EnableX CLI
channel_id : // Call Leg Channel ID
timestamp : 2021-02-18T12:47-00Z
}

Accept Call API Request

Accept incoming call by calling Accept API.

PUT https://api.enablex.io/voice/v1/call/$voiceid/accept
Authorization: Basic XXXXXX
Content-Type: application/json