ue-softphone-sdk 4.0.38 → 5.0.0
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 +1 -7
- package/dist/lib/types/config.d.ts +14 -11
- package/dist/lib/types/core/commands/call-command.d.ts +18 -0
- package/dist/lib/types/core/commands/command-executor.d.ts +14 -0
- package/dist/lib/types/core/config/config-manager.d.ts +11 -0
- package/dist/lib/types/core/events/event-bus.d.ts +14 -0
- package/dist/lib/types/core/interceptors/common-interceptors.d.ts +16 -0
- package/dist/lib/types/core/pipeline/request-pipeline.d.ts +24 -0
- package/dist/lib/types/core/runtime.d.ts +26 -0
- package/dist/lib/types/core/state/state-manager.d.ts +9 -0
- package/dist/lib/types/core/transport/transport-layer.d.ts +26 -0
- package/dist/lib/types/core/types/result.d.ts +19 -0
- package/dist/lib/types/core/webrtc/media-controller.d.ts +14 -0
- package/dist/lib/types/index.d.ts +44 -266
- package/dist/lib/types/sdk/agent-api.d.ts +10 -0
- package/dist/lib/types/sdk/agent-commands.d.ts +10 -0
- package/dist/lib/types/sdk/api-support.d.ts +19 -0
- package/dist/lib/types/sdk/audio-utils.d.ts +18 -0
- package/dist/lib/types/sdk/auth.d.ts +28 -0
- package/dist/lib/types/sdk/call-api.d.ts +22 -0
- package/dist/lib/types/sdk/call-commands.d.ts +14 -0
- package/dist/lib/types/sdk/command-registry.d.ts +12 -0
- package/dist/lib/types/sdk/constants.d.ts +10 -0
- package/dist/lib/types/sdk/http-runtime.d.ts +14 -0
- package/dist/lib/types/sdk/init-options.d.ts +12 -0
- package/dist/lib/types/sdk/media.d.ts +37 -0
- package/dist/lib/types/sdk/monitor-workflow.d.ts +10 -0
- package/dist/lib/types/sdk/monitor.d.ts +48 -0
- package/dist/lib/types/sdk/request-utils.d.ts +8 -0
- package/dist/lib/types/sdk/resource-manager.d.ts +16 -0
- package/dist/lib/types/sdk/runtime.d.ts +5 -0
- package/dist/lib/types/sdk/sdk-bootstrap.d.ts +4 -0
- package/dist/lib/types/sdk/sdk-facade.d.ts +43 -0
- package/dist/lib/types/sdk/sdk-store.d.ts +26 -0
- package/dist/lib/types/sdk/session-workflow.d.ts +12 -0
- package/dist/lib/types/sdk/session.d.ts +43 -0
- package/dist/lib/types/sdk/socket-helpers.d.ts +9 -0
- package/dist/lib/types/sdk/socket-runtime.d.ts +5 -0
- package/dist/lib/types/sdk/types.d.ts +154 -0
- package/dist/lib/types/sdk/webrtc-api.d.ts +14 -0
- package/dist/lib/types/webrtc/webrtc-adapter.d.ts +6 -0
- package/dist/lib/types/webrtc/webrtc.d.ts +1 -38
- package/dist/lib/ue-soft-phone.min.js +1 -1
- package/dist/types/config.d.ts +14 -11
- package/dist/types/core/commands/call-command.d.ts +18 -0
- package/dist/types/core/commands/command-executor.d.ts +14 -0
- package/dist/types/core/config/config-manager.d.ts +11 -0
- package/dist/types/core/events/event-bus.d.ts +14 -0
- package/dist/types/core/interceptors/common-interceptors.d.ts +16 -0
- package/dist/types/core/pipeline/request-pipeline.d.ts +24 -0
- package/dist/types/core/runtime.d.ts +26 -0
- package/dist/types/core/state/state-manager.d.ts +9 -0
- package/dist/types/core/transport/transport-layer.d.ts +26 -0
- package/dist/types/core/types/result.d.ts +19 -0
- package/dist/types/core/webrtc/media-controller.d.ts +14 -0
- package/dist/types/index.d.ts +44 -266
- package/dist/types/sdk/agent-api.d.ts +10 -0
- package/dist/types/sdk/agent-commands.d.ts +10 -0
- package/dist/types/sdk/api-support.d.ts +19 -0
- package/dist/types/sdk/audio-utils.d.ts +18 -0
- package/dist/types/sdk/auth.d.ts +28 -0
- package/dist/types/sdk/call-api.d.ts +22 -0
- package/dist/types/sdk/call-commands.d.ts +14 -0
- package/dist/types/sdk/command-registry.d.ts +12 -0
- package/dist/types/sdk/constants.d.ts +10 -0
- package/dist/types/sdk/http-runtime.d.ts +14 -0
- package/dist/types/sdk/init-options.d.ts +12 -0
- package/dist/types/sdk/media.d.ts +37 -0
- package/dist/types/sdk/monitor-workflow.d.ts +10 -0
- package/dist/types/sdk/monitor.d.ts +48 -0
- package/dist/types/sdk/request-utils.d.ts +8 -0
- package/dist/types/sdk/resource-manager.d.ts +16 -0
- package/dist/types/sdk/runtime.d.ts +5 -0
- package/dist/types/sdk/sdk-bootstrap.d.ts +4 -0
- package/dist/types/sdk/sdk-facade.d.ts +43 -0
- package/dist/types/sdk/sdk-store.d.ts +26 -0
- package/dist/types/sdk/session-workflow.d.ts +12 -0
- package/dist/types/sdk/session.d.ts +43 -0
- package/dist/types/sdk/socket-helpers.d.ts +9 -0
- package/dist/types/sdk/socket-runtime.d.ts +5 -0
- package/dist/types/sdk/types.d.ts +154 -0
- package/dist/types/sdk/webrtc-api.d.ts +14 -0
- package/dist/types/webrtc/webrtc-adapter.d.ts +6 -0
- package/dist/types/webrtc/webrtc.d.ts +1 -38
- package/dist/ue-softphone-sdk.js +1 -1
- package/package.json +1 -1
- package/dist/lib/types/webrtc/webrtc-method.d.ts +0 -2
- package/dist/types/webrtc/webrtc-method.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: cuixuecheng
|
|
3
|
-
* @Date: 2023-02-21 19:49:47
|
|
4
|
-
* @LastEditors: cuixuecheng
|
|
5
|
-
* @LastEditTime: 2023-07-02 12:55:08
|
|
6
|
-
* @Description:
|
|
7
|
-
-->
|
|
8
1
|
极简互联电话条sdk
|
|
9
2
|
> 4.0.12 针对safari 浏览器获取麦克风权限的适配
|
|
10
3
|
> 4.0.13 网络检测请求地址修改;增加音量检测事件
|
|
@@ -17,3 +10,4 @@
|
|
|
17
10
|
> 4.0.27 修复退出登录时socket关闭错误,导致用户再次初始化状态异常
|
|
18
11
|
> 4.0.30 登录增加passwordPk参数
|
|
19
12
|
> 4.0.31 muteRing方法关闭铃声后,也不要挂断提示音
|
|
13
|
+
> 5.0.0 新测试demo升级
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
notOpenAudioMsg: string;
|
|
3
|
-
notOpenAudioCode: number;
|
|
4
|
-
notOpenAudioMsgEn: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
forbiddenAudioMsg: string;
|
|
8
|
-
forbiddenAudioCode: number;
|
|
9
|
-
forbiddenAudioMsgEn: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const
|
|
1
|
+
type MicrophoneClosedNotice = Readonly<{
|
|
2
|
+
["notOpenAudioMsg"]: string;
|
|
3
|
+
["notOpenAudioCode"]: number;
|
|
4
|
+
["notOpenAudioMsgEn"]: string;
|
|
5
|
+
}>;
|
|
6
|
+
type MicrophoneDeniedNotice = Readonly<{
|
|
7
|
+
["forbiddenAudioMsg"]: string;
|
|
8
|
+
["forbiddenAudioCode"]: number;
|
|
9
|
+
["forbiddenAudioMsgEn"]: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const NOT_OPEN_AUDIO: MicrophoneClosedNotice;
|
|
12
|
+
export declare const AUDIO_FORBIDDEN: MicrophoneDeniedNotice;
|
|
13
|
+
export declare const DENIED: "denied";
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Command } from "./command-executor";
|
|
2
|
+
import type { RequestPipeline } from "../pipeline/request-pipeline";
|
|
3
|
+
import type { Result } from "../types/result";
|
|
4
|
+
interface CallCommandPayload {
|
|
5
|
+
endpoint: string;
|
|
6
|
+
body: any;
|
|
7
|
+
onSuccess?: (data: any) => void;
|
|
8
|
+
onFail?: (err: any) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare class CallCommand implements Command {
|
|
11
|
+
private pipeline;
|
|
12
|
+
private baseUrl;
|
|
13
|
+
payload: CallCommandPayload;
|
|
14
|
+
type: string;
|
|
15
|
+
constructor(pipeline: RequestPipeline, baseUrl: string, payload: CallCommandPayload);
|
|
16
|
+
execute(): Promise<Result<any, any>>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EventBus } from "../events/event-bus";
|
|
2
|
+
import type { Result } from "../types/result";
|
|
3
|
+
export interface Command<T = any> {
|
|
4
|
+
type: string;
|
|
5
|
+
payload: any;
|
|
6
|
+
execute(): Promise<Result<T, any>>;
|
|
7
|
+
}
|
|
8
|
+
export declare class CommandExecutor {
|
|
9
|
+
private eventBus;
|
|
10
|
+
private history;
|
|
11
|
+
constructor(eventBus: EventBus);
|
|
12
|
+
execute<T>(command: Command<T>): Promise<Result<T, any>>;
|
|
13
|
+
getHistory(): Command[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ConfigValidator<T> = (value: T) => boolean;
|
|
2
|
+
export declare class ConfigManager<T extends Record<string, any>> {
|
|
3
|
+
private layers;
|
|
4
|
+
private validators;
|
|
5
|
+
private cache;
|
|
6
|
+
addLayer(priority: number, values: Partial<T>): void;
|
|
7
|
+
setValidator<K extends keyof T>(key: K, validator: ConfigValidator<T[K]>): void;
|
|
8
|
+
get<K extends keyof T>(key: K, defaultValue: T[K]): T[K];
|
|
9
|
+
set<K extends keyof T>(key: K, value: T[K], priority?: number): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type EventHandler<T = any> = (data: T) => void | Promise<void>;
|
|
2
|
+
interface Subscription {
|
|
3
|
+
unsubscribe: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare class EventBus {
|
|
6
|
+
private handlers;
|
|
7
|
+
private onceHandlers;
|
|
8
|
+
on<T = any>(event: string, handler: EventHandler<T>): Subscription;
|
|
9
|
+
once<T = any>(event: string, handler: EventHandler<T>): Subscription;
|
|
10
|
+
off(event: string, handler: EventHandler): void;
|
|
11
|
+
emit<T = any>(event: string, data: T): Promise<void>;
|
|
12
|
+
clear(event?: string): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Interceptor, RequestContext } from "../pipeline/request-pipeline";
|
|
2
|
+
export declare class AuthInterceptor implements Interceptor {
|
|
3
|
+
private getToken;
|
|
4
|
+
private getSessionId;
|
|
5
|
+
name: string;
|
|
6
|
+
constructor(getToken: () => string | undefined, getSessionId: () => string | undefined);
|
|
7
|
+
request(ctx: RequestContext): RequestContext;
|
|
8
|
+
}
|
|
9
|
+
export declare class EncryptionInterceptor implements Interceptor {
|
|
10
|
+
name: string;
|
|
11
|
+
request(ctx: RequestContext): RequestContext;
|
|
12
|
+
}
|
|
13
|
+
export declare class ErrorHandlerInterceptor implements Interceptor {
|
|
14
|
+
name: string;
|
|
15
|
+
error(err: any): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Result } from "../types/result";
|
|
2
|
+
export interface RequestContext {
|
|
3
|
+
url: string;
|
|
4
|
+
method: string;
|
|
5
|
+
headers: Record<string, string>;
|
|
6
|
+
body?: any;
|
|
7
|
+
metadata: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface ResponseContext<T = any> {
|
|
10
|
+
status: number;
|
|
11
|
+
data: T;
|
|
12
|
+
headers: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface Interceptor {
|
|
15
|
+
name: string;
|
|
16
|
+
request?: (ctx: RequestContext) => Promise<RequestContext> | RequestContext;
|
|
17
|
+
response?: <T>(ctx: ResponseContext<T>) => Promise<ResponseContext<T>> | ResponseContext<T>;
|
|
18
|
+
error?: (err: any, ctx: RequestContext) => Promise<any> | any;
|
|
19
|
+
}
|
|
20
|
+
export declare class RequestPipeline {
|
|
21
|
+
private interceptors;
|
|
22
|
+
use(interceptor: Interceptor): void;
|
|
23
|
+
execute<T>(ctx: RequestContext, fetcher: (ctx: RequestContext) => Promise<Response>): Promise<Result<ResponseContext<T>, any>>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventBus } from "./events/event-bus";
|
|
2
|
+
import { RequestPipeline } from "./pipeline/request-pipeline";
|
|
3
|
+
import { CommandExecutor } from "./commands/command-executor";
|
|
4
|
+
import { MediaController } from "./webrtc/media-controller";
|
|
5
|
+
import { TransportLayer } from "./transport/transport-layer";
|
|
6
|
+
import { StateManager } from "./state/state-manager";
|
|
7
|
+
interface RuntimeState {
|
|
8
|
+
loginToken?: string;
|
|
9
|
+
sessionId?: string;
|
|
10
|
+
agentInfo?: any;
|
|
11
|
+
callApiUrl: string;
|
|
12
|
+
isKickedOff: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class CoreRuntime {
|
|
15
|
+
readonly eventBus: EventBus;
|
|
16
|
+
readonly pipeline: RequestPipeline;
|
|
17
|
+
readonly executor: CommandExecutor;
|
|
18
|
+
readonly mediaController: MediaController;
|
|
19
|
+
readonly state: StateManager<RuntimeState>;
|
|
20
|
+
private transports;
|
|
21
|
+
constructor();
|
|
22
|
+
createTransport(key: string, config: any, socketFactory: any): TransportLayer;
|
|
23
|
+
getTransport(key: string): TransportLayer | undefined;
|
|
24
|
+
cleanup(): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { EventBus } from "../events/event-bus";
|
|
2
|
+
export declare enum ConnectionState {
|
|
3
|
+
IDLE = 0,
|
|
4
|
+
CONNECTING = 1,
|
|
5
|
+
CONNECTED = 2,
|
|
6
|
+
RECONNECTING = 3,
|
|
7
|
+
DISCONNECTED = 4,
|
|
8
|
+
FAILED = 5
|
|
9
|
+
}
|
|
10
|
+
export interface TransportConfig {
|
|
11
|
+
server: string;
|
|
12
|
+
options: any;
|
|
13
|
+
reconnectDelay?: number;
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class TransportLayer {
|
|
17
|
+
private config;
|
|
18
|
+
private eventBus;
|
|
19
|
+
private socketFactory;
|
|
20
|
+
private state;
|
|
21
|
+
private socket;
|
|
22
|
+
private retries;
|
|
23
|
+
private reconnectTimer;
|
|
24
|
+
constructor(config: TransportConfig, eventBus: EventBus, socketFactory: (server: string, options: any) => any);
|
|
25
|
+
private handleError;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
2
|
+
export declare class Success<T> {
|
|
3
|
+
readonly value: T;
|
|
4
|
+
readonly ok = true;
|
|
5
|
+
constructor(value: T);
|
|
6
|
+
map<U>(fn: (val: T) => U): Result<U, never>;
|
|
7
|
+
flatMap<U, E>(fn: (val: T) => Result<U, E>): Result<U, E>;
|
|
8
|
+
unwrap(): T;
|
|
9
|
+
}
|
|
10
|
+
export declare class Failure<E> {
|
|
11
|
+
readonly error: E;
|
|
12
|
+
readonly ok = false;
|
|
13
|
+
constructor(error: E);
|
|
14
|
+
map<U>(): Result<U, E>;
|
|
15
|
+
flatMap<U>(): Result<U, E>;
|
|
16
|
+
unwrap(): never;
|
|
17
|
+
}
|
|
18
|
+
export declare const ok: <T>(value: T) => Result<T, never>;
|
|
19
|
+
export declare const fail: <E>(error: E) => Result<never, E>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EventBus } from "../events/event-bus";
|
|
2
|
+
import type { WebrtcOptions } from "../../webrtc/webrtc-adapter";
|
|
3
|
+
export declare class MediaController {
|
|
4
|
+
private eventBus;
|
|
5
|
+
private webPhone;
|
|
6
|
+
constructor(eventBus: EventBus);
|
|
7
|
+
preparePhone(config: WebrtcOptions): Promise<void>;
|
|
8
|
+
answerIncoming(): void;
|
|
9
|
+
ensureOnline(): void;
|
|
10
|
+
releasePhone(): Promise<void>;
|
|
11
|
+
pushTone(tone: string): void;
|
|
12
|
+
hasActivePhone(): boolean;
|
|
13
|
+
currentPhone(): any;
|
|
14
|
+
}
|
|
@@ -1,223 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
type ExtenType = "PSTN" | "SIP" | "WEBRTC";
|
|
3
|
-
interface AudioInfo {
|
|
4
|
-
notOpenAudioMsg: string;
|
|
5
|
-
notOpenAudioCode: number;
|
|
6
|
-
notOpenAudioMsgEn: string;
|
|
7
|
-
forbiddenAudioMsg: string;
|
|
8
|
-
forbiddenAudioCode: number;
|
|
9
|
-
forbiddenAudioMsgEn: string;
|
|
10
|
-
}
|
|
11
|
-
interface InitOptions {
|
|
12
|
-
accountId?: string;
|
|
13
|
-
agentNumber?: string;
|
|
14
|
-
accountName?: string;
|
|
15
|
-
password?: string;
|
|
16
|
-
passwordPk?: string;
|
|
17
|
-
loginType?: ExtenType;
|
|
18
|
-
debug?: DebugType | DebugType[] | boolean;
|
|
19
|
-
success?: Function;
|
|
20
|
-
error?: Function;
|
|
21
|
-
server?: string;
|
|
22
|
-
audioInfo?: AudioInfo;
|
|
23
|
-
sdkMonitorType?: any;
|
|
24
|
-
isOpenNetwork?: boolean;
|
|
25
|
-
volume?: {
|
|
26
|
-
open: boolean;
|
|
27
|
-
interval: number;
|
|
28
|
-
};
|
|
29
|
-
pushHangupStatistics?: boolean;
|
|
30
|
-
pushCallinRingStatistics?: boolean;
|
|
31
|
-
isOpenCallQueue?: boolean;
|
|
32
|
-
openNlsTranslation?: boolean;
|
|
33
|
-
monitor?: boolean;
|
|
34
|
-
}
|
|
35
|
-
interface OnCallEventParams {
|
|
36
|
-
success?: Function;
|
|
37
|
-
message?: Function;
|
|
38
|
-
error?: Function;
|
|
39
|
-
event?: Function;
|
|
40
|
-
}
|
|
41
|
-
interface OnCallVolumeParams {
|
|
42
|
-
success?: Function;
|
|
43
|
-
message?: Function;
|
|
44
|
-
error?: Function;
|
|
45
|
-
event?: Function;
|
|
46
|
-
}
|
|
47
|
-
interface DialoutParams {
|
|
48
|
-
agentNumber?: String;
|
|
49
|
-
accountId: String;
|
|
50
|
-
agentId: String;
|
|
51
|
-
loginType?: String;
|
|
52
|
-
customerNumber: String;
|
|
53
|
-
agentTimeout?: String;
|
|
54
|
-
customerTimeout?: String;
|
|
55
|
-
agentDisNumber?: String;
|
|
56
|
-
customerDisNumber?: String;
|
|
57
|
-
extras?: any;
|
|
58
|
-
success?: Function;
|
|
59
|
-
fail?: Function;
|
|
60
|
-
numberGroupId?: String;
|
|
61
|
-
numberGroupName?: String;
|
|
62
|
-
encrypt?: Number;
|
|
63
|
-
}
|
|
64
|
-
interface HangupParams {
|
|
65
|
-
success?: Function;
|
|
66
|
-
fail?: Function;
|
|
67
|
-
}
|
|
68
|
-
interface HoldOrUnHoldParams {
|
|
69
|
-
type: String;
|
|
70
|
-
success?: Function;
|
|
71
|
-
fail?: Function;
|
|
72
|
-
}
|
|
73
|
-
interface MuteOrUnMuteParams {
|
|
74
|
-
type: String;
|
|
75
|
-
direction: String;
|
|
76
|
-
success?: Function;
|
|
77
|
-
fail?: Function;
|
|
78
|
-
}
|
|
79
|
-
interface TransferParams {
|
|
80
|
-
type: String;
|
|
81
|
-
number: String;
|
|
82
|
-
agentNumber?: String;
|
|
83
|
-
success?: Function;
|
|
84
|
-
fail?: Function;
|
|
85
|
-
}
|
|
86
|
-
interface UpdateLoginTypeParams {
|
|
87
|
-
loginType: ExtenType;
|
|
88
|
-
loginNumber?: String;
|
|
89
|
-
success?: Function;
|
|
90
|
-
fail?: Function;
|
|
91
|
-
}
|
|
92
|
-
interface GetAgentPhoneBarParams {
|
|
93
|
-
success?: Function;
|
|
94
|
-
fail?: Function;
|
|
95
|
-
}
|
|
96
|
-
interface GetQueueOnlineAgentsParams {
|
|
97
|
-
success?: Function;
|
|
98
|
-
fail?: Function;
|
|
99
|
-
}
|
|
100
|
-
interface AgentOfflineParams {
|
|
101
|
-
success?: Function;
|
|
102
|
-
fail?: Function;
|
|
103
|
-
toAnsweroffline?: String;
|
|
104
|
-
}
|
|
105
|
-
interface UpdateAgentStatusParams {
|
|
106
|
-
stateNumber: String;
|
|
107
|
-
success?: Function;
|
|
108
|
-
fail?: Function;
|
|
109
|
-
}
|
|
110
|
-
interface consultParams {
|
|
111
|
-
mode: String;
|
|
112
|
-
number: String;
|
|
113
|
-
agentNumber: String;
|
|
114
|
-
success?: Function;
|
|
115
|
-
fail?: Function;
|
|
116
|
-
}
|
|
117
|
-
interface cancleConsultParams {
|
|
118
|
-
success?: Function;
|
|
119
|
-
fail?: Function;
|
|
120
|
-
}
|
|
121
|
-
interface stopConsultParams {
|
|
122
|
-
success?: Function;
|
|
123
|
-
fail?: Function;
|
|
124
|
-
}
|
|
125
|
-
interface resumeConsultParams {
|
|
126
|
-
success?: Function;
|
|
127
|
-
fail?: Function;
|
|
128
|
-
}
|
|
129
|
-
interface consultTransferParams {
|
|
130
|
-
success?: Function;
|
|
131
|
-
fail?: Function;
|
|
132
|
-
}
|
|
133
|
-
interface threeWayCallParams {
|
|
134
|
-
success?: Function;
|
|
135
|
-
fail?: Function;
|
|
136
|
-
}
|
|
137
|
-
interface satisfactionParams {
|
|
138
|
-
type: String;
|
|
139
|
-
success?: Function;
|
|
140
|
-
fail?: Function;
|
|
141
|
-
}
|
|
142
|
-
interface meetingParams {
|
|
143
|
-
number: String;
|
|
144
|
-
success?: Function;
|
|
145
|
-
fail?: Function;
|
|
146
|
-
}
|
|
147
|
-
interface listenParams {
|
|
148
|
-
agentNumber: String;
|
|
149
|
-
success?: Function;
|
|
150
|
-
fail?: Function;
|
|
151
|
-
}
|
|
152
|
-
interface lootParams {
|
|
153
|
-
agentNumber: String;
|
|
154
|
-
success?: Function;
|
|
155
|
-
fail?: Function;
|
|
156
|
-
}
|
|
157
|
-
interface whisperParams {
|
|
158
|
-
agentNumber: String;
|
|
159
|
-
success?: Function;
|
|
160
|
-
fail?: Function;
|
|
161
|
-
}
|
|
162
|
-
interface forcedHangupParams {
|
|
163
|
-
agentNumber: String;
|
|
164
|
-
success?: Function;
|
|
165
|
-
fail?: Function;
|
|
166
|
-
}
|
|
167
|
-
interface breakinParams {
|
|
168
|
-
agentNumber: String;
|
|
169
|
-
success?: Function;
|
|
170
|
-
fail?: Function;
|
|
171
|
-
}
|
|
1
|
+
import { type DestroyCallbacks, type InitOptions, type OnCallEventParams, type OnCallVolumeParams } from "./sdk/types";
|
|
172
2
|
export default class ueSoftphone {
|
|
173
|
-
static summaryUeTimer: any;
|
|
174
|
-
static agentUeTimer: any;
|
|
175
|
-
static queueUeTimer: any;
|
|
176
|
-
static loginToken: String | undefined;
|
|
177
|
-
static agentInfo: any;
|
|
178
|
-
static initOptions: InitOptions;
|
|
179
|
-
static webPhone: any;
|
|
180
|
-
static callApiUrl: String;
|
|
181
|
-
static agentextras: any;
|
|
182
|
-
static Socketinstance: any;
|
|
183
|
-
static AudioTask: any;
|
|
184
|
-
static MonitorSocketinstance: any;
|
|
185
|
-
static UserConfig: any;
|
|
186
|
-
static isCanRing: any;
|
|
187
|
-
static argeementType: String;
|
|
188
3
|
static noop(): void;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
static
|
|
193
|
-
static
|
|
194
|
-
static
|
|
195
|
-
static
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
4
|
+
private volumeController;
|
|
5
|
+
private monitorManager;
|
|
6
|
+
private sessionManager;
|
|
7
|
+
static get loginToken(): string;
|
|
8
|
+
static get agentInfo(): any;
|
|
9
|
+
static get initOptions(): InitOptions;
|
|
10
|
+
static get callApiUrl(): string;
|
|
11
|
+
static setLoginToken(token: string): void;
|
|
12
|
+
static setSessionId(sessionId: string): void;
|
|
13
|
+
static setAgentInfo(info: any): void;
|
|
14
|
+
static setCallApiUrl(url: string): void;
|
|
200
15
|
constructor(options?: InitOptions);
|
|
201
|
-
private
|
|
202
|
-
private getDomain;
|
|
16
|
+
private bootstrap;
|
|
203
17
|
private login;
|
|
204
|
-
static createEventHandle(callbacks?: any): void;
|
|
205
18
|
static kickOffEvent: () => void;
|
|
206
|
-
private getWebrtcInfo;
|
|
207
|
-
private initAttachEvent;
|
|
208
|
-
private attachNetworkCallbacks;
|
|
209
|
-
private initnNetworkMonitoring;
|
|
210
19
|
listenCallNetork: (callbacks: OnCallEventParams) => void;
|
|
211
|
-
private volumeCallbacks;
|
|
212
|
-
private stopVolumeCallbacks;
|
|
213
|
-
private audioContext;
|
|
214
|
-
private analyser;
|
|
215
|
-
private dataArray;
|
|
216
|
-
private stream;
|
|
217
|
-
private volumeIntervalId;
|
|
218
|
-
private getMicrophoneVolume;
|
|
219
|
-
private initAudioDetection;
|
|
220
|
-
private startVolumeDetection;
|
|
221
20
|
clearVolumeDetection: () => void;
|
|
222
21
|
stopVolumeDetection: () => void;
|
|
223
22
|
listenCallVolume: (callbacks: OnCallVolumeParams) => void;
|
|
@@ -226,76 +25,55 @@ export default class ueSoftphone {
|
|
|
226
25
|
muteRing: (callbacks: OnCallVolumeParams) => void;
|
|
227
26
|
sdkMonitorMsg: (params: any) => void;
|
|
228
27
|
closeSdkMonitor: (params: any) => void;
|
|
229
|
-
private initAgentQueue;
|
|
230
|
-
private initQueue;
|
|
231
|
-
static createQueueMonitorEventHandle(callbacks?: any): void;
|
|
232
|
-
static createopenNlsTransEventHandle(callbacks?: any): void;
|
|
233
|
-
static createopenAllMonitorEventHandle(callbacks?: any): void;
|
|
234
|
-
static changeMonitorEventHandle(callbacks: any, msg: any): void;
|
|
235
|
-
static handleHttpMonitor(msg: any, callbacks: any): void;
|
|
236
28
|
listenCallQueueEvent: (callbacks: any) => void;
|
|
237
29
|
listenTranslationEvent: (callbacks: any) => void;
|
|
238
30
|
listenMonitor: (callbacks: any) => void;
|
|
239
|
-
static useDefaultDependencies(deps: any): {
|
|
240
|
-
newWebSocket(server: string, proto: any): any;
|
|
241
|
-
request(url: string, options: any): any;
|
|
242
|
-
};
|
|
243
31
|
private static initWebrtcEvent;
|
|
244
32
|
private openMediaAudio;
|
|
245
33
|
listenCallEvent: (callbacks: OnCallEventParams) => void;
|
|
246
34
|
get agent(): {
|
|
247
|
-
switchLoginType(params: UpdateLoginTypeParams): Promise<
|
|
248
|
-
findPhoneBarList(params: GetAgentPhoneBarParams):
|
|
249
|
-
switchPhoneBar(params: UpdateAgentStatusParams):
|
|
250
|
-
logout(params: AgentOfflineParams):
|
|
251
|
-
findIdleAgentsForQueue(params: GetQueueOnlineAgentsParams):
|
|
252
|
-
getAvailableSipNumberList(params: any):
|
|
35
|
+
switchLoginType(params: import("./sdk/types").UpdateLoginTypeParams): Promise<any>;
|
|
36
|
+
findPhoneBarList(params: import("./sdk/types").GetAgentPhoneBarParams): Promise<any>;
|
|
37
|
+
switchPhoneBar(params: import("./sdk/types").UpdateAgentStatusParams): Promise<any>;
|
|
38
|
+
logout(params: import("./sdk/types").AgentOfflineParams): Promise<any>;
|
|
39
|
+
findIdleAgentsForQueue(params: import("./sdk/types").GetQueueOnlineAgentsParams): Promise<any>;
|
|
40
|
+
getAvailableSipNumberList(params: any): Promise<any>;
|
|
253
41
|
};
|
|
254
42
|
get webrtc(): {
|
|
255
43
|
accept(): void;
|
|
256
|
-
connect(): void
|
|
257
|
-
disconnect(): void
|
|
258
|
-
isConnected():
|
|
44
|
+
connect(): Promise<void>;
|
|
45
|
+
disconnect(): Promise<void>;
|
|
46
|
+
isConnected(): boolean;
|
|
259
47
|
sendDTMF(tone: string): void;
|
|
260
48
|
};
|
|
261
49
|
get call(): {
|
|
262
|
-
callout(params: DialoutParams): Promise<
|
|
263
|
-
hangup(params: HangupParams):
|
|
264
|
-
holdOrUnHold(params: HoldOrUnHoldParams):
|
|
265
|
-
muteOrUnMute(params: MuteOrUnMuteParams):
|
|
266
|
-
transfer(params: TransferParams):
|
|
267
|
-
consult(params: consultParams):
|
|
268
|
-
cancelconsult(params: cancleConsultParams):
|
|
269
|
-
endConsult(params: stopConsultParams):
|
|
270
|
-
callbackConsult(params: resumeConsultParams):
|
|
271
|
-
consultTransfer(params: consultTransferParams):
|
|
272
|
-
threeWayCall(params: threeWayCallParams):
|
|
273
|
-
evaluate(params: satisfactionParams):
|
|
274
|
-
meeting(params: meetingParams):
|
|
275
|
-
listen(params: listenParams):
|
|
276
|
-
loot(params: lootParams):
|
|
277
|
-
forcedHangup(params: forcedHangupParams):
|
|
278
|
-
breakIn(params: breakinParams):
|
|
279
|
-
whisper(params: whisperParams):
|
|
50
|
+
callout(params: import("./sdk/types").DialoutParams): Promise<any>;
|
|
51
|
+
hangup(params: import("./sdk/types").HangupParams): Promise<any>;
|
|
52
|
+
holdOrUnHold(params: import("./sdk/types").HoldOrUnHoldParams): Promise<any>;
|
|
53
|
+
muteOrUnMute(params: import("./sdk/types").MuteOrUnMuteParams): Promise<any>;
|
|
54
|
+
transfer(params: import("./sdk/types").TransferParams): Promise<any>;
|
|
55
|
+
consult(params: import("./sdk/types").consultParams): Promise<any>;
|
|
56
|
+
cancelconsult(params: import("./sdk/types").cancleConsultParams): Promise<any>;
|
|
57
|
+
endConsult(params: import("./sdk/types").stopConsultParams): Promise<any>;
|
|
58
|
+
callbackConsult(params: import("./sdk/types").resumeConsultParams): Promise<any>;
|
|
59
|
+
consultTransfer(params: import("./sdk/types").consultTransferParams): Promise<any>;
|
|
60
|
+
threeWayCall(params: import("./sdk/types").threeWayCallParams): Promise<any>;
|
|
61
|
+
evaluate(params: import("./sdk/types").satisfactionParams): Promise<any>;
|
|
62
|
+
meeting(params: import("./sdk/types").meetingParams): Promise<any>;
|
|
63
|
+
listen(params: import("./sdk/types").listenParams): Promise<any>;
|
|
64
|
+
loot(params: import("./sdk/types").lootParams): Promise<any>;
|
|
65
|
+
forcedHangup(params: import("./sdk/types").forcedHangupParams): Promise<any>;
|
|
66
|
+
breakIn(params: import("./sdk/types").breakinParams): Promise<any>;
|
|
67
|
+
whisper(params: import("./sdk/types").whisperParams): Promise<any>;
|
|
280
68
|
};
|
|
281
69
|
private _callApi;
|
|
282
70
|
private _agentApi;
|
|
283
71
|
_webPhoneApi: () => {
|
|
284
72
|
accept(): void;
|
|
285
|
-
connect(): void
|
|
286
|
-
disconnect(): void
|
|
287
|
-
isConnected():
|
|
73
|
+
connect(): Promise<void>;
|
|
74
|
+
disconnect(): Promise<void>;
|
|
75
|
+
isConnected(): boolean;
|
|
288
76
|
sendDTMF(tone: string): void;
|
|
289
77
|
};
|
|
290
|
-
|
|
291
|
-
* 销毁SDK实例,断开所有连接并清理资源
|
|
292
|
-
* @param callbacks - 回调函数对象
|
|
293
|
-
* @param callbacks.success - 成功回调
|
|
294
|
-
* @param callbacks.fail - 失败回调
|
|
295
|
-
*/
|
|
296
|
-
destroy(callbacks?: {
|
|
297
|
-
success?: Function;
|
|
298
|
-
fail?: Function;
|
|
299
|
-
}): void;
|
|
78
|
+
destroy(callbacks?: DestroyCallbacks): void;
|
|
300
79
|
}
|
|
301
|
-
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type AgentApiDependencies } from "./agent-commands";
|
|
2
|
+
import type { AgentOfflineParams, GetAgentPhoneBarParams, GetQueueOnlineAgentsParams, UpdateAgentStatusParams, UpdateLoginTypeParams } from "./types";
|
|
3
|
+
export declare const createAgentApi: (deps: AgentApiDependencies) => {
|
|
4
|
+
switchLoginType(params: UpdateLoginTypeParams): Promise<any>;
|
|
5
|
+
findPhoneBarList(params: GetAgentPhoneBarParams): Promise<any>;
|
|
6
|
+
switchPhoneBar(params: UpdateAgentStatusParams): Promise<any>;
|
|
7
|
+
logout(params: AgentOfflineParams): Promise<any>;
|
|
8
|
+
findIdleAgentsForQueue(params: GetQueueOnlineAgentsParams): Promise<any>;
|
|
9
|
+
getAvailableSipNumberList(params: any): Promise<any>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SharedApiDependencies } from "./api-support";
|
|
2
|
+
import { CommandRegistry } from "./command-registry";
|
|
3
|
+
export interface AgentApiDependencies extends SharedApiDependencies {
|
|
4
|
+
request: (url: string, options: any) => any;
|
|
5
|
+
connectWebPhone: () => void;
|
|
6
|
+
disconnectWebPhone: () => void;
|
|
7
|
+
cleanupConnections: (markKickoff: boolean) => void;
|
|
8
|
+
updateLoginTypeState: (loginType: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const buildAgentRegistry: () => CommandRegistry<any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InitOptions } from "./types";
|
|
2
|
+
export interface SharedApiDependencies {
|
|
3
|
+
noop: () => void;
|
|
4
|
+
getLoginToken: () => String | undefined;
|
|
5
|
+
getAgentInfo: () => any;
|
|
6
|
+
getInitOptions: () => InitOptions;
|
|
7
|
+
getCallApiUrl: () => String;
|
|
8
|
+
}
|
|
9
|
+
type WithSuccessFail = {
|
|
10
|
+
success?: Function;
|
|
11
|
+
fail?: Function;
|
|
12
|
+
};
|
|
13
|
+
export declare const isNil: (value: any) => boolean;
|
|
14
|
+
export declare const normalizeSuccessFailCallbacks: <T extends WithSuccessFail>(params: T, noop: () => void) => T;
|
|
15
|
+
export declare const getServerUrl: (initOptions: InitOptions, callApiUrl: String) => string;
|
|
16
|
+
export declare const ensureSessionReady: (params: WithSuccessFail, deps: SharedApiDependencies, options?: {
|
|
17
|
+
checkKickOff?: boolean;
|
|
18
|
+
}) => any | null;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const tryPlayAudio: (audio: HTMLAudioElement, retry?: number, interval?: number) => Promise<boolean>;
|
|
2
|
+
export declare const stopMediaStream: (stream: MediaStream) => void;
|
|
3
|
+
export declare const resolveUserMedia: () => {
|
|
4
|
+
mediaDevices: any;
|
|
5
|
+
modern: any;
|
|
6
|
+
legacy: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const mapAudioPermissionError: (err: any) => Readonly<{
|
|
9
|
+
notOpenAudioMsg: string;
|
|
10
|
+
notOpenAudioCode: number;
|
|
11
|
+
notOpenAudioMsgEn: string;
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
forbiddenAudioMsg: string;
|
|
14
|
+
forbiddenAudioCode: number;
|
|
15
|
+
forbiddenAudioMsgEn: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const calcVolumePercent: (analyser: AnalyserNode | null, dataArray: Uint8Array | null) => number;
|
|
18
|
+
export declare const clampInterval: (interval: any) => any;
|