Call Action Handling (Number Masking)

This method provides insights about call details and will be sent to your "Voice Call Action" (VCA) endpoint. Your "Voice Call Action" (VCA) endpoint can be configured on the sub-account level with the Number Masking Webhooks.

Call Action Request

When receiving an incoming call to your virtual number 8x8 platform will POST a JSON object to your URL.

The JSON object will contain the following values:

NameTypeDescription
namespaceString8x8 product channel definition
eventTypeStringCurrent call handle event type. CALL_ACTION
descriptionStringDescription of the current call handle event type
payloadobjectcontains call information about the current number masking session
eventIdStringId unique to an event of the current number masking session [UUID]
callIdStringId unique to a call leg of the current number masking session [UUID]
sessionIdStringId unique to the current number masking session [UUID]
subAccountIdStringunique id for your subaccount
callStatusStringStatus of the current call leg. Values can be:
CALL_RECEIVED (only for number masking)
callDirectionStringDirection of the call leg. INBOUND (Inbound only for number masking)
callTypeStringFor Number Masking the call type is always PSTN
sourceStringSource number of the call leg.
destinationStringDestination number of the call leg.
sourceFormatStringSource format for number masking is always MSISDN
sourceCountryCodeStringCountry code of the source number
destinationCountryCodeStringCountry code of the destination number
destinationRefIdStringReference Id for the virtual number (this is from your Get My Virtual Number Endpoint
callDurationIntegerCall duration for the current call leg. For the number masking scenario, callDuration would be "0".
sipCodeIntegerFinal Sip status code for the call leg defined by RFC 3261
TimestampTimestampTimestamp of the processed event

Example of a JSON object sent to your handleURL:

{
	"namespace": "VOICE",
	"eventType": "CALL_ACTION",
	"description": "Action request of a call",
	"payload": {
		"eventId": "eb0fc709-9693-11ea-454d-1705dde98182",
		"callId": "a1d6a5e3-efec-11e9-b999-7d370b5f90d1",
		"sessionId": "a1d6a5e2-efec-11e9-b999-efc71013a78f",
		"subAccountId": "your_subaccount_id",
		"callStatus": "CALL_RECEIVED",
		"callDirection": "INBOUND",
		"callType": "PSTN",
		"source": "+65123456789",
		"destination": "+65987654321",
		"sourceFormat": "MSISDN",
		"destinationFormat": "MSISDN",
		"sourceCountryCode": "SG",
		"destinationCountryCode": "SG",
		"destinationRefId": "vn-ref-1",
		"callDuration": 0,
		"sipCode": 200,
		"timestamp": "2019-10-16T08:12:01Z"
	}
}

Responding to Call Action Request

To start your call flow you need to reply to the call action request with an HTTP 200 response code including a Call Action in the HTTP response body. The supported Call Actions are:

  • makeCall - Initiates an outgoing call to the desired destination. This function should be used to connect the first call with another party.
  • say - Generates and plays a TTS to the calling user.
  • hangup - Disconnects all active calls. This will terminate the session, triggering the session summary webhook.

makeCall

This function should be used to connect the first call with another party.

The following is an example of the JSON response you would need to provide:

{
   "clientActionId": "NumberMaskingId1",
   "callflow": [
      {
         "action": "makeCall",
         "params": {
            "source": "6512345678",
            "destination": "6587654321",
            "callRecording": true //Optional. Use only if call recording has been set up.
         }
      }
   ]
}

The action should contain the following parameters:

NameTypeDescription
actionStringMakeCall – Action to Connect/Bridge call between two users
destinationStringNumber of the called party in E.164 format (The second user's number).
sourceStringNumber of the calling party in E.164 format. This should be the Virtual Number allocated to your sub-account
callRecordingBoolean(Optional) Trigger to start recording the Number Masking session. Before using this option please reach out to your Account Manager since this option might include additional costs. Additionally please make sure that the Call Recording has been configured on your account. To configure call recording please take a look at Call Recordings

say

This action should be used to play a text to speech message on the call.

The following is an example of the JSON response you would need to provide:

{
  "clientActionId": "NumberMaskingId1",
  "callflow": [
    {
      "action": "say",
      "params": {
        "text": "Hello This is a test message",
        "voiceProfile": "en-US-ZiraRUS",
        "repetition": 1,//optional(default is 1)
        "speed": 1.0,//optional(defailt is 1)
      }
    }
  ]
}

The above example would be used if you want the message

The action should contain the following parameters:

NameTypeDescription
actionStringsay – Text to speech function
textStringThe text to speech message that will be played on the call
voiceProfileStringThe voice profile of the spoken text, see in the table below the supported voice profiles. Please use Voice Profile API to retrieve voiceProfile
repetitionIntegerDefines the number of times the text will be repeated during the call.
speedFloatControls the speed of the speech

playFile

Downloads the sound/voice file provided and plays it back in the currently active call.

File type requirements:

  • Supported file types are .wav and mp3.
  • API only accepts file that is smaller than 5MB.

The following is an example of the JSON response you would need to provide:

{
  "clientActionId": "ivr1_level2",
  "callflow": [
    {
  "action": "playFile",
	"params": {
    "fileUrl": "https://sample-videos.com/audio/mp3/wave.mp3",  // mandatory
    "repetition": 1   //optional
      }
    }
  ]
}

The action should contain the following parameters:

NameTypeDescription
actionStringsay – play a recorded file into a currently active call funtion
fileUrlStringThe public link of the hosted voice file
repetitionIntegerDefines the number of times the text will be repeated during the call. Default repetition is 1. Max repetition is 3

📘

Downloaded Voice files

Downloaded voice files are cached for 1 hour for faster access, if used in consequent requests. If the file content is changed within 1 hour after the first request, make sure to change the file name for the changes to be reflected in the calls afterward

hangup

This action should be used to hang up the incoming call.

The following is an example of the JSON response you would need to provide:

{
	"clientActionId": "NumberMaskingId1",
	"callflow": [ 
		{
  		"action": "hangup" 
    }
  ]
}

Note: The Hangup action terminates the active call session.

Commands Example

On the following example it is demonstrated how multiple actions can be used in the same call action handle reply:

{
  "clientActionId": "NumberMaskingId1",
	"callflow": [ 
    {
      "action": "say",
        "params": {
          "text": "Hello This is a test message",
          "voiceProfile": "en-US-ZiraRUS",
          "repetition": 1,//optional(default is 1)
          "speed": 1.0,//optional(defailt is 1)
      }
    },
    {
  		"action": "hangup" 
    }
  ] 
}