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

Uploading a File as a Third Party

Description

This interface is invoked by a third party to upload a file for a third-party chatbot. The third-party system is connected to the IVR system by loading a customized JAR package. The SaaS and OP deployment modes are supported.

Usage Description

  • Prerequisites
    • You have passed the authorization.
  • Usage restrictions

    Developers can upload files to only folders under their own accounts. For details, see C2 Monitoring, System Outbound Call, CDR, and Knowledge Base Interface Authentication.

    Contact the system administrator to obtain the upload path in Configuration Center > System Management > System Parameter Configuration > System parameters > File storage service > Path Configuration > Third-Party Recording Download Path Rule.

Interface Method

POST

URI

https://ip:port/CCFS/resource/ccfs/ivr/uploadFile?vdnId={vdnId}

Set ip to the IP address of the server where the CC-FS is installed and port to the HTTPS port number of the CC-FS.

If the request is routed through the NSLB, set ip to the IP address of the NSLB server and port to the HTTPS port number of the CC-FS service mapped on the NSLB.

Table 1 Parameters in the URL

No.

Name

Value Type

Mandatory

Description

1

vdnId

Integer

Yes

ID of a VDN.

Request

Table 2 Parameters in the request header

No.

Name

Value Type

Mandatory

Default Value

Description

1

Content-Type

String

Yes

None

The value is fixed to application/json; charset=UTF-8.

2

Authorization

String

Yes

None

For details about the generation mode, see C2 Monitoring, System Outbound Call, CDR, and Knowledge Base Interface Authentication.

Table 3 request parameters in the request body

No.

Name

Value Type

Mandatory

Default Value

Description

1

version

String (1–32)

Yes

2.0

Protocol version. Currently, the value is fixed to 2.0.

Table 4 msgBody parameters in the request body

No.

Name

Value Type

Mandatory

Default Value

Description

1

data

String

Yes

None

Base64 code of the file to be uploaded.

Note: Only WAV voice files in the following format are supported: 8 bit, 8000 Hz, 64 kbit/s, and mono.

The file size is specified by the system parameter Third-Party Upload File Size Limit, in MB. The default value is 5. To modify the file size, contact the system administrator to set the system parameter in Configuration Center > System Management > System Parameter Configuration > System parameters > File storage service > Resource allocation > Third-Party Upload File Size Limit.

Response

If this interface is successfully invoked, 0 and the message "operate success" are returned.

If the interface fails to be invoked, an error code is returned. For details about the error code data structure, see Table 4. resultData is a reserved field and is left empty by default.

Table 5 Parameters in the response

No.

Name

Value Type

Description

1

resultCode

String

Result code returned. For details, see Error Code Reference.

2

resultDesc

String

Request result description.

3

resultData

Object

Response data. For details, see Table 6.

Table 6 Description of resultData in the response message

No.

Name

Value Type

Description

3.1

fileName

String

Name of the file to be uploaded. The file name must be the value of the system parameter Third-Party Upload File Path Rule. Contact the system administrator to obtain the value of the system parameter in Configuration Center > System Management > System Parameter Configuration > System parameters > File storage service > Path Configuration > Third-Party Upload File Path Rule. The default value is /3rdfile/%VDNNO%/thirdvoicebotfile/.

Example: {Drive letter}:/3rdfile/{VDN ID}/thirdvoicebotfile/xxx.wav

3.2

locationId

List <String>

In CTI pool mode, the information is displayed if the upload is successful:

Example

  • Request header
    POST /CCFS/resource/ccfs/ivr/upload?vdnId=xx HTTP/1.1
    Authorization: auth-v2/ak/2021-08-31T09:38:50.872Z/content-length;content-type;host/c12f0ed******************941bdd106
    Accept: */*
    Content-Type: application/json;charset=UTF-8
    Content-Length: 193
  • Request parameters
    {
        "request": {
            "version": "2.0"
        },
        "msgBody": {
            "data":"base64"
        }
    }
  • Response parameters
    {
        "resultData": {
            "fileName": "Y:/3rdfile/53/thirdvoicebotfile/8fSsBaEb_1631869974029.wav",
            "locationId": [
                "0",
                "256"
            ]
        },
        "resultCode": "0",
        "resultDesc": "success"
    }