@94ai/softphone 4.0.1 → 5.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/softphone",
3
- "version": "4.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "94 Intelligent Technology Co., Ltd softphone SDK",
5
5
  "main": "lib/softphone.cjs.min.cjs",
6
6
  "module": "lib/softphone.esm-bundler.min.mjs",
@@ -37,7 +37,7 @@
37
37
  "peerDependencies": {
38
38
  "@babel/runtime-corejs3": "^7.21.0",
39
39
  "@fingerprintjs/fingerprintjs": "^4.2.1",
40
- "crypto-js": "^4.2.2",
40
+ "crypto-js": "^4.1.1",
41
41
  "on-change": "^4.0.2",
42
42
  "sip.js": "^0.21.15"
43
43
  },
@@ -1,120 +0,0 @@
1
-
2
- import { UserAgent } from 'sip.js'
3
- import type { UserAgentOptions } from 'sip.js/lib/api/user-agent-options'
4
- import type { UserAgentStatus } from '../types'
5
-
6
- export const viaHost = ''
7
- export const extensionNumber = ''
8
- export const extPassword = ''
9
- export const wsProtocol = ''
10
- export const wsRegisterAddress = ''
11
- export const sipServerHost = `sip:${extensionNumber}@${wsRegisterAddress}`
12
- export const wsAddress = `${wsProtocol}://${wsRegisterAddress}`
13
-
14
- /**
15
- * 默认连接配置
16
- */
17
- export const userAgentDefault: Partial<UserAgentOptions> = {
18
- authorizationPassword: extPassword,
19
- authorizationUsername: extensionNumber,
20
- viaHost,
21
- // @ts-ignore
22
- uri: UserAgent.makeURI(sipServerHost),
23
- logLevel: 'error',
24
- transportOptions: {
25
- server: wsAddress
26
- },
27
- contactName: extensionNumber
28
- }
29
-
30
- export const userAgentStatus: UserAgentStatus = {
31
- connectStatus: false,
32
- registerStatus: false,
33
- invitatingStatus: false,
34
- incomingStatus: false,
35
- answerStatus: false,
36
- reconnectStatus: false
37
- }
38
-
39
- export enum AutoAnswer {
40
- NO = '0',
41
- YES = '1',
42
- }
43
-
44
- export enum PopWindow {
45
- NO = '0',
46
- YES = '1',
47
- }
48
-
49
- /** 外呼类型 */
50
- export enum AiTaskVoiceType {
51
- /**
52
- * AI外呼
53
- */
54
- MULTI_AI = '1',
55
- /**
56
- * 语音通知
57
- */
58
- MULTI_VOICE_NOTIFY = '2',
59
- /**
60
- * 预测式外呼
61
- */
62
- MULTI_PRETEST = '3',
63
- /**
64
- * 坐席人工外呼(快速外呼)
65
- */
66
- LABOUR = '4',
67
- /**
68
- * 坐席AI外呼
69
- */
70
- AI = '5',
71
- /**
72
- * 新语音通知
73
- */
74
- NEW_VOICE_NOTIFY = '6'
75
- }
76
-
77
- /** 接听类型 */
78
- export enum AfterTransferLabour {
79
- /** 直接接听 */
80
- DIRECT_ANSWER= '1',
81
- /** 先监听后手动接听 */
82
- LISTEN_FIRST_AND_THEN_ANSWER_MANUALLY = '2'
83
- }
84
-
85
- /** 软电话业务属性 */
86
- export type SoftphoneBusinessAttribute = Partial<{
87
- /** sip签入头 */
88
- sipRegisterMessage: Record<string, any>
89
- /** 历史id */
90
- cid: string
91
- /** 用户明文手机号 */
92
- userPhone: string
93
- /** 转接后人工类型 (1:直接接听 2:先监听后手动接听) */
94
- afterTransferLabour: AfterTransferLabour
95
- popWindow: PopWindow
96
- /** 话术名称 */
97
- templateTitle: string
98
- /** 最新节点名称 */
99
- nodeTitle: string
100
- /** 外呼号码编号 */
101
- numberId: string
102
- /** 任务名称 */
103
- taskName: string
104
- /** 当前通话唯一标识 */
105
- callId: string
106
- /** 任务Id */
107
- taskId: string
108
- /** 任务类型 */
109
- voiceType: AiTaskVoiceType
110
- /** 来电号码 */
111
- phoneNumber: string
112
- /** 整理中 */
113
- processTime: string
114
- /** 自动接听 */
115
- autoAnswer: string
116
- }>
117
-
118
- export const APPLICATION_JSON = 'application/json; charset=UTF-8'
119
- export const MULTIPART_FORM_DATA = 'multipart/form-data'
120
- export const APPLICATION_FORM_URLENCODED = 'application/x-www-form-urlencoded; charset=UTF-8'
package/src/index.ts DELETED
@@ -1,123 +0,0 @@
1
- import {
2
- Inviter,
3
- Registerer,
4
- SessionState,
5
- URI,
6
- UserAgent
7
- } from 'sip.js'
8
- import type { Invitation } from 'sip.js/lib/api/invitation'
9
- import type { UserAgentDelegate } from 'sip.js/lib/api/user-agent-delegate'
10
- import type { SessionDescriptionHandler } from 'sip.js/lib/api/session-description-handler'
11
- import type { SessionByeOptions } from 'sip.js/lib/api/session-bye-options'
12
- import type { RegistererUnregisterOptions } from 'sip.js/lib/api/registerer-unregister-options'
13
- import type { RegistererRegisterOptions } from 'sip.js/lib/api/registerer-register-options'
14
- import type { InvitationAcceptOptions } from 'sip.js/lib/api/invitation-accept-options'
15
- import type { InvitationRejectOptions } from 'sip.js/lib/api/invitation-reject-options'
16
- import type { RegistererOptions } from 'sip.js/lib/api/registerer-options'
17
- import type { OutgoingRequest } from 'sip.js/lib/core/messages/outgoing-request'
18
- import type { IncomingResponse } from 'sip.js/lib/core/messages/incoming-response'
19
- import { SimpleUser } from 'sip.js/lib/platform/web/index.js'
20
- import onChange from 'on-change'
21
- import {
22
- userAgentDefault,
23
- userAgentStatus
24
- } from './const'
25
- import type {
26
- HandUpInviteOption,
27
- InviterInviteOptionsExtend as InviterInviteOptions,
28
- PrepareUserAgentOptions,
29
- RegisterOptions,
30
- SessionInfoOptionsExtend as SessionInfoOptions,
31
- UserAgentDelegateKey,
32
- UserAgentOptions,
33
- UserAgentStatusKey
34
- } from './types'
35
- import { requestMicroPhonePermission } from './utils'
36
- import { UserAgentManager } from './sdk'
37
-
38
- /**
39
- * 代理实例工厂
40
- */
41
- export class UserAgentFactory {
42
- static #userAgentManager: InstanceType<typeof UserAgentManager> | undefined
43
-
44
- static getUserAgentManager (options: Partial<UserAgentOptions> = {}) {
45
- if (!this.#userAgentManager) {
46
- this.#userAgentManager = new UserAgentManager(options)
47
- }
48
- return this.#userAgentManager
49
- }
50
-
51
- static hasUserAgentManager () {
52
- return !!this.#userAgentManager
53
- }
54
-
55
- static newUserAgentManager (options: Partial<UserAgentOptions> = {}) {
56
- return new UserAgentManager(options)
57
- }
58
-
59
- static dispose() {
60
- if (this.#userAgentManager) {
61
- try {
62
- this.#userAgentManager.dispose()
63
- } catch {} finally {
64
- this.#userAgentManager = undefined
65
- }
66
- }
67
- }
68
- }
69
-
70
- export {
71
- UserAgentManager
72
- } from './sdk'
73
- export {
74
- userAgentStatus,
75
- userAgentDefault
76
- } from './const'
77
- export type {
78
- UserAgentStatus,
79
- TransportOptions
80
- } from './types'
81
- export {
82
- getMedia,
83
- playMedia,
84
- pauseMedia,
85
- cleanupMedia,
86
- getTimes,
87
- getZeorTime,
88
- accumulateSec,
89
- accumulationTimer,
90
- requestMicroPhonePermission,
91
- getDevicePermission,
92
- stopStreamTracks
93
- } from './utils'
94
- export {
95
- Inviter,
96
- Registerer,
97
- SessionState,
98
- UserAgent,
99
- URI,
100
- onChange,
101
- SimpleUser
102
- }
103
- export type {
104
- UserAgentDelegateKey,
105
- UserAgentStatusKey,
106
- UserAgentOptions,
107
- UserAgentDelegate,
108
- Invitation,
109
- SessionDescriptionHandler,
110
- OutgoingRequest,
111
- IncomingResponse,
112
- InvitationAcceptOptions,
113
- InvitationRejectOptions,
114
- SessionByeOptions,
115
- InviterInviteOptions,
116
- RegistererUnregisterOptions,
117
- RegistererOptions,
118
- RegistererRegisterOptions,
119
- SessionInfoOptions,
120
- HandUpInviteOption,
121
- RegisterOptions,
122
- PrepareUserAgentOptions
123
- }