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

Querying Call History Records (queryCallDetailRecord)

Scenario

This interface is invoked to view history records.

Method

POST

URI

https://Domain name/apiaccess/CC-Management/v1/mobileAgent/queryCallDetailRecord (For example, the domain name is service.besclouds.com.)

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

X-APP-Key

String

No

App key, which is the user ID.

2

Authorization

String

Yes

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

Table 2 Request body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

Body

Body

No

Request body parameters.

Table 3 Body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

Body

Object

No

Request body.

1.1

endTime

String

Yes

End time. The interval between the start and the end time cannot exceed seven days. The value is a timestamp, for example, 1572794607000.

1.2

offset

String

No

Pagination query offset. The default value is 0, indicating no offset. This parameter is optional.

1.3

limit

String

No

Page size for pagination query. The default value is 100, indicating that 100 records are displayed on each page. This parameter is optional.

1.4

startTime

String

Yes

Start time. The value is a timestamp, for example, 1572794607000.

1.5

caller

String

No

Calling number, which is optional. If this parameter is not set, all calling numbers are queried by default.

Length limit: string (32)

1.6

taskType

String

No

0: all types of tasks (except ITA bidirectional call tasks)

1: CEC bidirectional call task

2: anonymous outbound call task

3: voice notification

4: ITA bidirectional call

Response Description

  • Status code: 200
Table 4 Response body parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

retCode

String

Yes

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

1: No data is found.

2: The format of the start time and end time is incorrect.

4: The limit or offset pagination data format is incorrect.

12: The calling number is unavailable.

1.2

retMsg

String

Yes

Failure cause.

1.3

result

Object

No

Result content.

1.3.1

total

Number

No

Total number of records.

1.3.2

callInfo

Array [Object]

No

Record list.

1.3.2.1

callSerialNo

String

No

Call SN.

1.3.2.2

caller

String

No

Calling number.

Length limit: string (32)

1.3.2.3

called

String

No

Called number.

Length limit: string (32)

1.3.2.4

startTime

String

No

Start time of an outbound call. The value is a timestamp, for example, 1572794607000.

1.3.2.5

endTime

String

No

Call end time, which is a timestamp, for example, 1572794607000.

1.3.2.6

state

Number

No

Call status.

0: to be called

1: calling

2: talking

3: ended

Length limit: number (1)

1.3.2.7

reasonCode

Number

No

Code of the reason for ending a call.

The value ranges from 0 to 65535.

0: The called party hangs up. The call ends.

1: The calling party hangs up. The call ends.

2: The outbound call fails to be made to the calling party.

3: The called party fails to be called.

4: The calling party does not answer the call.

5: The called party does not answer the call.

6: Failed to initiate the call.

xxx: Other exceptions occur.

Length limit: number (5)

For details about reason codes for ITA bidirectional calls, see Table 5.

1.3.2.8

callData

String

No

Call data customized by a third party.

Length limit: string (1024)

1.3.2.9

callerPresent

String

No

CLIP number.

Length limit: string (32)

1.3.2.10

alertingTime

String

No

Time when a customer's phone rings. The value is a timestamp, for example, 1572794607000.

1.3.2.11

talkingTime

String

No

Customer call time. The value is a timestamp, for example, 1572794607000.

1.3.2.12

releaseTime

String

No

Time when a customer releases a call. The value is a timestamp, for example, 1572794607000.

1.3.2.13

talkDuration

String

No

User call duration, in seconds.

1.3.2.14

agentAlertingTime

String

No

Time when an agent's phone rings. The value is a timestamp, for example, 1572794607000.

1.3.2.15

agentTalkingTime

String

No

Agent call time. The value is a timestamp, for example, 1572794607000.

1.3.2.16

agentReleaseTime

String

No

Time when an agent releases a call. The value is a timestamp, for example, 1572794607000.

1.3.2.17

agentTalkDuration

String

No

Agent call duration, in seconds.

1.3.2.18

taskType

String

No

0: all types of tasks (except ITA bidirectional call tasks)

1: CEC bidirectional call task

2: anonymous outbound call task

3: voice notification

4: ITA bidirectional call

1.3.2.19

agentPresent

String

No

CLIP number displayed to the customer manager.

Length limit: string (32)

Table 5 Reason codes for ITA bidirectional calls

retCode

Description

0

N/A

1

The number cannot be found.

2

Failed to route to the network.

3

Failed to route to the destination.

4

Special messages are sent.

5

Incorrect trunk prefix.

6

The channel cannot be accessed.

7

A channel has been created.

8

Preemption.

9

Preemption reservation.

16

Normal call clearance.

17

The user is busy.

18

No answer.

19

No user answers the call.

20

The user is unreachable.

21

Call rejected.

22

The number has been changed.

23

Redirection.

25

The switching route is incorrect.

26

No user permission.

27

The target is disordered.

28

Invalid number format.

29

Rejected by the device.

30

Status query.

31

Normal.

34

Unreachable route.

38

Poor network quality.

39

Service out of connection.

40

Connecting.

41

Temporarily failed.

42

The device is congested.

43

Discarded information.

44

The channel cannot be accessed.

46

Call blocked.

47

No available resource.

49

Invalid quality.

50

The device is not reserved.

53

Outbound calls barred within the CUG.

55

Inbound calls barred within the CUG.

57

No permission for transmission.

58

Invalid transmission.

62

The levels are inconsistent.

63

Invalid service.

65

Transmission cannot be performed.

66

The channel cannot be implemented.

69

Invalid device.

70

Valid transmission.

79

The CV service is not configured.

81

An invalid value is referenced.

82

The channel does not exist.

83

The ID does not exist.

84

The call ID does not exist.

85

No call is suspended.

86

Anonymous call.

87

The CUG has no member.

88

Incompatible destination.

90

The CUG does not exist.

91

Invalid network.

95

Invalid information.

96

Not hosting element.

97

Type not found.

98

The information is not implemented.

99

The information element does not exist.

100

Invalid information element.

101

Inconsistent call status.

102

The timer times out.

103

The parameter does not exist.

110

The message contains unidentified parameters.

111

Protocol error.

127

Unspecified interaction.

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.

  • 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.

Example

  • Scenario: Query the information about the corresponding outbound call task.

    Request header:

    x-app-key:9******************************3
    Authorization:Bearer e******************************e
    Content-Type:application/json

    Request parameters:

    {
    	"startTime": "1562786332000",
    	"endTime": "1563391072000",
    	"taskType": "0",
    	"offset": 0,
    	"limit": 10
    }

    Response header:

    {
    	"connection": "keep-alive",
    	"content-type": "application/json;charset=UTF-8"
    }

    Response parameters:

    {
    	"result": {
    		"total": 11,
    		"callInfo": [{
    			"releaseTime": 1621577022000,
    			"called": "88889060",
    			"callerPresent": "640003",
    			"agentAlertingTime": 1621576992000,
    			"agentPresent": "640060",
    			"talkingTime": 1621576995000,
    			"alertingTime": 1621576994000,
    			"caller": "88889050",
    			"agentTalkingTime": 1621576994000,
    			"agentReleaseTime": 1621577022000,
    			"agentTalkDuration": 27,
    			"callSerialNo": "1037058396471308289",
    			"startTime": 1621576992000,
    			"endTime": 1621577022000,
    			"talkDuration": 26,
    			"state": 3,
    			"reasonCode": 1
    		}]
    	},
    	"retCode": "0",
    	"retMsg": "Query call detail record successfully"
    }