Updated on 2023-09-27 GMT+08:00

Uploading IVR Voice Files (importVoiceFile/upload)

Scenario

Upload IVR voice files.

This interface has a performance limit. After 10 requests are sent per second, traffic control is performed. If the number of requests exceeds the limit, the requests fail.

Method

POST

URI

https://Domain name/apiaccess/rest/cc-management/v1/importVoiceFile/upload. For example, the domain name is service.besclouds.com.

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

Authorization

String

Yes

Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.)

2

X-APP-Key

String

No

App key field, which is the user ID. Contact the operation personnel to obtain the app key.

Table 2 Request body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

body

Object

No

-

1.1

fileInfo

String

Yes

Base64-encoded recording file information. The maximum size is 8 MB. The size of the uploaded file increases the upload time.

1.2

locale

String

Yes

Language of the recording file. The value can be zh_CN (Chinese), en_US (English), pt_BR (Portuguese), or th_TH (Thai).

1.3

voiceType

String

Yes

Voice type. 0 indicates IVR, 1 indicates prompt tone, 2 indicates fault tone, and 3 indicates voice notification.

1.4

fileType

String

Yes

File type. WAV and MP3 files are supported.

The FFmpeg tool is used to transcode the WAV and MP3 formats to the audio file formats supported by the platform (A-law compression algorithm, mono, sampling bit: 8 bits, sampling frequency: 8000 Hz). After the conversion, the audio quality may be affected and audio file data may be lost. You are advised to use an audio file format that is supported by the platform.

1.5

callBackUrl

String

No

Callback URL. The system returns the review result to this URL.

The callback URL indicates the API defined by the customer for receiving the system review result. For details about the request and response parameters, see Table 3.

1.6

voiceFileName

String

No

IVR voice name. The value can contain a maximum of 50 characters, including only Chinese characters, uppercase letters, lowercase letters, and digits.

Table 3 Callback URL parameters

No.

Parameter

Type

Mandatory or Not

Description

Request parameters

1.5.1

fileUrl

String

Yes

Address of the file to be reviewed. The value is a full file address, including the file name extension.

1.5.2

fileId

String

Yes

ID of the file to be reviewed. For details about how to set this parameter, see the description of the fileId parameter in Table 4.

1.5.3

status

String

Yes

  • File review status. The options are as follows:
    • 2: approved
    • 3: rejected

1.5.4

comment

String

No

Review status remarks.

Response parameters

1.5.5

returnCode

String

Yes

Response code. The options are as follows:
  • 0: The review result is received successfully.
  • Others: The review result fails to be received.
    NOTE:

    If the review result fails to be received, the callback API is repeatedly invoked to return the file review result. After six times, the file review result is no longer returned.

Response Description

  • Status code: 200
    Table 4 Response body parameters

    No.

    Parameter

    Type

    Mandatory or Not

    Description

    1

    schema

    Object

    Yes

    -

    1.1

    returnCode

    String

    Yes

    Result code. The value 0 indicates success, and other values indicates failure.

    1.2

    description

    String

    Yes

    Result description.

    1.3

    fileId

    String

    No

    ID generated after the voice file is uploaded, which is used to associate with the recording in the AICC.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Business failure. Check the values of parameters in the request.

Error Codes

None

Example

Request header:

Content-Type:application/json
Authorization:Bearer XXXXXXXXXXXXXXXXXXXXXXX
X-APP-Key:XXXXXXXXXXXXXXXXXXXXXXX

Request parameters:

{
	"locale" : "en_US",
	"voiceType" : "0",
	"fileType" : "wav",
	"callBackUrl" : "http://10.130.40.194:18133/upload",
	"fileInfo" : 
"UklGRjJ+AABXQVZFZm10IBIAAAAGAAEAQB8AAEAfAAABAAgAAABkYXRhAH4AANXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1"
}

Response parameters:

{
  "returnCode": "0",
  "description": "File uploaded successfully.",
  "fileId": "1182733043937561608"
}

Callback URL parameters:

//Request parameters
{
    "fileUrl": "Y:/IVR/147/voice/0/nPqV9vU3_1666706957559.wav",
    "fileId": "1323606152730207249",
    "status": "2",
    "comment": "Approved"
}
//Response parameters
{
    "returnCode": "0"
}