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

Generating CDRs and Recording Indexes

Description

This interface is invoked to generate CDR files and recording index files based on the specified conditions. After a file is generated, the file name (billFileName) is sent to the callback URL specified by callBackURL in callback mode.

The callback of the URL specified by callBackURL requires authentication. For details, see C2 Monitoring, System Outbound Call, CDR, and Knowledge Base Interface Authentication.

Usage Description

  • Prerequisites
    • The developer environment has been established and calls can be made properly. The developer has an independent server and the server has been bound to the callback URL (callBackURL).
    • accountId, agentId, and callId are optional parameters, which can be flexibly combined to generate CDRs and recording index files. If none of the three parameters is specified, the corresponding data records of the developer in the specified period are generated.
    • You have passed the authorization and obtained the access URL.
    • You have set aicc.ssl.trustAll in the CC-FS configuration file /home/ccfsapp/webapps/ccfsapp/WEB-INF/classes/config/servicecloud.base.properties is to false and performed the following steps to place the certificate:
      1. Log in to the CC-FS server as an O&M user and switch to the root user.
        su - root
      2. Upload the third-party certificate that needs to be loaded by the callback URL for notifying the index file generated by the CC-FS to the same directory ($HOME/conf) as the truststore.jks certificate file of the AICC. The directory varies according to the actual environment.
      3. Change the owner group of the uploaded third-party certificate.
        chown ccfsapp:ccfsapp XXX.jks
      4. Import the third-party certificate to truststore.jks.
        keytool -import -alias xxx -file XXX.jks -keystore truststore.jks

        Enter the password of the truststore.jks certificate file as prompted.

      5. Delete the XXX.jks certificate from the environment.
      6. Restart the CC-FS.

        Go to the /home/ccfsapp/bin directory and run the following command:

        ./shutdown.sh;./startup.sh
  • Usage restrictions

    A developer can access only the data of the account. The developer account (appId) must correspond to the enterprise account (tenant space ID: accountId).

    The developer account (appId) is contained in the authentication string. For details, see C2 Monitoring, System Outbound Call, CDR, and Knowledge Base Interface Authentication.

Interface Method

POST

URI

https://ip:port/CCFS/resource/ccfs/queryBillData

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.

Request

Table 1 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 2 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 3 msgBody parameters in the request body

No.

Name

Value Type

Mandatory

Default Value

Description

1

beginTime

String

Yes

None

Start time of CDRs and recordings, which is the time in the time zone where the tenant space is located. The interval between the start time and end time cannot exceed three days. The time is in yyyy-MM-dd HH:mm:ss format.

2

endTime

String

Yes

None

End time of CDRs and recordings, which is the time in the time zone where the tenant space is located. The interval between the start time and end time cannot exceed three days. The time is in yyyy-MM-dd HH:mm:ss format.

3

accountId

String (1–20)

No

None

Enterprise account (tenant space ID).

4

agentId

String (1–20)

No

None

Agent ID.

5

callId

String (1–25)

No

None

Call ID, which can be obtained from the file returned after the interface for downloading CDR and recording indexes is invoked.

6

callerNo

String (1–25)

No

None

Calling number.

7

calleeNo

String (1–25)

No

None

Called number. If calleeNo2 does not exist, the value is the called number. If calleeNo2 exists, the value is the calling number.

8

calleeNo2

String (1–25)

No

None

Called number 2.

9

dataType

String (1–11)

Yes

None

Type of the data record file to be generated. The options are as follows:

  • call: CDR
  • record: recording index
  • call_record: CDR and recording index

10

callBackURL

String

Yes

None

Callback URL. After generating a data record file, the platform returns billFileName to the URL specified by this parameter.

Response

The response obtained by invoking this interface consists of two parts:

(1) Response of the invoked party

(2) Response of the invoking part (response to third-party callback)

  • Response of the invoked party

    Table 4 describes the parameters in the response.

  • Response of the invoking party (response to third-party callback): The response consists of request and msgBody.

    request contains version (2.0 by default).

    msgBody consists of responseId (part of the CDR file name), billName (name of the ZIP package of CDRs to be downloaded), and accountId (tenant space ID). Table 5 describes resultData in the response.

Table 4 Parameters in the response

No.

Name

Value Type

Description

1

resultCode

String

Result code returned.

  • 0: success
  • Other values: failure

2

resultDesc

String

Request result description. For details, see Error Code Reference.

3

resultData

Object

Response data. For details, see Table 5.

4

response

Object

Request result object. For details, see Table 6.

This field is reserved for compatibility with earlier versions and is not recommended.

Table 5 Description of resultData in the response message

No.

Name

Value Type

Description

3.1

responseId

String

Unique ID generated after the interface is successfully invoked. It is a part of the file name.

Table 6 Parameters in a response message

No.

Name

Value Type

Description

4.1

version

String (1–32)

Protocol version, for example, 2.0.

4.2

resultCode

String (1–32)

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

4.3

resultMsg

String

Request result description.

Table 7 msgBody parameters in the callback response body

No.

Name

Value Type

Description

1

responseId

String

Unique ID generated after the interface is successfully invoked. It is a part of the file name.

2

billFileName

String

Name of a CDR or recording index file. The value is in yyyyMMdd_{responseId}.zip format.

For example, if the date when this interface is invoked is 2018-07-02 and the obtained value of responseId is 9239cb50-a838-4bb0-ab50-3441bf089446, the value of this parameter is 20180702_9239cb50a8384bb0ab503441bf089446.zip.

3

accountId

String

Enterprise account (tenant space ID). The enterprise account carried in the request parameter is used to associate the file name with an enterprise. If accountId is not set in the request parameter, this value is not returned.

Example

  • Request header
    POST /CCFS/resource/ccfs/queryBillData HTTP/1.1
    Authorization: auth-v2/ak/2018-07-02T02:42:49Z/content-length;content-type;host
    /7a8fb9d620ee488******************85c5df0cce3c6a253
    Accept: */*
    Content-Type: application/json;charset=UTF-8
    Content-Length: 297
  • Request parameters
    {
        "request": {
            "version": "2.0"
        },
        "msgBody": {
            "beginTime": "2018-06-29 10:42:49",
            "endTime": "2018-07-02 10:42:49",
            "accountId": "",
            "agentId": "",
            "callId": "",
            "dataType": "call_record",
            "callBackURL": "https://10.57.118.171:8000"
        }
    }
  • Response header
    HTTP/1.1 200 OK
    Content-Type: application/json;charset=UTF-8
    Date: Mon, 02 Jul 2018 02:43:03 GMT
  • Response
    {
        "resultData": {
            "responseId": "9239cb50a8384bb0ab503441bf089446"
        },
        "resultCode": "0",
        "resultDesc": "success"
    }
  • Example of the message returned by the call center to the callback URL

    Message header:

    POST / HTTP/1.1
    Accept: */*
    Content-Type: application/json;charset=UTF-8
    Authorization: auth-v2/ak/2018-07-02T02:43:03Z/content-length;content-type;host
    /c5bd683******************9def5747bd572c28
    Host: 10.57.118.171
    Content-Length: 208

    Message parameters:

    {
        "request": {
            "version": "2.0"
        },
        "msgBody": {
            "responseId": "9239cb50a8384bb0ab503441bf089446",
            "billFileName": "20180702_9239cb50a8384bb0ab503441bf089446.zip",
            "accountId": ""
        }
    }