@wizai/agent-sip-sdk 0.1.7-alpha → 0.1.9-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +241 -241
- package/lib/agent-sip-sdk-cjs.js +2 -2
- package/lib/agent-sip-sdk-es.js +2 -2
- package/lib/agent-sip-sdk-umd.js +2 -2
- package/lib/types/api/index.d.ts +2 -1
- package/lib/types/api/types.d.ts +9 -0
- package/lib/types/index.d.ts +6 -3
- package/lib/types/types.d.ts +12 -6
- package/package.json +54 -53
package/lib/types/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IApiProps, IRespones, IAgentStatusListResponse, IAgentStatusResponse, IGetAgentSettingParams, IGetAgentSettingResponse, IUpdateAgentTicketParams, IRegisterSSEParams, ICloseSSEParams, ISwitchAgentStatusParams, IOutboundCallParams, IOutboundCallResponse, IAgentResponseTimeParams, IGetCallTaskInfoParams, IGetCallTaskInfoResponse, ISendBeaconParams } from './types';
|
|
1
|
+
import type { IApiProps, IRespones, IAgentStatusListResponse, IAgentStatusResponse, IGetAgentSettingParams, IGetAgentSettingResponse, IUpdateAgentTicketParams, IRegisterSSEParams, ICloseSSEParams, ISwitchAgentStatusParams, IOutboundCallParams, IOutboundCallResponse, IAgentResponseTimeParams, IAgentAbnormalCloseParams, IGetCallTaskInfoParams, IGetCallTaskInfoResponse, ISendBeaconParams } from './types';
|
|
2
2
|
import { EApiCode } from '../enums/common';
|
|
3
3
|
declare class Api {
|
|
4
4
|
private baseUrl;
|
|
@@ -31,6 +31,7 @@ declare class Api {
|
|
|
31
31
|
getCallTaskInfo(data: IGetCallTaskInfoParams): Promise<IGetCallTaskInfoResponse>;
|
|
32
32
|
getAfterCallProcessTime(data: IGetCallTaskInfoParams): Promise<IRespones<number>>;
|
|
33
33
|
formatFormData<T = Record<string, any>>(params: T): FormData;
|
|
34
|
+
agentAbnormalClose(params: IAgentAbnormalCloseParams): Promise<IRespones<any>>;
|
|
34
35
|
sendBeacon<T extends ISendBeaconParams>(params: T): void;
|
|
35
36
|
clearnSendBeaconQueue(): Promise<void>;
|
|
36
37
|
/**
|
package/lib/types/api/types.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export interface IAgentStatus {
|
|
|
64
64
|
sipServer: null;
|
|
65
65
|
statusName: string;
|
|
66
66
|
ticket: string;
|
|
67
|
+
locked?: boolean;
|
|
67
68
|
}
|
|
68
69
|
export type IAgentStatusResponse = Array<IAgentStatus>;
|
|
69
70
|
export interface IGetAgentSettingParams {
|
|
@@ -110,6 +111,14 @@ export interface IAgentResponseTimeParams {
|
|
|
110
111
|
agentGroupId: number;
|
|
111
112
|
resultType: EAgentAction;
|
|
112
113
|
}
|
|
114
|
+
export interface IAgentAbnormalCloseParams {
|
|
115
|
+
id: number;
|
|
116
|
+
groupId: number;
|
|
117
|
+
trace: string;
|
|
118
|
+
createTime?: string;
|
|
119
|
+
sendTime?: string;
|
|
120
|
+
Authentication?: string;
|
|
121
|
+
}
|
|
113
122
|
export interface IGetCustomerInfoParams {
|
|
114
123
|
customerId: string;
|
|
115
124
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ECode } from './enums/common';
|
|
2
2
|
import type { IAnswerFnType, INewMessageFnType, ISessionType, ISessionEventListener } from './sip/types';
|
|
3
|
-
import
|
|
3
|
+
import { IAgentSipSDKOptions, IAgentStatusParams, IInitType, IInitFnType, IAgentType, IAgentFnType, IGetAgentStatus, IGetAgentStatusList, ISwitchAgentStatus, IOutboundCall } from './types';
|
|
4
4
|
declare class AgentSipSDK {
|
|
5
5
|
private sip;
|
|
6
6
|
private api;
|
|
7
|
+
private isSipInit;
|
|
7
8
|
private agentInfo;
|
|
8
9
|
private initEvent;
|
|
9
10
|
private agentEvent;
|
|
@@ -12,8 +13,8 @@ declare class AgentSipSDK {
|
|
|
12
13
|
private timer;
|
|
13
14
|
private callDetails;
|
|
14
15
|
private unloadingHandled;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
16
|
+
private baseUrl;
|
|
17
|
+
private autoFinishACWTimer;
|
|
17
18
|
constructor(props: IAgentSipSDKOptions);
|
|
18
19
|
private init;
|
|
19
20
|
getAgentStatusList(): Promise<IGetAgentStatusList>;
|
|
@@ -23,11 +24,13 @@ declare class AgentSipSDK {
|
|
|
23
24
|
private resetSSE;
|
|
24
25
|
private createSSEAndOpensips;
|
|
25
26
|
private waitSIPRegistered;
|
|
27
|
+
private getAgentInfo;
|
|
26
28
|
getAgentStatus(): Promise<IGetAgentStatus>;
|
|
27
29
|
private onlineAgent;
|
|
28
30
|
private offlineAgent;
|
|
29
31
|
switchAgentStatus(data: IAgentStatusParams): Promise<ISwitchAgentStatus>;
|
|
30
32
|
outboundCall(phoneNumber: string): Promise<IOutboundCall>;
|
|
33
|
+
private autoFinishACW;
|
|
31
34
|
finshACW(): Promise<{
|
|
32
35
|
code: ECode;
|
|
33
36
|
data: null;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { ECode } from './enums/common';
|
|
2
2
|
import { EAgentStatus } from './enums/agent';
|
|
3
3
|
import type { IAgentStatusListResponse, IOutboundCallResponse } from './api/types';
|
|
4
|
-
export declare class SDKError extends Error {
|
|
5
|
-
code: ECode;
|
|
6
|
-
constructor(code: ECode, message: string);
|
|
7
|
-
}
|
|
8
4
|
export interface IResponse<T = any> {
|
|
9
5
|
code: ECode;
|
|
10
6
|
data: T;
|
|
@@ -51,7 +47,12 @@ interface IGetAgentStatusFailed {
|
|
|
51
47
|
data: null;
|
|
52
48
|
message: string;
|
|
53
49
|
}
|
|
54
|
-
|
|
50
|
+
interface IGetAgentStatusLocked {
|
|
51
|
+
code: ECode.LOCKED;
|
|
52
|
+
data: null;
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
55
|
+
export type IGetAgentStatus = IGetAgentStatusSuccess | IGetAgentStatusFailed | IGetAgentStatusLocked;
|
|
55
56
|
interface IGetAgentStatusListSuccess {
|
|
56
57
|
code: ECode.SUCCESS;
|
|
57
58
|
data: IAgentStatusListResponse;
|
|
@@ -76,7 +77,12 @@ interface ISwitchAgentStatusFailed {
|
|
|
76
77
|
data: null;
|
|
77
78
|
message: string;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
interface ISwitchAgentStatusLocked {
|
|
81
|
+
code: ECode.LOCKED;
|
|
82
|
+
data: null;
|
|
83
|
+
message: string;
|
|
84
|
+
}
|
|
85
|
+
export type ISwitchAgentStatus = ISwitchAgentStatusSuccess | ISwitchAgentStatusFailed | ISwitchAgentStatusLocked;
|
|
80
86
|
interface IOutboundCallSuccess {
|
|
81
87
|
code: ECode.SUCCESS;
|
|
82
88
|
data: IOutboundCallResponse;
|
package/package.json
CHANGED
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@wizai/agent-sip-sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Manages SIP clients and agent status, simplifying calls and events.",
|
|
5
|
-
"main": "lib/agent-sip-sdk-cjs.js",
|
|
6
|
-
"module": "lib/agent-sip-sdk-es.js",
|
|
7
|
-
"types": "lib/types/index.d.ts",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"files": [
|
|
10
|
-
"lib/"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "node test/index.js",
|
|
14
|
-
"jest": "jest",
|
|
15
|
-
"lint": "eslint --fix",
|
|
16
|
-
"build": "rollup -c"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"sip",
|
|
20
|
-
"agent",
|
|
21
|
-
"sdk"
|
|
22
|
-
],
|
|
23
|
-
"author": "Yuki Xie",
|
|
24
|
-
"license": "ISC",
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@eslint/js": "^9.6.0",
|
|
27
|
-
"@rollup/plugin-alias": "^5.1.1",
|
|
28
|
-
"@rollup/plugin-commonjs": "^26.0.1",
|
|
29
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
30
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
31
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
32
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
33
|
-
"@rollup/plugin-url": "^8.0.2",
|
|
34
|
-
"@types/event-source-polyfill": "^1.0.5",
|
|
35
|
-
"@types/jest": "^29.5.12",
|
|
36
|
-
"@types/node": "^22.7.8",
|
|
37
|
-
"eslint": "^9.6.0",
|
|
38
|
-
"globals": "^15.8.0",
|
|
39
|
-
"jest": "^29.7.0",
|
|
40
|
-
"rollup": "^4.18.0",
|
|
41
|
-
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
42
|
-
"ts-jest": "^29.2.2",
|
|
43
|
-
"tslib": "^2.6.3",
|
|
44
|
-
"typescript": "^5.5.2",
|
|
45
|
-
"typescript-eslint": "^7.16.0"
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@wizai/agent-sip-sdk",
|
|
3
|
+
"version": "0.1.9-alpha",
|
|
4
|
+
"description": "Manages SIP clients and agent status, simplifying calls and events.",
|
|
5
|
+
"main": "lib/agent-sip-sdk-cjs.js",
|
|
6
|
+
"module": "lib/agent-sip-sdk-es.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib/"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "node test/index.js",
|
|
14
|
+
"jest": "jest",
|
|
15
|
+
"lint": "eslint --fix",
|
|
16
|
+
"build": "rollup -c"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"sip",
|
|
20
|
+
"agent",
|
|
21
|
+
"sdk"
|
|
22
|
+
],
|
|
23
|
+
"author": "Yuki Xie",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@eslint/js": "^9.6.0",
|
|
27
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
28
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
29
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
30
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
31
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
32
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
33
|
+
"@rollup/plugin-url": "^8.0.2",
|
|
34
|
+
"@types/event-source-polyfill": "^1.0.5",
|
|
35
|
+
"@types/jest": "^29.5.12",
|
|
36
|
+
"@types/node": "^22.7.8",
|
|
37
|
+
"eslint": "^9.6.0",
|
|
38
|
+
"globals": "^15.8.0",
|
|
39
|
+
"jest": "^29.7.0",
|
|
40
|
+
"rollup": "^4.18.0",
|
|
41
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
42
|
+
"ts-jest": "^29.2.2",
|
|
43
|
+
"tslib": "^2.6.3",
|
|
44
|
+
"typescript": "^5.5.2",
|
|
45
|
+
"typescript-eslint": "^7.16.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@wizai/agent-sip-sdk": "^0.1.7-alpha",
|
|
49
|
+
"dayjs": "^1.11.18",
|
|
50
|
+
"event-source-polyfill": "^1.0.31",
|
|
51
|
+
"jssip": "^3.10.1",
|
|
52
|
+
"nanoid": "^5.0.8"
|
|
53
|
+
}
|
|
54
|
+
}
|