Different Voice Parameters that are Available

In this section, you will be acquainted with the various parameters that can be used for your voice calls. Combining one or more of them allows you to achieve different use-cases - Text-to-Speech, One-Time Password, Audio Notifications, IVR, Number Masking etc.

ParameterTypeDescription/Example
say
- either “say” or “play” is compulsory at a time
stringThe text content that will be translated into a voice audio file by the Unifonic Text-To-Speech Service and played to the recipient on the call.
play
- either “say” or “play” is compulsory at a time
language
- compulsory if used with “say” or “onEmptyResponse” parameter
stringThe audioId that references the approved audio file in the audio library. The audio library is found within the Unifonic Console Campaign Module.
voice
- compulsory if used with “say” or “onEmptyResponse” parameter
string

enum:
- male
- female
The voice of the audio that will be generated by Unifonic TTS engine.

Unifonic TTS engine currently support male/female voices for all languages.
Language
- compulsory if used with “say” or “onEmptyResponse” parameter
string

Supported languages:
- arabic
- english
The language that will be used by Unifonic TTS engine to convert the text into audio.

Provided language should be similar to the language of the provided text.
Loop
[Optional]
stringThe number of times a message is played if a response is not inputted.
ResponseUrl
[Optional]
- compulsory if expecting recipient's speech/DTMF response
stringThe API where the DTMF/Speech response from the recipient will be posted to. This should be a publicly accessible https endpoint as the recipient may respond with verbally or via DTMF, either the digits field or speechResult field sent to the responseUrl may return as ‘null”.

Sample request payload to be posted at this API:
{
“confidence”:0.6, //refers to accuracy of this speech recognition activity
“speechResult”:”one”,
“digits”: “1”,
“recipient”: “+966XXXXXXXXX”,
“callerId”: “+966XXXXXXXXX”
}


ON RESPONSE HANDLING:

Scenario 1: Ending the call after receiving input
For example, after a recipient inputs a DTMF response, you want to say thank you. Simply provide this 200 OK response as part of your API:

{
“say”: “thank you”,
“voice”: “male”,
“language”: “english”
}

Scenario 2: Ask another question
For example, after a recipient inputs a DTMF response, you want to ask a further question. Simply provide this 200 OK response as part of your API:

{
“say”: “are you satisfied with our service? press 1 to say yes. press 2 to say no.”,
“voice”: “male”,
“language”: “english”
“loop”: “3”
“responseUrl: “https://testcustomer.com/question2response
}

// the response of this 2nd question will be posted to the corresponding responseUrl instead

/// if no response or invalid response is provided after posting the DTMF response, our server will automatically say this in the call: “Sorry. An Error Occurred” before hanging up.
onEmptyResponse
[Optional]
stringThe text content that will be translated into a voice audio file by the Unifonic Text-to-Speech Service, and played to the recipient in the event that no DTMF responses were detected.

If onEmptyResponse is missing and no DTMF response were detected, Unifonic will hang up the call after 4 seconds of the last played message.
digitsLimit
[Optional]
stringLimits the amount of digits that will be captured by the system. For example, if the digitLimits is set to 1, only the first digit that is inputted by the recipient will be captured.

e.g.:
{
“play”: “XXXXXXXXX”,
“responseUrl” :https://testcustomer.com/question,
“digitsLimit”: “1”
}
transfer
[Optional]
stringThe E164 callerId digits that you will like to transfer the call to.
For example, if the recipient were to select to speak to a customer service agent, the call can be transferred to the number of the customer service agent/call centre.

The transfer parameter can be paired with a say or play parameter, which will allow you to inform the recipient that the call will be transferred. Otherwise, to inform the recipient that the call may be recorded for quality assessment purposes.

The transferred call will also be recorded by default, and the recording will be found in the voice call logs on the Unifonic Console.

e.g.:

{
“language”: “english”,
“voice”: “male”,
“say”: “Your call will now be transferred to our customer service agent.”,
“transfer”: “+966XXXXXX”
}
queueName
[Optional]
stringThis parameter can be initialized when adding an active call to the queue. If an existing queue with the queueName is found, calls will be added to that queue. If no existing queue is found with the initialized queueName, a new queue will be created and the call will be added to that queue.

e.g.:
{
“language”: “english”,
“voice”: “female”,
“say”: “Our agents are currently busy. Please wait and we will attend to you shortly.
“queueName”:”service_support”
}
speechCollectionLanguagestringThis parameter can be initialized when the response collection activity should be conducted via speech recognition. This parameter defines the speech collection language, which enables the system to accurately recognise the language that was spoken by the end user.

After the speech collection activity has concluded and the system was able to recognise what was verbally collected. The system will send the response to the responseUrl in the following format:

Sample request payload to be posted at the responseUrl:
{
“confidence”:0.6, //refers to accuracy of this speech recognition activity
“speechResult”:”one”,
“digits”: null,
“recipient”: “+966XXXXXXXXX”,
“callerId”: “+966XXXXXXXXX”
}