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

Querying Call Status (queryCallState)

Scenario

This interface is invoked to query the call status.

Method

POST

URI

https://Domain name/apiaccess/CC-Management/v1/mobileAgent/queryCallState (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

callSerialNo

String

Yes

Call SN.

Length limit: string (50)

Response Description

  • Status code: 200
Table 3 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: Failed to query the status.

3: The format of the call SN is incorrect.

1.2

retMsg

String

Yes

Failure cause.

1.3

result

Object

No

Result content.

1.3.1

state

Number

No

Call status.

0: to be called

1: calling

2: talking

3: ended

Length limit: number (1)

1.3.2

reasonCode

Number

No

Code of the reason for ending a call.

The value ranges from 0 to 65535.

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

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

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

1.3.3

callData

String

No

Call data customized by a third party.

Length limit: string (1024)

1.3.4

caller

String

No

Calling number.

Length limit: string (32)

1.3.5

called

String

No

Called number.

Length limit: string (32)

1.3.6

startTime

String

No

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

1.3.7

endTime

String

No

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

1.3.8

callerPresent

String

No

CLIP number.

Length limit: string (32)

1.3.9

agentPresent

String

No

CLIP number displayed to the customer manager.

Table 4 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.

Error Codes

None

Example

  • Scenario: Query call status.

    Request header:

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

    Request parameters:

    {
    	"callSerialNo": "645735364434067472"
    }

    Response header:

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

    Response parameters:

    {
    	"retMsg": "Query call state successfully",
    	"retCode": "0",
    	"result": {
    		"caller": "88889050",
    		"called": "88889060",
    		"callerPresent": "640003",
    		"startTime": 1621823865000,
    		"state": 3,
    		"reasonCode": 0,
    		"agentPresent": "640060",
    		"endTime": 1621823872000
    	}
    }