Voice APIs & SDKs

📘

Note

Please check [Countries supported in Sandbox] (https://developers.imiconnect.io/reference/sms-and-voice-support-in-sandbox) for the complete list of supported countries.

With Webex Connect’s Voice API, you can build custom voice calling applications that connect to our voice network using an HTTPS-based interface. Seamlessly embed inbound and outbound voice capabilities with a set of well-defined APIs.

You can develop voice-enabled applications by sending and receiving HTTPS requests. When an incoming call is received on a phone number associated with our Voice API platform, your application is notified via a webhook event. You can then respond with actions to control the call and launch features, such as:

  • Answer
  • Play
  • Collect Input (includes DTMF and speech)
  • Record
  • Call Patch

Creating a Phone Call

To create an outbound call from a Webex Connect number, make a POST request to the [API v1 Make call endpoint] (https://imiconnect-apis-group.readme.io/reference/post_v1-voice-calls-3). After this call is answered by the user, Webex Connect sends an event to your callback URL (provided in your request). Your application must then respond with one of the following actions to continue the call:

  • Play
  • Record
  • Call Patch
  • Hangup

Receiving a Phone Call

To handle incoming calls via APIs, configure the callback URL in the numbers section of Webex Connect. When an incoming call is received, Webex Connect sends a notification to your callback URL with the caller and dialed number information. Your application should then respond with one of the following actions to continue the call:

  • Answer
  • Play
  • Record
  • Call Patch
  • Hangup

📘

Note:

The Answer action is only supported for inbound use cases and must be sent in response to the Accept event.

Events

Event NameDescription
AcceptedSent when an incoming call is received on the configured TFN number. Respond with Answer or Hangup action.
AnsweredSent when the call is answered. Respond with any media action or Hangup action
DroppedSent when the call is disconnected or dropped.
PlayedSent when a play action has completed for a call.
StreamedSent when ASR (Automatic Speech Recognition) completes and a stream-to-text response is available
RecordedSent when a record action has completed.
FailureSent when an action fails. Includes event name, status as failure, and failure reason.
PatchedSent when a call patch (trombone call) is connected.
Collected DigitsSent when multiple DTMF digits are received from the user during a call.
{
  "event": "ACCEPTED",
  "callerId": "+4475XXXXXXXX",
  "dialedNumber": "+4474XXXXXXXX",
  "offeredTime": "2023-04-25T05:14:50.178Z",
  "eventTime": "2023-04-25T05:14:52.031Z",
  "sessionId": "c51e56af-0c71-4917-98dd-53d299012e46"
}

]{
"event": "ANSWERED",
  		"callerId": "+1315XXXXXXXX",
  "dialedNumber": "+9185XXXXXXXX",
 		 "offeredTime": "2022-11-17T09:22:55.624Z",
  "answeredTime": "2022-11-17T09:23:06.139Z",  
  "eventTime": "2022-11-17T09:23:06.161Z",
  "sessionId": "a12c95ad-1999-4669-ba72-25ed04d2d7c2"
}

{
  			"event": "DROPPED",
 			 "status": "SUCCESS",
  			 "droppedBy": "CALLEE",
  			 "error": {
    				"code": "2008",
    				"message": "Call Dropped by Network/End user"
 				 },
  "eventTime": "2023-02-21T10:08:52.562Z",
  			"sessionId": "a4a45c38-0a4d-48e0-85a6-f1f96796b258"
}

{
  			"status": "SUCCESS",
 			 "playedDuration": 1,
 			 "event": "PLAYED",
  			"eventTime": "2023-04-26T13:12:47.233Z",
  			"sessionId": "64277de6-29fd-48e6-b48b-54392465376d",
  			"transactionId": "c63cab3c-622a-4fed-8529-2960395e811d"
}

{
  	"event": "STREAMED",
  "callerId": "+131XXXXXXXX",
 	 "dialedNumber": "+9189XXXXXXXX",
  	"status": "SUCCESS",
 	 "text": "credit card",
  	"eventTime": "2022-12-07T16:46:06.343Z",
 	 "sessionId": "a12c95ad-1999-4669-ba72-25ed04d2d7c2",
 	 "transactionId": "3afd709e-3bb8-4f19-b797-ba6bf2a4b366"
}

{
  		"event": "RECORDED",
 		 "status": "SUCCESS",
 		 "recordingFileName": "https://anydomain.imiconnect.ca/voice-recordings/menu_1681891700_909100209630299_5.wav",
  		"recordingLength": 6,
  		"eventTime": "2023-04-19T08:08:32.132Z",
  		"sessionId": "133941b7-c052-450a-aa2c-026b790c2644",
  		"transactionId": "2bde1a0d-5f54-4afd-8ece-136893348466"
}

{
"event": "STREAMED",
  "callerId": "+13153055521",
  "dialedNumber": "+918919147207",
  "status": "FAILURE",
  "error": {
    "message": "HttpStream failed, error code 500"
  },
  "eventTime": "2022-12-07T16:48:12.891Z",
  "sessionId": "a12c95ad-1999-4669-ba72-25ed04d2d7c2",
  "transactionId": "1427e243-d3ed-453b-b5ab-7108f88a5084"
}

{
"event": "PATCHED",
  "eventTime": "2022-12-07T16:48:12.891Z",
  "sessionId": "a12c95ad-1999-4669-ba72-25ed04d2d7c2",
  "transactionId": "1427e243-d3ed-453b-b5ab-7108f88a5084",
  "status": "SUCCESS",
    "ConnectedOn":	"2022-12-07T16:48:15.891Z"
    "recordingFileName": [
    "1.wav","2.wav"
     ]
    "droppedBy":"CALLER"
            }


{
"event": "COLLECTED_DIGITS",
  "eventTime": "2022-12-07T16:48:12.891Z",
  "sessionId": "a12c95ad-1999-4669-ba72-25ed04d2d7c2",
  "transactionId": "1427e243-d3ed-453b-b5ab-7108f88a5084",
  "status": "SUCCESS",
    "numOfDigits":8
    "digitsReceived":"23458976",
    "terminationDigit":"1",
    "playedDuration":300,
            }

Actions

Action NameDescription
AnsweredInstructs Webex Connect to answer the call. For the Accept event, the header response must be '200 OK.'
HangupInstructs Webex Connect to hang up or reject the call.
PlayPlays the specified content file or uses text-to-speech (TTS) to play the provided text as audio.
PatchPerforms a call patch operation, connecting the call to another party.
RecordInitiates a recording operation for the current call.
{
  "action": "ANSWER"
}


{
  "action": "REJECT",
  "reason": "Calltest Failed due to configured menu in reject state"
}

{
  "action": "PLAY",
  "audio": [
    {
      "type": "URL",
      "location": "https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav"
    },
    {
      "type": "TTS",
      "style": "NEURAL",
      "language": "en-US",
      "voice": "GuyNeural;Male",
      "gender": "MALE",
      "engine": "AZURE",
      "text": "greetings from cisco please enter 3 digits pin followed by # to patch "
    }
  ],
"collectInput":{
  "terminationDigit": "#",
  "maxDigits": 0,
  "digitTimeout": 5
},
"streamInput":{
  "timeout": 20,
  "maxsilence": 5,
  "model": "DEFAULT",
  "language": "en-US",
  "asrEngine": "GOOGLE",
    "recordStream": true,
	"singleUtterence":false,
"alternateLanguages":["fr-CA", "en-CA"]
}
          }

{
  "action": "PATCH",
  "recordCall": true,
  "holdAudio": {
    "type": "URL",
    "location": "https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav"
  },
  "greetingAudio": {
    "type": "TTS",
    "text": "thank you for waiting call is connected now"
  },
  "greetingRepeatCount": 0,
  "patchCallerId": "+15306544584",
  "dialedNumber": "+919985167784",
  "passDtmf": false
}

{
  "action": "RECORD",
  "audio": [
    {
      "type": "TTS",
      "style": "NEURAL",
      "language": "en-US",
      "voice": "GuyNeural;Male",
      "gender": "MALE",
      "engine": "AZURE",
      "text": " Hello buddy start recording now April 3rd 2023 "
    }
  ],
  "timeoutSeconds": 20,
  "terminationDigit": "5"
}