@koi-design/callkit 2.2.0-beta.4 → 2.3.0-beta.2
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/dist/index.d.ts +604 -600
- package/dist/index.global.js +33 -183
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +28 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -178
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
declare class Api {
|
|
2
|
-
private callKit;
|
|
3
|
-
constructor(callKit: CallKit);
|
|
4
|
-
private isLogining;
|
|
5
|
-
private isLoginOuting;
|
|
6
|
-
login(params: {
|
|
7
|
-
userName: string;
|
|
8
|
-
password: string;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
}): Promise<any>;
|
|
11
|
-
loginOut(params: {
|
|
12
|
-
sessionId: string;
|
|
13
|
-
timestamp: number;
|
|
14
|
-
}): Promise<any>;
|
|
15
|
-
trackLogs(log: string): Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param params agentId status
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
updateUserStatus(params: any): Promise<any>;
|
|
22
|
-
private post;
|
|
1
|
+
declare class Api {
|
|
2
|
+
private callKit;
|
|
3
|
+
constructor(callKit: CallKit);
|
|
4
|
+
private isLogining;
|
|
5
|
+
private isLoginOuting;
|
|
6
|
+
login(params: {
|
|
7
|
+
userName: string;
|
|
8
|
+
password: string;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
loginOut(params: {
|
|
12
|
+
sessionId: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
trackLogs(log: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param params agentId status
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
updateUserStatus(params: any): Promise<any>;
|
|
22
|
+
private post;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
type LoggerLevel = 'info' | 'success' | 'warn' | 'error' | 'silent';
|
|
26
|
-
interface Log {
|
|
27
|
-
timestamp: string;
|
|
28
|
-
level: LoggerLevel;
|
|
29
|
-
type?: 'INCALL' | 'SIP' | 'API' | 'OTHER';
|
|
30
|
-
message: string;
|
|
31
|
-
caller: string;
|
|
32
|
-
content: Record<string, any>;
|
|
33
|
-
}
|
|
34
|
-
type LogEntity = Omit<Log, 'timestamp' | 'level' | 'message'>;
|
|
35
|
-
declare class Logger$1 {
|
|
36
|
-
prefix: string;
|
|
37
|
-
level: LoggerLevel;
|
|
38
|
-
private pendingTrackLogs;
|
|
39
|
-
private trackLogsTimer;
|
|
40
|
-
private callKit;
|
|
41
|
-
constructor(callKit: CallKit, level?: LoggerLevel);
|
|
42
|
-
private startTrackLogsTimer;
|
|
43
|
-
private flushTrackLogs;
|
|
44
|
-
destroy(): void;
|
|
45
|
-
setLevel(level: LoggerLevel): void;
|
|
46
|
-
info(msg: string, extra: LogEntity): void;
|
|
47
|
-
success(msg: string, extra: LogEntity): void;
|
|
48
|
-
warn(msg: string, extra: LogEntity): void;
|
|
49
|
-
error(msg: string | Error, extra: LogEntity, noTrigger?: boolean): void;
|
|
50
|
-
private catchLog;
|
|
25
|
+
type LoggerLevel = 'info' | 'success' | 'warn' | 'error' | 'silent';
|
|
26
|
+
interface Log {
|
|
27
|
+
timestamp: string;
|
|
28
|
+
level: LoggerLevel;
|
|
29
|
+
type?: 'INCALL' | 'SIP' | 'API' | 'OTHER';
|
|
30
|
+
message: string;
|
|
31
|
+
caller: string;
|
|
32
|
+
content: Record<string, any>;
|
|
33
|
+
}
|
|
34
|
+
type LogEntity = Omit<Log, 'timestamp' | 'level' | 'message'>;
|
|
35
|
+
declare class Logger$1 {
|
|
36
|
+
prefix: string;
|
|
37
|
+
level: LoggerLevel;
|
|
38
|
+
private pendingTrackLogs;
|
|
39
|
+
private trackLogsTimer;
|
|
40
|
+
private callKit;
|
|
41
|
+
constructor(callKit: CallKit, level?: LoggerLevel);
|
|
42
|
+
private startTrackLogsTimer;
|
|
43
|
+
private flushTrackLogs;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
setLevel(level: LoggerLevel): void;
|
|
46
|
+
info(msg: string, extra: LogEntity): void;
|
|
47
|
+
success(msg: string, extra: LogEntity): void;
|
|
48
|
+
warn(msg: string, extra: LogEntity): void;
|
|
49
|
+
error(msg: string | Error, extra: LogEntity, noTrigger?: boolean): void;
|
|
50
|
+
private catchLog;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -4786,568 +4786,572 @@ declare class Invitation extends Session {
|
|
|
4786
4786
|
private prackNeverArrived;
|
|
4787
4787
|
}
|
|
4788
4788
|
|
|
4789
|
-
type SocketSendEventType = (typeof SocketSendEvent)[keyof typeof SocketSendEvent];
|
|
4790
|
-
interface IncallConfig {
|
|
4791
|
-
enabled: boolean;
|
|
4792
|
-
maxAttempts: number;
|
|
4793
|
-
delay: number;
|
|
4794
|
-
pingInterval: number;
|
|
4795
|
-
pingTimeout: number;
|
|
4796
|
-
excludeLogEvents: string[];
|
|
4797
|
-
}
|
|
4798
|
-
interface SipConfig {
|
|
4799
|
-
enabled: boolean;
|
|
4800
|
-
maxAttempts: number;
|
|
4801
|
-
delay: number;
|
|
4802
|
-
registererOptions: RegistererOptions;
|
|
4803
|
-
}
|
|
4804
|
-
declare class Socket {
|
|
4805
|
-
private callKit;
|
|
4806
|
-
private ws?;
|
|
4807
|
-
lastPingTime: any;
|
|
4808
|
-
|
|
4809
|
-
/**
|
|
4810
|
-
* @description reconnect timer
|
|
4811
|
-
*/
|
|
4812
|
-
private reconnectTimer?;
|
|
4813
|
-
/**
|
|
4814
|
-
* @description reconnect attempts
|
|
4815
|
-
*/
|
|
4816
|
-
private reconnectAttempts;
|
|
4817
|
-
/**
|
|
4818
|
-
* @description connect auth state
|
|
4819
|
-
* @default {
|
|
4820
|
-
* startConfirm: false,
|
|
4821
|
-
* isConnected: false,
|
|
4822
|
-
* isReconnecting: false,
|
|
4823
|
-
* isAuthenticated: false,
|
|
4824
|
-
* isError: false
|
|
4825
|
-
* }
|
|
4826
|
-
*/
|
|
4827
|
-
private connectAuthState;
|
|
4828
|
-
get startConfirm(): boolean;
|
|
4829
|
-
get isError(): boolean;
|
|
4830
|
-
constructor(callKit: CallKit);
|
|
4831
|
-
get reconnectConfig(): IncallConfig;
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
private
|
|
4836
|
-
private
|
|
4837
|
-
private
|
|
4838
|
-
private
|
|
4839
|
-
private
|
|
4840
|
-
private
|
|
4841
|
-
private
|
|
4842
|
-
private
|
|
4843
|
-
private
|
|
4844
|
-
private
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
private
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
/**
|
|
4856
|
-
* Destroy the heartbeat manager
|
|
4857
|
-
*/
|
|
4858
|
-
destroyHeartbeat(): void;
|
|
4859
|
-
private attemptReconnect;
|
|
4789
|
+
type SocketSendEventType = (typeof SocketSendEvent)[keyof typeof SocketSendEvent];
|
|
4790
|
+
interface IncallConfig {
|
|
4791
|
+
enabled: boolean;
|
|
4792
|
+
maxAttempts: number;
|
|
4793
|
+
delay: number;
|
|
4794
|
+
pingInterval: number;
|
|
4795
|
+
pingTimeout: number;
|
|
4796
|
+
excludeLogEvents: string[];
|
|
4797
|
+
}
|
|
4798
|
+
interface SipConfig {
|
|
4799
|
+
enabled: boolean;
|
|
4800
|
+
maxAttempts: number;
|
|
4801
|
+
delay: number;
|
|
4802
|
+
registererOptions: RegistererOptions;
|
|
4803
|
+
}
|
|
4804
|
+
declare class Socket {
|
|
4805
|
+
private callKit;
|
|
4806
|
+
private ws?;
|
|
4807
|
+
lastPingTime: any;
|
|
4808
|
+
pingTimer?: ReturnType<typeof setInterval>;
|
|
4809
|
+
/**
|
|
4810
|
+
* @description reconnect timer
|
|
4811
|
+
*/
|
|
4812
|
+
private reconnectTimer?;
|
|
4813
|
+
/**
|
|
4814
|
+
* @description reconnect attempts
|
|
4815
|
+
*/
|
|
4816
|
+
private reconnectAttempts;
|
|
4817
|
+
/**
|
|
4818
|
+
* @description connect auth state
|
|
4819
|
+
* @default {
|
|
4820
|
+
* startConfirm: false,
|
|
4821
|
+
* isConnected: false,
|
|
4822
|
+
* isReconnecting: false,
|
|
4823
|
+
* isAuthenticated: false,
|
|
4824
|
+
* isError: false
|
|
4825
|
+
* }
|
|
4826
|
+
*/
|
|
4827
|
+
private connectAuthState;
|
|
4828
|
+
get startConfirm(): boolean;
|
|
4829
|
+
get isError(): boolean;
|
|
4830
|
+
constructor(callKit: CallKit);
|
|
4831
|
+
get reconnectConfig(): IncallConfig;
|
|
4832
|
+
isConnected(): boolean;
|
|
4833
|
+
init(): void;
|
|
4834
|
+
private setConnectAuthState;
|
|
4835
|
+
private handleDisconnect;
|
|
4836
|
+
private clearWebSocket;
|
|
4837
|
+
private connect;
|
|
4838
|
+
private onOpen;
|
|
4839
|
+
private cleanReconnectState;
|
|
4840
|
+
private resetConnectState;
|
|
4841
|
+
private onClose;
|
|
4842
|
+
private onError;
|
|
4843
|
+
private confirmAck;
|
|
4844
|
+
private onMessage;
|
|
4845
|
+
send(event: SocketSendEventType, message?: any): void;
|
|
4846
|
+
private ping;
|
|
4847
|
+
private checkPing;
|
|
4848
|
+
/**
|
|
4849
|
+
* reset socket connection and all states
|
|
4850
|
+
*/
|
|
4851
|
+
reset(config?: {
|
|
4852
|
+
force?: boolean;
|
|
4853
|
+
}): Promise<void>;
|
|
4854
|
+
private attemptReconnect;
|
|
4860
4855
|
}
|
|
4861
4856
|
|
|
4862
|
-
interface WebrtcConstranis {
|
|
4863
|
-
audio: {
|
|
4864
|
-
autoGainControl?: boolean;
|
|
4865
|
-
noiseSuppression?: boolean;
|
|
4866
|
-
echoCancellation?: boolean;
|
|
4867
|
-
};
|
|
4868
|
-
video: false;
|
|
4869
|
-
}
|
|
4870
|
-
interface IConfig {
|
|
4871
|
-
version: string;
|
|
4872
|
-
host: string;
|
|
4873
|
-
log: LoggerLevel;
|
|
4874
|
-
trackLogs: Partial<TrackLogsConfig>;
|
|
4875
|
-
audioRef?: HTMLAudioElement | (() => HTMLAudioElement);
|
|
4876
|
-
constrains: WebrtcConstranis;
|
|
4877
|
-
socket: string;
|
|
4878
|
-
reconnect?: {
|
|
4879
|
-
sip?: Partial<SipConfig>;
|
|
4880
|
-
incall?: Partial<IncallConfig>;
|
|
4881
|
-
};
|
|
4882
|
-
userInfo: {
|
|
4883
|
-
wsUrl: string;
|
|
4884
|
-
sessionId: string;
|
|
4885
|
-
username: string;
|
|
4886
|
-
password: string;
|
|
4887
|
-
encryptionPassword: string;
|
|
4888
|
-
sourceType: (typeof CallSourceType)[keyof typeof CallSourceType];
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
}
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4857
|
+
interface WebrtcConstranis {
|
|
4858
|
+
audio: {
|
|
4859
|
+
autoGainControl?: boolean;
|
|
4860
|
+
noiseSuppression?: boolean;
|
|
4861
|
+
echoCancellation?: boolean;
|
|
4862
|
+
};
|
|
4863
|
+
video: false;
|
|
4864
|
+
}
|
|
4865
|
+
interface IConfig {
|
|
4866
|
+
version: string;
|
|
4867
|
+
host: string;
|
|
4868
|
+
log: LoggerLevel;
|
|
4869
|
+
trackLogs: Partial<TrackLogsConfig>;
|
|
4870
|
+
audioRef?: HTMLAudioElement | (() => HTMLAudioElement);
|
|
4871
|
+
constrains: WebrtcConstranis;
|
|
4872
|
+
socket: string;
|
|
4873
|
+
reconnect?: {
|
|
4874
|
+
sip?: Partial<SipConfig>;
|
|
4875
|
+
incall?: Partial<IncallConfig>;
|
|
4876
|
+
};
|
|
4877
|
+
userInfo: {
|
|
4878
|
+
wsUrl: string;
|
|
4879
|
+
sessionId: string;
|
|
4880
|
+
username: string;
|
|
4881
|
+
password: string;
|
|
4882
|
+
encryptionPassword: string;
|
|
4883
|
+
sourceType: (typeof CallSourceType)[keyof typeof CallSourceType];
|
|
4884
|
+
/** Agent/seat type: SIP(0) / TEL(1) / OUT(2) / SP(5), default SIP */
|
|
4885
|
+
phoneType: PhoneTypeType;
|
|
4886
|
+
extno: string;
|
|
4887
|
+
workOrderId: string;
|
|
4888
|
+
userPart: string;
|
|
4889
|
+
agentId: string;
|
|
4890
|
+
fsUserId: string;
|
|
4891
|
+
fsPassword: string;
|
|
4892
|
+
fsIp: string;
|
|
4893
|
+
fsPort: string;
|
|
4894
|
+
iceInfo: string[];
|
|
4895
|
+
iceGatheringTimeout: number;
|
|
4896
|
+
encryptionMethod: EncryptionMethodType;
|
|
4897
|
+
logGather: boolean;
|
|
4898
|
+
};
|
|
4899
|
+
}
|
|
4900
|
+
declare class Config {
|
|
4901
|
+
callKit: CallKit;
|
|
4902
|
+
constructor(callKit: CallKit);
|
|
4903
|
+
config: IConfig;
|
|
4904
|
+
getConfig: () => IConfig;
|
|
4905
|
+
setConfig: (key: string, value: any) => Promise<void>;
|
|
4906
|
+
setUserInfo: (key: string, value: any) => Promise<void>;
|
|
4907
|
+
reset: (form: string) => Promise<void>;
|
|
4908
|
+
validate: () => boolean;
|
|
4909
|
+
isLogin: () => boolean;
|
|
4910
|
+
check(): boolean;
|
|
4911
|
+
getTrackLogsConfig(): {
|
|
4912
|
+
enabled: boolean;
|
|
4913
|
+
interval: number;
|
|
4914
|
+
maxSize: number;
|
|
4915
|
+
};
|
|
4916
|
+
getReconnectConfig<T extends 'sip' | 'incall'>(type: T): T extends "sip" ? SipConfig : IncallConfig;
|
|
4917
|
+
enableTrackLogs(enabled: boolean): void;
|
|
4922
4918
|
}
|
|
4923
4919
|
|
|
4924
|
-
declare const CallStatus: {
|
|
4925
|
-
/**
|
|
4926
|
-
* Initial state/Hang up
|
|
4927
|
-
*/
|
|
4928
|
-
init: number;
|
|
4929
|
-
/**
|
|
4930
|
-
* Connecting
|
|
4931
|
-
*/
|
|
4932
|
-
connecting: number;
|
|
4933
|
-
/**
|
|
4934
|
-
* Ringing
|
|
4935
|
-
*/
|
|
4936
|
-
ringing: number;
|
|
4937
|
-
/**
|
|
4938
|
-
* In call
|
|
4939
|
-
*/
|
|
4940
|
-
calling: number;
|
|
4941
|
-
};
|
|
4942
|
-
declare const KitEvent: {
|
|
4943
|
-
/**
|
|
4944
|
-
* Log
|
|
4945
|
-
*/
|
|
4946
|
-
KIT_LOG: string;
|
|
4947
|
-
/**
|
|
4948
|
-
* User status change
|
|
4949
|
-
*/
|
|
4950
|
-
KIT_USER_STATUS_CHANGE: string;
|
|
4951
|
-
/**
|
|
4952
|
-
* User login status change
|
|
4953
|
-
*/
|
|
4954
|
-
KIT_LOGIN_CHANGE: string;
|
|
4955
|
-
/**
|
|
4956
|
-
* Registration status change
|
|
4957
|
-
*/
|
|
4958
|
-
KIT_REGISTER_CHANGE: string;
|
|
4959
|
-
/**
|
|
4960
|
-
* Call status change
|
|
4961
|
-
*/
|
|
4962
|
-
KIT_CALL_STATUS_CHANGE: string;
|
|
4963
|
-
/**
|
|
4964
|
-
* Hold status change
|
|
4965
|
-
*/
|
|
4966
|
-
KIT_SET_HOLD: string;
|
|
4967
|
-
/**
|
|
4968
|
-
* Mute status change
|
|
4969
|
-
*/
|
|
4970
|
-
KIT_SET_MUTE: string;
|
|
4971
|
-
/**
|
|
4972
|
-
* Call id change
|
|
4973
|
-
*/
|
|
4974
|
-
KIT_CALL_ID_CHANGE: string;
|
|
4975
|
-
/**
|
|
4976
|
-
* Error
|
|
4977
|
-
*/
|
|
4978
|
-
KIT_ERROR: string;
|
|
4979
|
-
/**
|
|
4980
|
-
* Server initiated call
|
|
4981
|
-
*/
|
|
4982
|
-
KIT_INVITE: string;
|
|
4983
|
-
/**
|
|
4984
|
-
* Server outgoing initiated call
|
|
4985
|
-
*/
|
|
4986
|
-
KIT_OUTGOING_INVITE: string;
|
|
4987
|
-
/**
|
|
4988
|
-
* Connecting
|
|
4989
|
-
*/
|
|
4990
|
-
CALL_CONNECTING: string;
|
|
4991
|
-
/**
|
|
4992
|
-
* Customer ringing
|
|
4993
|
-
*/
|
|
4994
|
-
CALL_RINGING: string;
|
|
4995
|
-
/**
|
|
4996
|
-
* Agent pick up
|
|
4997
|
-
*/
|
|
4998
|
-
AGENT_PICK_UP: string;
|
|
4999
|
-
/**
|
|
5000
|
-
* Customer answer
|
|
5001
|
-
*/
|
|
5002
|
-
CALL_PICK_UP: string;
|
|
5003
|
-
/**
|
|
5004
|
-
* Customer no response
|
|
5005
|
-
*/
|
|
5006
|
-
CALL_NO_ANSWER: string;
|
|
5007
|
-
/**
|
|
5008
|
-
* Customer hang up
|
|
5009
|
-
*/
|
|
5010
|
-
CALL_HANG_UP: string;
|
|
5011
|
-
/**
|
|
5012
|
-
* Call end
|
|
5013
|
-
*/
|
|
5014
|
-
CALL_END: string;
|
|
5015
|
-
/**
|
|
5016
|
-
* Call detail record push
|
|
5017
|
-
*/
|
|
5018
|
-
CALL_CDR: string;
|
|
5019
|
-
/**
|
|
5020
|
-
* Forward all socket events
|
|
5021
|
-
*/
|
|
5022
|
-
SERVER_SOCKET_EVENT: string;
|
|
5023
|
-
/**
|
|
5024
|
-
* User status change
|
|
5025
|
-
*/
|
|
5026
|
-
USER_STATUS_CHANGE: string;
|
|
5027
|
-
INCALL_CONNECT_EVENT: string;
|
|
5028
|
-
SIP_CONNECT_EVENT: string;
|
|
5029
|
-
SIP_REGISTERER_EVENT: string;
|
|
5030
|
-
SIP_SESSION_EVENT: string;
|
|
5031
|
-
/**
|
|
5032
|
-
* Refering change
|
|
5033
|
-
*/
|
|
5034
|
-
KIT_REFERING_CHANGE: string;
|
|
5035
|
-
/**
|
|
5036
|
-
* In call refering change
|
|
5037
|
-
*/
|
|
5038
|
-
KIT_IN_CALL_REFERING_CHANGE: string;
|
|
5039
|
-
};
|
|
5040
|
-
declare const SocketSendEvent: {
|
|
5041
|
-
/**
|
|
5042
|
-
* ping
|
|
5043
|
-
*/
|
|
5044
|
-
PING: string;
|
|
5045
|
-
/**
|
|
5046
|
-
* Start
|
|
5047
|
-
*/
|
|
5048
|
-
START: string;
|
|
5049
|
-
/**
|
|
5050
|
-
* Hang up
|
|
5051
|
-
*/
|
|
5052
|
-
AGENT_HANGUP: string;
|
|
5053
|
-
/**
|
|
5054
|
-
* Cancel
|
|
5055
|
-
*/
|
|
5056
|
-
CALL_CANCEL: string;
|
|
5057
|
-
/**
|
|
5058
|
-
* Hold
|
|
5059
|
-
*/
|
|
5060
|
-
HOLD: string;
|
|
5061
|
-
/**
|
|
5062
|
-
* Unhold
|
|
5063
|
-
*/
|
|
5064
|
-
UNHOLD: string;
|
|
5065
|
-
/**
|
|
5066
|
-
* Mute
|
|
5067
|
-
*/
|
|
5068
|
-
MUTE: string;
|
|
5069
|
-
/**
|
|
5070
|
-
* Unmute
|
|
5071
|
-
*/
|
|
5072
|
-
UNMUTE: string;
|
|
5073
|
-
/**
|
|
5074
|
-
* Call
|
|
5075
|
-
*/
|
|
5076
|
-
CALL: string;
|
|
5077
|
-
/**
|
|
5078
|
-
* End
|
|
5079
|
-
*/
|
|
5080
|
-
END: string;
|
|
5081
|
-
/**
|
|
5082
|
-
* AGENT_TRANSFER
|
|
5083
|
-
*/
|
|
5084
|
-
AGENT_TRANSFER: string;
|
|
5085
|
-
/**
|
|
5086
|
-
* AGENT_TRANSFER
|
|
5087
|
-
*/
|
|
5088
|
-
HANG_UP_REASON: string;
|
|
5089
|
-
ACK: string;
|
|
5090
|
-
};
|
|
5091
|
-
declare const EncryptionMethod: {
|
|
5092
|
-
NONE: string;
|
|
5093
|
-
INTERNAL: string;
|
|
5094
|
-
};
|
|
5095
|
-
type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMethod];
|
|
5096
|
-
declare const CallSourceType: {
|
|
5097
|
-
phoneNum: number;
|
|
5098
|
-
workOrderId: number;
|
|
5099
|
-
};
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
4920
|
+
declare const CallStatus: {
|
|
4921
|
+
/**
|
|
4922
|
+
* Initial state/Hang up
|
|
4923
|
+
*/
|
|
4924
|
+
init: number;
|
|
4925
|
+
/**
|
|
4926
|
+
* Connecting
|
|
4927
|
+
*/
|
|
4928
|
+
connecting: number;
|
|
4929
|
+
/**
|
|
4930
|
+
* Ringing
|
|
4931
|
+
*/
|
|
4932
|
+
ringing: number;
|
|
4933
|
+
/**
|
|
4934
|
+
* In call
|
|
4935
|
+
*/
|
|
4936
|
+
calling: number;
|
|
4937
|
+
};
|
|
4938
|
+
declare const KitEvent: {
|
|
4939
|
+
/**
|
|
4940
|
+
* Log
|
|
4941
|
+
*/
|
|
4942
|
+
KIT_LOG: string;
|
|
4943
|
+
/**
|
|
4944
|
+
* User status change
|
|
4945
|
+
*/
|
|
4946
|
+
KIT_USER_STATUS_CHANGE: string;
|
|
4947
|
+
/**
|
|
4948
|
+
* User login status change
|
|
4949
|
+
*/
|
|
4950
|
+
KIT_LOGIN_CHANGE: string;
|
|
4951
|
+
/**
|
|
4952
|
+
* Registration status change
|
|
4953
|
+
*/
|
|
4954
|
+
KIT_REGISTER_CHANGE: string;
|
|
4955
|
+
/**
|
|
4956
|
+
* Call status change
|
|
4957
|
+
*/
|
|
4958
|
+
KIT_CALL_STATUS_CHANGE: string;
|
|
4959
|
+
/**
|
|
4960
|
+
* Hold status change
|
|
4961
|
+
*/
|
|
4962
|
+
KIT_SET_HOLD: string;
|
|
4963
|
+
/**
|
|
4964
|
+
* Mute status change
|
|
4965
|
+
*/
|
|
4966
|
+
KIT_SET_MUTE: string;
|
|
4967
|
+
/**
|
|
4968
|
+
* Call id change
|
|
4969
|
+
*/
|
|
4970
|
+
KIT_CALL_ID_CHANGE: string;
|
|
4971
|
+
/**
|
|
4972
|
+
* Error
|
|
4973
|
+
*/
|
|
4974
|
+
KIT_ERROR: string;
|
|
4975
|
+
/**
|
|
4976
|
+
* Server initiated call
|
|
4977
|
+
*/
|
|
4978
|
+
KIT_INVITE: string;
|
|
4979
|
+
/**
|
|
4980
|
+
* Server outgoing initiated call
|
|
4981
|
+
*/
|
|
4982
|
+
KIT_OUTGOING_INVITE: string;
|
|
4983
|
+
/**
|
|
4984
|
+
* Connecting
|
|
4985
|
+
*/
|
|
4986
|
+
CALL_CONNECTING: string;
|
|
4987
|
+
/**
|
|
4988
|
+
* Customer ringing
|
|
4989
|
+
*/
|
|
4990
|
+
CALL_RINGING: string;
|
|
4991
|
+
/**
|
|
4992
|
+
* Agent pick up
|
|
4993
|
+
*/
|
|
4994
|
+
AGENT_PICK_UP: string;
|
|
4995
|
+
/**
|
|
4996
|
+
* Customer answer
|
|
4997
|
+
*/
|
|
4998
|
+
CALL_PICK_UP: string;
|
|
4999
|
+
/**
|
|
5000
|
+
* Customer no response
|
|
5001
|
+
*/
|
|
5002
|
+
CALL_NO_ANSWER: string;
|
|
5003
|
+
/**
|
|
5004
|
+
* Customer hang up
|
|
5005
|
+
*/
|
|
5006
|
+
CALL_HANG_UP: string;
|
|
5007
|
+
/**
|
|
5008
|
+
* Call end
|
|
5009
|
+
*/
|
|
5010
|
+
CALL_END: string;
|
|
5011
|
+
/**
|
|
5012
|
+
* Call detail record push
|
|
5013
|
+
*/
|
|
5014
|
+
CALL_CDR: string;
|
|
5015
|
+
/**
|
|
5016
|
+
* Forward all socket events
|
|
5017
|
+
*/
|
|
5018
|
+
SERVER_SOCKET_EVENT: string;
|
|
5019
|
+
/**
|
|
5020
|
+
* User status change
|
|
5021
|
+
*/
|
|
5022
|
+
USER_STATUS_CHANGE: string;
|
|
5023
|
+
INCALL_CONNECT_EVENT: string;
|
|
5024
|
+
SIP_CONNECT_EVENT: string;
|
|
5025
|
+
SIP_REGISTERER_EVENT: string;
|
|
5026
|
+
SIP_SESSION_EVENT: string;
|
|
5027
|
+
/**
|
|
5028
|
+
* Refering change
|
|
5029
|
+
*/
|
|
5030
|
+
KIT_REFERING_CHANGE: string;
|
|
5031
|
+
/**
|
|
5032
|
+
* In call refering change
|
|
5033
|
+
*/
|
|
5034
|
+
KIT_IN_CALL_REFERING_CHANGE: string;
|
|
5035
|
+
};
|
|
5036
|
+
declare const SocketSendEvent: {
|
|
5037
|
+
/**
|
|
5038
|
+
* ping
|
|
5039
|
+
*/
|
|
5040
|
+
PING: string;
|
|
5041
|
+
/**
|
|
5042
|
+
* Start
|
|
5043
|
+
*/
|
|
5044
|
+
START: string;
|
|
5045
|
+
/**
|
|
5046
|
+
* Hang up
|
|
5047
|
+
*/
|
|
5048
|
+
AGENT_HANGUP: string;
|
|
5049
|
+
/**
|
|
5050
|
+
* Cancel
|
|
5051
|
+
*/
|
|
5052
|
+
CALL_CANCEL: string;
|
|
5053
|
+
/**
|
|
5054
|
+
* Hold
|
|
5055
|
+
*/
|
|
5056
|
+
HOLD: string;
|
|
5057
|
+
/**
|
|
5058
|
+
* Unhold
|
|
5059
|
+
*/
|
|
5060
|
+
UNHOLD: string;
|
|
5061
|
+
/**
|
|
5062
|
+
* Mute
|
|
5063
|
+
*/
|
|
5064
|
+
MUTE: string;
|
|
5065
|
+
/**
|
|
5066
|
+
* Unmute
|
|
5067
|
+
*/
|
|
5068
|
+
UNMUTE: string;
|
|
5069
|
+
/**
|
|
5070
|
+
* Call
|
|
5071
|
+
*/
|
|
5072
|
+
CALL: string;
|
|
5073
|
+
/**
|
|
5074
|
+
* End
|
|
5075
|
+
*/
|
|
5076
|
+
END: string;
|
|
5077
|
+
/**
|
|
5078
|
+
* AGENT_TRANSFER
|
|
5079
|
+
*/
|
|
5080
|
+
AGENT_TRANSFER: string;
|
|
5081
|
+
/**
|
|
5082
|
+
* AGENT_TRANSFER
|
|
5083
|
+
*/
|
|
5084
|
+
HANG_UP_REASON: string;
|
|
5085
|
+
ACK: string;
|
|
5086
|
+
};
|
|
5087
|
+
declare const EncryptionMethod: {
|
|
5088
|
+
NONE: string;
|
|
5089
|
+
INTERNAL: string;
|
|
5090
|
+
};
|
|
5091
|
+
type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMethod];
|
|
5092
|
+
declare const CallSourceType: {
|
|
5093
|
+
phoneNum: number;
|
|
5094
|
+
workOrderId: number;
|
|
5095
|
+
};
|
|
5096
|
+
/** Agent/seat type: SIP / TEL / OUT / SP */
|
|
5097
|
+
declare const PhoneTypeEnum: {
|
|
5098
|
+
readonly SIP: 0;
|
|
5099
|
+
readonly TEL: 1;
|
|
5100
|
+
readonly OUT: 2;
|
|
5101
|
+
readonly SP: 5;
|
|
5102
|
+
};
|
|
5103
|
+
type PhoneTypeType = (typeof PhoneTypeEnum)[keyof typeof PhoneTypeEnum];
|
|
5104
|
+
interface TrackLogsConfig {
|
|
5105
|
+
enabled: boolean;
|
|
5106
|
+
interval: number;
|
|
5107
|
+
maxSize: number;
|
|
5104
5108
|
}
|
|
5105
5109
|
|
|
5106
|
-
interface CallParams {
|
|
5107
|
-
agentId: string;
|
|
5108
|
-
sourceType: (typeof CallSourceType)[keyof typeof CallSourceType];
|
|
5109
|
-
phoneNum?: string;
|
|
5110
|
-
workOrderId?: string;
|
|
5111
|
-
extra?: any;
|
|
5112
|
-
}
|
|
5113
|
-
declare class Call {
|
|
5114
|
-
private callKit;
|
|
5115
|
-
constructor(callKit: CallKit);
|
|
5116
|
-
callStart(params: Partial<CallParams>): Promise<void>;
|
|
5117
|
-
/**
|
|
5118
|
-
* Refer
|
|
5119
|
-
* @param referTo - The referral target. If a `Session`, a REFER w/Replaces is sent.
|
|
5120
|
-
* @returns
|
|
5121
|
-
*/
|
|
5122
|
-
callRefer(referTo: string, options?: any): Promise<void>;
|
|
5123
|
-
/**
|
|
5124
|
-
* Hang up
|
|
5125
|
-
* @param isUnprompted Whether to actively hang up
|
|
5126
|
-
* @param isError Whether an error occurred
|
|
5127
|
-
* @returns
|
|
5128
|
-
*/
|
|
5129
|
-
callEnd(isUnprompted?: boolean, isError?: boolean): Promise<void>;
|
|
5130
|
-
callHold(): Promise<void>;
|
|
5131
|
-
callUnhold(): Promise<void>;
|
|
5132
|
-
callMute(): Promise<void>;
|
|
5133
|
-
callUnmute(): Promise<void>;
|
|
5110
|
+
interface CallParams {
|
|
5111
|
+
agentId: string;
|
|
5112
|
+
sourceType: (typeof CallSourceType)[keyof typeof CallSourceType];
|
|
5113
|
+
phoneNum?: string;
|
|
5114
|
+
workOrderId?: string;
|
|
5115
|
+
extra?: any;
|
|
5116
|
+
}
|
|
5117
|
+
declare class Call {
|
|
5118
|
+
private callKit;
|
|
5119
|
+
constructor(callKit: CallKit);
|
|
5120
|
+
callStart(params: Partial<CallParams>): Promise<void>;
|
|
5121
|
+
/**
|
|
5122
|
+
* Refer
|
|
5123
|
+
* @param referTo - The referral target. If a `Session`, a REFER w/Replaces is sent.
|
|
5124
|
+
* @returns
|
|
5125
|
+
*/
|
|
5126
|
+
callRefer(referTo: string, options?: any): Promise<void>;
|
|
5127
|
+
/**
|
|
5128
|
+
* Hang up
|
|
5129
|
+
* @param isUnprompted Whether to actively hang up
|
|
5130
|
+
* @param isError Whether an error occurred
|
|
5131
|
+
* @returns
|
|
5132
|
+
*/
|
|
5133
|
+
callEnd(isUnprompted?: boolean, isError?: boolean): Promise<void>;
|
|
5134
|
+
callHold(): Promise<void>;
|
|
5135
|
+
callUnhold(): Promise<void>;
|
|
5136
|
+
callMute(): Promise<void>;
|
|
5137
|
+
callUnmute(): Promise<void>;
|
|
5134
5138
|
}
|
|
5135
5139
|
|
|
5136
|
-
type CallStatusType = (typeof CallStatus)[keyof typeof CallStatus];
|
|
5137
|
-
declare class Connect {
|
|
5138
|
-
callKit: CallKit;
|
|
5139
|
-
/**
|
|
5140
|
-
*@description Whether muted
|
|
5141
|
-
*/
|
|
5142
|
-
private isMute;
|
|
5143
|
-
/**
|
|
5144
|
-
*@description Whether registered
|
|
5145
|
-
*/
|
|
5146
|
-
private isRegister;
|
|
5147
|
-
/**
|
|
5148
|
-
*@description Whether holding
|
|
5149
|
-
*/
|
|
5150
|
-
private isHold;
|
|
5151
|
-
/**
|
|
5152
|
-
*@description Connect status: init registered connecting calling
|
|
5153
|
-
*/
|
|
5154
|
-
connectStatus: number;
|
|
5155
|
-
currentSession?: Invitation;
|
|
5156
|
-
mediaStream?: MediaStream;
|
|
5157
|
-
userAgent?: UserAgent;
|
|
5158
|
-
registerer?: Registerer;
|
|
5159
|
-
/**
|
|
5160
|
-
*@description Whether it's a re-connected
|
|
5161
|
-
*/
|
|
5162
|
-
isReConnected: boolean;
|
|
5163
|
-
/**
|
|
5164
|
-
*@description Whether it's a referring
|
|
5165
|
-
*/
|
|
5166
|
-
private _isRefering;
|
|
5167
|
-
/**
|
|
5168
|
-
*@description Whether it's in call refering dealwith disconnect recovery
|
|
5169
|
-
*/
|
|
5170
|
-
private _isInCallRefering;
|
|
5171
|
-
/**
|
|
5172
|
-
*@description Whether it's an outgoing call
|
|
5173
|
-
*/
|
|
5174
|
-
isOutgoing: boolean;
|
|
5175
|
-
/**
|
|
5176
|
-
*@description Whether it's an active hangup
|
|
5177
|
-
*/
|
|
5178
|
-
isUnprompted: boolean;
|
|
5179
|
-
/**
|
|
5180
|
-
*@description Whether the current session is invited
|
|
5181
|
-
*/
|
|
5182
|
-
hasInvite: boolean;
|
|
5183
|
-
constructor(callKit: CallKit);
|
|
5184
|
-
get reconnectConfig(): SipConfig;
|
|
5185
|
-
private currentCallId;
|
|
5186
|
-
getCurrentCallId(): string | null;
|
|
5187
|
-
/**
|
|
5188
|
-
*@description Whether the SIP socket is error
|
|
5189
|
-
*/
|
|
5190
|
-
private _isError;
|
|
5191
|
-
get isError(): boolean;
|
|
5192
|
-
/**
|
|
5193
|
-
*@description Set whether it's in call refering dealwith disconnect recovery
|
|
5194
|
-
*/
|
|
5195
|
-
private setInCallRefering;
|
|
5196
|
-
setRefering(refering: boolean): void;
|
|
5197
|
-
private setIsReConnected;
|
|
5198
|
-
setOutgoing(outgoing: boolean): void;
|
|
5199
|
-
setCallId(callId: string | null): void;
|
|
5200
|
-
reset({ force }?: {
|
|
5201
|
-
force?: boolean;
|
|
5202
|
-
}): Promise<void>;
|
|
5203
|
-
private getAduioReference;
|
|
5204
|
-
permission(): Promise<boolean>;
|
|
5205
|
-
/**
|
|
5206
|
-
* Making connection
|
|
5207
|
-
* @returns
|
|
5208
|
-
*/
|
|
5209
|
-
isConnecting(): boolean;
|
|
5210
|
-
/**
|
|
5211
|
-
* In call
|
|
5212
|
-
* @returns
|
|
5213
|
-
*/
|
|
5214
|
-
isCalling(): boolean;
|
|
5215
|
-
/**
|
|
5216
|
-
* Ringing
|
|
5217
|
-
*/
|
|
5218
|
-
isRinging(): boolean;
|
|
5219
|
-
/**
|
|
5220
|
-
* isHolding
|
|
5221
|
-
*/
|
|
5222
|
-
isHolding(): boolean;
|
|
5223
|
-
/**
|
|
5224
|
-
* isRegistered
|
|
5225
|
-
*/
|
|
5226
|
-
isRegistered(): boolean;
|
|
5227
|
-
/**
|
|
5228
|
-
* isMute
|
|
5229
|
-
*/
|
|
5230
|
-
isMuted(): boolean;
|
|
5231
|
-
/**
|
|
5232
|
-
* isRefering
|
|
5233
|
-
*/
|
|
5234
|
-
isRefering(): boolean;
|
|
5235
|
-
/**
|
|
5236
|
-
* isInCallRefering
|
|
5237
|
-
*/
|
|
5238
|
-
isInCallRefering(): boolean;
|
|
5239
|
-
/**
|
|
5240
|
-
* Call ended, call not started
|
|
5241
|
-
* @returns
|
|
5242
|
-
*/
|
|
5243
|
-
isInit(): boolean;
|
|
5244
|
-
socketTriggerHangup(callId: string): void;
|
|
5245
|
-
/**
|
|
5246
|
-
* Setup registerer and bind stateChange listener
|
|
5247
|
-
* @private
|
|
5248
|
-
*/
|
|
5249
|
-
private setupRegisterer;
|
|
5250
|
-
register(): Promise<void>;
|
|
5251
|
-
private reconnectTimer?;
|
|
5252
|
-
private reconnectAttempts;
|
|
5253
|
-
private startReconnectTimer;
|
|
5254
|
-
stop(): Promise<void>;
|
|
5255
|
-
unregister(): Promise<void>;
|
|
5256
|
-
call(callback: (userInfo: IConfig['userInfo']) => void): Promise<void>;
|
|
5257
|
-
/**
|
|
5258
|
-
* Update registration status
|
|
5259
|
-
* @param register
|
|
5260
|
-
*/
|
|
5261
|
-
setRegister(register: boolean): void;
|
|
5262
|
-
/**
|
|
5263
|
-
* Set call status
|
|
5264
|
-
* @param status
|
|
5265
|
-
*/
|
|
5266
|
-
setConnectStatus(status: CallStatusType): void;
|
|
5267
|
-
/**
|
|
5268
|
-
* Hang up
|
|
5269
|
-
* @param isUnprompted Whether actively hanging up
|
|
5270
|
-
* @param isError Whether an error occurred
|
|
5271
|
-
* @returns
|
|
5272
|
-
*/
|
|
5273
|
-
hangup(isUnprompted?: boolean, isError?: boolean): Promise<void>;
|
|
5274
|
-
/**
|
|
5275
|
-
* Terminate active call (connecting calling ringing)
|
|
5276
|
-
*/
|
|
5277
|
-
private terminateActiveCall;
|
|
5278
|
-
/**
|
|
5279
|
-
* The remote media stream. Undefined if call not answered.
|
|
5280
|
-
* @param session - Session to get the media stream from.
|
|
5281
|
-
*/
|
|
5282
|
-
getRemoteMediaStream(session: any): any;
|
|
5283
|
-
setupRemoteMedia(session: any): void;
|
|
5284
|
-
setHold(hold: boolean): Promise<void>;
|
|
5285
|
-
setMute(mute: boolean): Promise<void>;
|
|
5286
|
-
refer(referTo: string, extra?: any): Promise<void>;
|
|
5287
|
-
private referInCall;
|
|
5140
|
+
type CallStatusType = (typeof CallStatus)[keyof typeof CallStatus];
|
|
5141
|
+
declare class Connect {
|
|
5142
|
+
callKit: CallKit;
|
|
5143
|
+
/**
|
|
5144
|
+
*@description Whether muted
|
|
5145
|
+
*/
|
|
5146
|
+
private isMute;
|
|
5147
|
+
/**
|
|
5148
|
+
*@description Whether registered
|
|
5149
|
+
*/
|
|
5150
|
+
private isRegister;
|
|
5151
|
+
/**
|
|
5152
|
+
*@description Whether holding
|
|
5153
|
+
*/
|
|
5154
|
+
private isHold;
|
|
5155
|
+
/**
|
|
5156
|
+
*@description Connect status: init registered connecting calling
|
|
5157
|
+
*/
|
|
5158
|
+
connectStatus: number;
|
|
5159
|
+
currentSession?: Invitation;
|
|
5160
|
+
mediaStream?: MediaStream;
|
|
5161
|
+
userAgent?: UserAgent;
|
|
5162
|
+
registerer?: Registerer;
|
|
5163
|
+
/**
|
|
5164
|
+
*@description Whether it's a re-connected
|
|
5165
|
+
*/
|
|
5166
|
+
isReConnected: boolean;
|
|
5167
|
+
/**
|
|
5168
|
+
*@description Whether it's a referring
|
|
5169
|
+
*/
|
|
5170
|
+
private _isRefering;
|
|
5171
|
+
/**
|
|
5172
|
+
*@description Whether it's in call refering dealwith disconnect recovery
|
|
5173
|
+
*/
|
|
5174
|
+
private _isInCallRefering;
|
|
5175
|
+
/**
|
|
5176
|
+
*@description Whether it's an outgoing call
|
|
5177
|
+
*/
|
|
5178
|
+
isOutgoing: boolean;
|
|
5179
|
+
/**
|
|
5180
|
+
*@description Whether it's an active hangup
|
|
5181
|
+
*/
|
|
5182
|
+
isUnprompted: boolean;
|
|
5183
|
+
/**
|
|
5184
|
+
*@description Whether the current session is invited
|
|
5185
|
+
*/
|
|
5186
|
+
hasInvite: boolean;
|
|
5187
|
+
constructor(callKit: CallKit);
|
|
5188
|
+
get reconnectConfig(): SipConfig;
|
|
5189
|
+
private currentCallId;
|
|
5190
|
+
getCurrentCallId(): string | null;
|
|
5191
|
+
/**
|
|
5192
|
+
*@description Whether the SIP socket is error
|
|
5193
|
+
*/
|
|
5194
|
+
private _isError;
|
|
5195
|
+
get isError(): boolean;
|
|
5196
|
+
/**
|
|
5197
|
+
*@description Set whether it's in call refering dealwith disconnect recovery
|
|
5198
|
+
*/
|
|
5199
|
+
private setInCallRefering;
|
|
5200
|
+
setRefering(refering: boolean): void;
|
|
5201
|
+
private setIsReConnected;
|
|
5202
|
+
setOutgoing(outgoing: boolean): void;
|
|
5203
|
+
setCallId(callId: string | null): void;
|
|
5204
|
+
reset({ force }?: {
|
|
5205
|
+
force?: boolean;
|
|
5206
|
+
}): Promise<void>;
|
|
5207
|
+
private getAduioReference;
|
|
5208
|
+
permission(): Promise<boolean>;
|
|
5209
|
+
/**
|
|
5210
|
+
* Making connection
|
|
5211
|
+
* @returns
|
|
5212
|
+
*/
|
|
5213
|
+
isConnecting(): boolean;
|
|
5214
|
+
/**
|
|
5215
|
+
* In call
|
|
5216
|
+
* @returns
|
|
5217
|
+
*/
|
|
5218
|
+
isCalling(): boolean;
|
|
5219
|
+
/**
|
|
5220
|
+
* Ringing
|
|
5221
|
+
*/
|
|
5222
|
+
isRinging(): boolean;
|
|
5223
|
+
/**
|
|
5224
|
+
* isHolding
|
|
5225
|
+
*/
|
|
5226
|
+
isHolding(): boolean;
|
|
5227
|
+
/**
|
|
5228
|
+
* isRegistered
|
|
5229
|
+
*/
|
|
5230
|
+
isRegistered(): boolean;
|
|
5231
|
+
/**
|
|
5232
|
+
* isMute
|
|
5233
|
+
*/
|
|
5234
|
+
isMuted(): boolean;
|
|
5235
|
+
/**
|
|
5236
|
+
* isRefering
|
|
5237
|
+
*/
|
|
5238
|
+
isRefering(): boolean;
|
|
5239
|
+
/**
|
|
5240
|
+
* isInCallRefering
|
|
5241
|
+
*/
|
|
5242
|
+
isInCallRefering(): boolean;
|
|
5243
|
+
/**
|
|
5244
|
+
* Call ended, call not started
|
|
5245
|
+
* @returns
|
|
5246
|
+
*/
|
|
5247
|
+
isInit(): boolean;
|
|
5248
|
+
socketTriggerHangup(callId: string): void;
|
|
5249
|
+
/**
|
|
5250
|
+
* Setup registerer and bind stateChange listener
|
|
5251
|
+
* @private
|
|
5252
|
+
*/
|
|
5253
|
+
private setupRegisterer;
|
|
5254
|
+
register(): Promise<void>;
|
|
5255
|
+
private reconnectTimer?;
|
|
5256
|
+
private reconnectAttempts;
|
|
5257
|
+
private startReconnectTimer;
|
|
5258
|
+
stop(): Promise<void>;
|
|
5259
|
+
unregister(): Promise<void>;
|
|
5260
|
+
call(callback: (userInfo: IConfig['userInfo']) => void): Promise<void>;
|
|
5261
|
+
/**
|
|
5262
|
+
* Update registration status
|
|
5263
|
+
* @param register
|
|
5264
|
+
*/
|
|
5265
|
+
setRegister(register: boolean): void;
|
|
5266
|
+
/**
|
|
5267
|
+
* Set call status
|
|
5268
|
+
* @param status
|
|
5269
|
+
*/
|
|
5270
|
+
setConnectStatus(status: CallStatusType): void;
|
|
5271
|
+
/**
|
|
5272
|
+
* Hang up
|
|
5273
|
+
* @param isUnprompted Whether actively hanging up
|
|
5274
|
+
* @param isError Whether an error occurred
|
|
5275
|
+
* @returns
|
|
5276
|
+
*/
|
|
5277
|
+
hangup(isUnprompted?: boolean, isError?: boolean): Promise<void>;
|
|
5278
|
+
/**
|
|
5279
|
+
* Terminate active call (connecting calling ringing)
|
|
5280
|
+
*/
|
|
5281
|
+
private terminateActiveCall;
|
|
5282
|
+
/**
|
|
5283
|
+
* The remote media stream. Undefined if call not answered.
|
|
5284
|
+
* @param session - Session to get the media stream from.
|
|
5285
|
+
*/
|
|
5286
|
+
getRemoteMediaStream(session: any): any;
|
|
5287
|
+
setupRemoteMedia(session: any): void;
|
|
5288
|
+
setHold(hold: boolean): Promise<void>;
|
|
5289
|
+
setMute(mute: boolean): Promise<void>;
|
|
5290
|
+
refer(referTo: string, extra?: any): Promise<void>;
|
|
5291
|
+
private referInCall;
|
|
5288
5292
|
}
|
|
5289
5293
|
|
|
5290
|
-
interface CallKitConfig {
|
|
5291
|
-
host: string;
|
|
5292
|
-
audioRef: HTMLAudioElement | (() => HTMLAudioElement);
|
|
5293
|
-
socket: string;
|
|
5294
|
-
constrains?: WebrtcConstranis;
|
|
5295
|
-
log?: LoggerLevel;
|
|
5296
|
-
reconnect?: {
|
|
5297
|
-
sip?: Partial<SipConfig>;
|
|
5298
|
-
incall?: Partial<IncallConfig>;
|
|
5299
|
-
};
|
|
5300
|
-
}
|
|
5301
|
-
type ConfigEntity = Partial<IConfig> & CallKitConfig;
|
|
5302
|
-
type kitEventType = (typeof KitEvent)[keyof typeof KitEvent];
|
|
5303
|
-
interface Listener {
|
|
5304
|
-
event: kitEventType;
|
|
5305
|
-
callback: (...args: any[]) => void;
|
|
5306
|
-
}
|
|
5307
|
-
declare class CallKit {
|
|
5308
|
-
api: Api;
|
|
5309
|
-
config: Config;
|
|
5310
|
-
logger: Logger$1;
|
|
5311
|
-
callCenter: Call;
|
|
5312
|
-
connect: Connect;
|
|
5313
|
-
socket: Socket;
|
|
5314
|
-
listener: Listener[];
|
|
5315
|
-
constructor(options: ConfigEntity);
|
|
5316
|
-
login(username: string, password: string, extra?: {
|
|
5317
|
-
[key: string]: any;
|
|
5318
|
-
}): Promise<void>;
|
|
5319
|
-
logout({ isReset }?: {
|
|
5320
|
-
isReset?: boolean;
|
|
5321
|
-
}): Promise<void>;
|
|
5322
|
-
call(extno?: string | number, options?: Partial<CallParams>): Promise<void>;
|
|
5323
|
-
refer(uri: string, options?: any): Promise<void>;
|
|
5324
|
-
register(): Promise<void>;
|
|
5325
|
-
unregister(): Promise<void>;
|
|
5326
|
-
hangup(): Promise<void>;
|
|
5327
|
-
hold(): void;
|
|
5328
|
-
unhold(): void;
|
|
5329
|
-
mute(): void;
|
|
5330
|
-
unmute(): void;
|
|
5331
|
-
/**
|
|
5332
|
-
* set userstatus
|
|
5333
|
-
* @param status
|
|
5334
|
-
*/
|
|
5335
|
-
setUserStatus(status: number, extra?: {
|
|
5336
|
-
[key: string]: any;
|
|
5337
|
-
}): Promise<
|
|
5338
|
-
/**
|
|
5339
|
-
* reset callkit
|
|
5340
|
-
* @description recover the callkit to the initial state
|
|
5341
|
-
* @default force is false
|
|
5342
|
-
* @param config.force is true, the callkit reset socket connection and all states
|
|
5343
|
-
*/
|
|
5344
|
-
reset(config?: {
|
|
5345
|
-
force?: boolean;
|
|
5346
|
-
}): Promise<void>;
|
|
5347
|
-
on(event: kitEventType, callback: (...args: any[]) => void): void;
|
|
5348
|
-
off(event: kitEventType, callback?: (...args: any[]) => void): void;
|
|
5349
|
-
removeAllListeners(): void;
|
|
5350
|
-
trigger(event: kitEventType, data?: any, noLog?: boolean): void;
|
|
5294
|
+
interface CallKitConfig {
|
|
5295
|
+
host: string;
|
|
5296
|
+
audioRef: HTMLAudioElement | (() => HTMLAudioElement);
|
|
5297
|
+
socket: string;
|
|
5298
|
+
constrains?: WebrtcConstranis;
|
|
5299
|
+
log?: LoggerLevel;
|
|
5300
|
+
reconnect?: {
|
|
5301
|
+
sip?: Partial<SipConfig>;
|
|
5302
|
+
incall?: Partial<IncallConfig>;
|
|
5303
|
+
};
|
|
5304
|
+
}
|
|
5305
|
+
type ConfigEntity = Partial<IConfig> & CallKitConfig;
|
|
5306
|
+
type kitEventType = (typeof KitEvent)[keyof typeof KitEvent];
|
|
5307
|
+
interface Listener {
|
|
5308
|
+
event: kitEventType;
|
|
5309
|
+
callback: (...args: any[]) => void;
|
|
5310
|
+
}
|
|
5311
|
+
declare class CallKit {
|
|
5312
|
+
api: Api;
|
|
5313
|
+
config: Config;
|
|
5314
|
+
logger: Logger$1;
|
|
5315
|
+
callCenter: Call;
|
|
5316
|
+
connect: Connect;
|
|
5317
|
+
socket: Socket;
|
|
5318
|
+
listener: Listener[];
|
|
5319
|
+
constructor(options: ConfigEntity);
|
|
5320
|
+
login(username: string, password: string, extra?: {
|
|
5321
|
+
[key: string]: any;
|
|
5322
|
+
}): Promise<void>;
|
|
5323
|
+
logout({ isReset }?: {
|
|
5324
|
+
isReset?: boolean;
|
|
5325
|
+
}): Promise<void>;
|
|
5326
|
+
call(extno?: string | number, options?: Partial<CallParams>): Promise<void>;
|
|
5327
|
+
refer(uri: string, options?: any): Promise<void>;
|
|
5328
|
+
register(): Promise<void>;
|
|
5329
|
+
unregister(): Promise<void>;
|
|
5330
|
+
hangup(): Promise<void>;
|
|
5331
|
+
hold(): void;
|
|
5332
|
+
unhold(): void;
|
|
5333
|
+
mute(): void;
|
|
5334
|
+
unmute(): void;
|
|
5335
|
+
/**
|
|
5336
|
+
* set userstatus
|
|
5337
|
+
* @param status
|
|
5338
|
+
*/
|
|
5339
|
+
setUserStatus(status: number, extra?: {
|
|
5340
|
+
[key: string]: any;
|
|
5341
|
+
}): Promise<any>;
|
|
5342
|
+
/**
|
|
5343
|
+
* reset callkit
|
|
5344
|
+
* @description recover the callkit to the initial state
|
|
5345
|
+
* @default force is false
|
|
5346
|
+
* @param config.force is true, the callkit reset socket connection and all states
|
|
5347
|
+
*/
|
|
5348
|
+
reset(config?: {
|
|
5349
|
+
force?: boolean;
|
|
5350
|
+
}): Promise<void>;
|
|
5351
|
+
on(event: kitEventType, callback: (...args: any[]) => void): void;
|
|
5352
|
+
off(event: kitEventType, callback?: (...args: any[]) => void): void;
|
|
5353
|
+
removeAllListeners(): void;
|
|
5354
|
+
trigger(event: kitEventType, data?: any, noLog?: boolean): void;
|
|
5351
5355
|
}
|
|
5352
5356
|
|
|
5353
5357
|
export { CallKit, CallKitConfig, ConfigEntity, kitEventType };
|