@94ai/softphone 6.0.5 → 6.0.7

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.
Files changed (49) hide show
  1. package/lib/index.d.ts +60 -10
  2. package/lib/softphone.cjs.min.cjs +1 -1
  3. package/lib/softphone.esm-bundler.min.mjs +1 -1
  4. package/lib/softphone.umd.min.js +2 -2
  5. package/package.json +3 -1
  6. package/.yarnrc.yml +0 -19
  7. package/html-softphone-demo/CryptoJS.js +0 -3
  8. package/html-softphone-demo/README.md +0 -10
  9. package/html-softphone-demo/RootCA.pem +0 -20
  10. package/html-softphone-demo/WebrtcDiver.js +0 -320
  11. package/html-softphone-demo/antique_phone.mp3 +0 -0
  12. package/html-softphone-demo/cert.pem +0 -21
  13. package/html-softphone-demo/embed-ui/index.html +0 -123
  14. package/html-softphone-demo/embed-ui/softphone.js +0 -533
  15. package/html-softphone-demo/embed-ui/util.js +0 -123
  16. package/html-softphone-demo/fp.umd.min.js +0 -9
  17. package/html-softphone-demo/gg.xccjh.top.key +0 -27
  18. package/html-softphone-demo/gg.xccjh.top.pem +0 -61
  19. package/html-softphone-demo/index-channel.html +0 -904
  20. package/html-softphone-demo/index-local.html +0 -586
  21. package/html-softphone-demo/index-open.html +0 -617
  22. package/html-softphone-demo/index-switch-pcm.html +0 -613
  23. package/html-softphone-demo/index-test.html +0 -593
  24. package/html-softphone-demo/index-voice.html +0 -720
  25. package/html-softphone-demo/index.html +0 -1090
  26. package/html-softphone-demo/localhost.crt +0 -21
  27. package/html-softphone-demo/localhost.key +0 -28
  28. package/html-softphone-demo/micro-call-ui/CryptoJS.js +0 -3
  29. package/html-softphone-demo/micro-call-ui/draggable.html +0 -168
  30. package/html-softphone-demo/micro-call-ui/draggable.js +0 -1
  31. package/html-softphone-demo/micro-call-ui/index.html +0 -153
  32. package/html-softphone-demo/micro-call-ui/microphone.js +0 -824
  33. package/html-softphone-demo/micro-call-ui/qiankun.js +0 -2
  34. package/html-softphone-demo/micro-call-ui/util.js +0 -33
  35. package/html-softphone-demo/micro-call-ui/wujie.js +0 -3
  36. package/html-softphone-demo/pcm-player.js +0 -131
  37. package/html-softphone-demo/pcm-server/16bit-44100.pcm +0 -0
  38. package/html-softphone-demo/pcm-server/index.html +0 -110
  39. package/html-softphone-demo/pcm-server/server.js +0 -54
  40. package/html-softphone-demo/private.key +0 -28
  41. package/html-softphone-demo/softphone.umd.min.js +0 -2
  42. package/html-softphone-demo/tapd_35238004_base64_1695010473_859.gif +0 -0
  43. package/html-softphone-demo/test.html +0 -190
  44. package/html-softphone-demo/vue-esm-ui/common-ui.es.browser.js +0 -56545
  45. package/html-softphone-demo/vue-esm-ui/vue-esm.html +0 -2043
  46. package/html-softphone-demo/vue-sfc-ui/CryptoJS.js +0 -3
  47. package/html-softphone-demo/vue-sfc-ui/vue-sfc.html +0 -1858
  48. package/html-softphone-demo/vue-umd-ui/common-ui.umd.browser.js +0 -338
  49. package/html-softphone-demo/vue-umd-ui/vue-umd.html +0 -1978
@@ -1,824 +0,0 @@
1
- const { addGlobalUncaughtErrorHandler, initGlobalState, registerMicroApps, loadMicroApp, start } = window.qiankun
2
- const { bus, setupApp } = window.wujie
3
- class SoftphoneManager {
4
- nfMicrophoneInstance
5
- option = {
6
- origin: 'ai-softphone',
7
- ancestorOrigin: 'nf-softphone',
8
- destinationOrigin: '*',
9
-
10
- mode: 'qiankun',
11
- lang: 'zh',
12
- name: 'nf-microphone',
13
- blackList: ['#/login'],
14
- isOem: true,
15
- accessMode: 'pc',
16
- numberKeyBoard: true,
17
-
18
- sgGateway: undefined,
19
- sgBase: undefined,
20
- sgOpen: undefined,
21
- sgDomain: undefined,
22
- timestamp: undefined,
23
- sign: undefined,
24
- open: '1',
25
-
26
- envMap: {
27
- dev: {
28
- host: 'http://softphone.test.k8s.com',
29
- port: '80',
30
- base: '/'
31
- },
32
- test: {
33
- host: 'http://softphone.test.k8s.com',
34
- port: '80',
35
- base: '/'
36
- },
37
- sg: {
38
- host: 'https://seat.teleai.com',
39
- port: 443,
40
- base: '/'
41
- },
42
- gray: {
43
- host: 'http://softphone.gray.94ai.com',
44
- port: 80,
45
- base: '/'
46
- },
47
- prod: {
48
- host: 'https://seat.94ai.com',
49
- port: 443,
50
- base: '/'
51
- }
52
- },
53
- env: 'prod',
54
- el: undefined,
55
-
56
- agentId: undefined,
57
- agentTag: undefined,
58
- appKey: undefined,
59
- appSecret: undefined,
60
- extStatus: '1',
61
-
62
- callShow: '1',
63
- transferToLaborShow: '1',
64
- restShow: '1',
65
- networkDetectShow: '1',
66
- muteShow: '1',
67
- logShow: '1',
68
- timingShow: '1',
69
- signShow: '1',
70
-
71
- softphoneConnectCallBack: () => {
72
- console.log('softphone-connect')
73
- },
74
- softphoneCallRefreshCallBack: () => {
75
- console.log('softphone-call-refresh')
76
- },
77
- softphoneSeatStatusChangeCallBack: () => {
78
- console.log('softphone-seats-status-change')
79
- },
80
- softphoneAcceptCallBack: () => {
81
- console.log('softphone-accept')
82
- },
83
- softphoneAutoIgnoreCallback: () => {
84
- console.log('softphone-auto-ignore-callback')
85
- },
86
- softphoneIgnoreCallBack: () => {
87
- console.log('softphone-ignore')
88
- },
89
- softphoneHangupCallBack: () => {
90
- console.log('softphone-hangup')
91
- },
92
- softphoneSessionStateChangeCallBack: () => {
93
- console.log('softphone-session-state-change')
94
- },
95
- softphoneIncomingCallBack: () => {
96
- console.log('softphone-incoming')
97
- },
98
- softphoneSendDtmfCallBack: () => {
99
- console.log('softphone-send-dtmf')
100
- },
101
- softphoneConnectRegisteredCallBack: () => {
102
- console.log('softphone-connect-registered')
103
- },
104
- softphoneSignOverduedCallBack: (done) => {
105
- done({
106
- timestamp: undefined,
107
- sign: undefined
108
- })
109
- }
110
- }
111
-
112
- initSoftphone = (option) => {
113
- if (this.nfMicrophoneInstance) {
114
- return
115
- }
116
- const props = this.option = option ? { ...this.option, ...option } : this.option
117
-
118
- const setUserInfo = (userInfo) => {
119
- if (userInfo.sign && props.sign && userInfo.sign !== props.sign) {
120
- this.option.sign = userInfo.sign
121
- this.option.timestamp = userInfo.timestamp
122
- }
123
- }
124
-
125
- const getUserInfo = () => {
126
- const {
127
- agentId,
128
- agentTag,
129
- appKey,
130
- appSecret,
131
- timestamp,
132
- sign,
133
- extStatus,
134
- origin,
135
- ancestorOrigin,
136
- destinationOrigin,
137
- callShow,
138
- transferToLaborShow,
139
- restShow,
140
- networkDetectShow,
141
- muteShow,
142
- logShow,
143
- timingShow,
144
- signShow,
145
- lang,
146
- name,
147
- extensionInfo,
148
- blackList,
149
- extPassword,
150
- extensionNumber,
151
- wsRegisterAddress,
152
- wsProtocol,
153
- isOem,
154
- numberKeyBoard,
155
- accessMode,
156
- sipHeaders,
157
- sgGateway,
158
- open,
159
- sgOpen,
160
- sgDomain,
161
- sgBase,
162
- token,
163
- timeZone,
164
- getOfflineInfo,
165
- changeALittleRest,
166
- quickCallWin,
167
- phoneRegex,
168
- account,
169
- extAccount,
170
- socketHost,
171
- sid,
172
- uid,
173
- newUserId,
174
- companyId,
175
- company,
176
- countryId,
177
- countryName,
178
- authUserType,
179
- userType,
180
- recordPath,
181
- constMap
182
- } = props
183
-
184
- return {
185
- agentId,
186
- agentTag,
187
- appKey,
188
- appSecret,
189
- timestamp,
190
- sign,
191
- extStatus,
192
- origin,
193
- ancestorOrigin,
194
- destinationOrigin,
195
- callShow,
196
- transferToLaborShow,
197
- restShow,
198
- networkDetectShow,
199
- muteShow,
200
- logShow,
201
- timingShow,
202
- signShow,
203
- lang,
204
- name,
205
- extensionInfo,
206
- blackList,
207
- extPassword,
208
- extensionNumber,
209
- wsRegisterAddress,
210
- wsProtocol,
211
- isOem,
212
- numberKeyBoard,
213
- accessMode,
214
- sipHeaders,
215
- sgGateway,
216
- open,
217
- sgOpen,
218
- sgDomain,
219
- sgBase,
220
- token,
221
- timeZone,
222
- getOfflineInfo,
223
- changeALittleRest,
224
- quickCallWin,
225
- phoneRegex,
226
- account,
227
- extAccount,
228
- socketHost,
229
- sid,
230
- uid,
231
- newUserId,
232
- companyId,
233
- company,
234
- countryId,
235
- countryName,
236
- authUserType,
237
- userType,
238
- recordPath,
239
- constMap,
240
- seats: true
241
- }
242
- }
243
-
244
- // 数据总线
245
- class Shared {
246
- key
247
-
248
- constructor(key) {
249
- this.key = key
250
- }
251
-
252
- /**
253
- * 获取 UserInfo
254
- */
255
- getUserInfo() {
256
- return {}
257
- }
258
-
259
- setUserInfo() {
260
- }
261
-
262
- /**
263
- * 获取分机信息
264
- */
265
- getExtensionInfo() {
266
- return props.extensionInfo || {}
267
- }
268
-
269
- /**
270
- * 获取 Gateway
271
- */
272
- getGateway() {
273
- if (props.sgGateway) {
274
- if (isDomainOrIP(props.sgGateway)) {
275
- return props.sgGateway
276
- }
277
- if (props.sgGateway === '1') {
278
- return 'https://gateway.teleai.com'
279
- } else if (props.sgGateway === '0') {
280
- return 'https://gateway.94ai.pro'
281
- }
282
- }
283
- return 'https://gateway.94ai.pro'
284
- }
285
-
286
- getOpenApi() {
287
- const {
288
- sgOpen,
289
- sgDomain
290
- } = props
291
- if (isDomainOrIP(sgOpen)) {
292
- return sgOpen
293
- }
294
- if (sgOpen === '1') {
295
- if (sgDomain === '1') {
296
- return 'https://seat.teleai.com/teleaiopenapi'
297
- }
298
- return 'https://seat.teleai.com/openapi'
299
- } else {
300
- if (sgDomain === '1') {
301
- return 'https://seat.94ai.com/teleaiopenapi'
302
- }
303
- return 'https://seat.94ai.com/openapi'
304
- }
305
- }
306
-
307
- getBase() {
308
- const {
309
- sgBase
310
- } = props
311
- if (isDomainOrIP(sgBase)) {
312
- return sgBase
313
- }
314
- if (sgBase === '1') {
315
- return 'https://seat.teleai.com/api'
316
- } else if (sgBase === '0') {
317
- return 'https://seat.94ai.com/api'
318
- }
319
- }
320
-
321
- getIsOem() {
322
- return props.isOem
323
- }
324
-
325
- getSoftPhoneShowCall() {
326
- if (props.callShow === '0') {
327
- return false
328
- }
329
- return true
330
- }
331
-
332
- getSoftPhoneShowTransferToLabor() {
333
- if (props.transferToLaborShow === '0') {
334
- return false
335
- }
336
- return true
337
- }
338
-
339
- getSoftPhoneShowRest() {
340
- if (props.restShow === '0') {
341
- return false
342
- }
343
- return true
344
- }
345
-
346
- getSoftPhoneShowNetworkDetect() {
347
- if (props.networkDetectShow === '0') {
348
- return false
349
- }
350
- return true
351
- }
352
-
353
- getSoftPhoneShowMute() {
354
- if (props.muteShow === '0') {
355
- return false
356
- }
357
- return true
358
- }
359
-
360
- /**
361
- * 是否展示对话记录功能
362
- */
363
- getSoftPhoneShowLog() {
364
- if (props.logShow === '0') {
365
- return false
366
- }
367
- return true
368
- }
369
-
370
- getSoftPhoneShowTiming() {
371
- if (props.timingShow === '0') {
372
- return false
373
- }
374
- return true
375
- }
376
-
377
- getSoftPhoneShowSign() {
378
- if (props.signShow === '0') {
379
- return false
380
- }
381
- return true
382
- }
383
-
384
- /**
385
- * 使用按键拨号
386
- */
387
- getNumberKeyBoard() {
388
- return props.numberKeyBoard
389
- }
390
-
391
- /**
392
- * sip扩展头
393
- */
394
- getSipHeaders() {
395
- // return ['sip-xx-headers1: 1', 'sip-xx-headers2: 2']
396
- return props.sipHeaders
397
- }
398
-
399
- /**
400
- * 启动移动端模式
401
- */
402
- getIsMobile() {
403
- return props.accessMode === 'mobile'
404
- }
405
-
406
- /**
407
- * 设置语言
408
- */
409
-
410
- getLanguage() {
411
- return props.lang
412
- }
413
-
414
- setLanguage() {
415
- //
416
- }
417
-
418
- getApplicationCode() {
419
- return 3
420
- }
421
- }
422
-
423
- // 实例+动作管理
424
- class MicroManager {
425
- showSoftPhone = true
426
-
427
- app
428
- mode = props.mode
429
-
430
- #qiankunActions
431
-
432
- getQiankunActions() {
433
- return this.#qiankunActions
434
- }
435
-
436
- getWejieActions() {
437
- return bus
438
- }
439
-
440
- microCommunicat(
441
- type,
442
- data = {},
443
- operationType = 'manual',
444
- ancestorOrigin = props.ancestorOrigin,
445
- destinationOrigin = props.destinationOrigin
446
- ) {
447
- const state = {
448
- origin: 'nf-softphone',
449
- ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
450
- destinationOrigin: destinationOrigin || props.destinationOrigin,
451
- type,
452
- data: {
453
- ...data,
454
- type: operationType
455
- }
456
- }
457
- if (this.mode === 'qiankun') {
458
- this.getQiankunActions().setGlobalState(state)
459
- } else if (this.mode === 'wujie') {
460
- this.getWejieActions().$emit('ai-softphone', state)
461
- }
462
- }
463
-
464
-
465
- // 签入
466
- connect() {
467
- this.microCommunicat('softphone-connect', {
468
- status: true
469
- })
470
- }
471
-
472
- disconnect() {
473
- this.microCommunicat('softphone-connect', {
474
- status: false
475
- })
476
- }
477
-
478
- seatsStatusChange(status) {
479
- this.microCommunicat('softphone-seats-status-change', {
480
- status
481
- })
482
- }
483
-
484
- accept() {
485
- this.microCommunicat('oftphone-accept')
486
- }
487
-
488
- ignore() {
489
- this.microCommunicat('softphone-ignore')
490
- }
491
-
492
- hangup() {
493
- this.microCommunicat('softphone-hangup')
494
- }
495
-
496
- sendDtmf() {
497
- this.microCommunicat('softphone-send-dtmf')
498
- }
499
-
500
- signOverdued(data) {
501
- this.microCommunicat('softphone-sign-overdued', data, 'auto', props.ancestorOrigin, 'ai-softphone')
502
- }
503
-
504
- changeServerToRegister() {
505
- this.microCommunicat('softphone-change-server-to-register')
506
- }
507
-
508
- getMicroAppConfig() {
509
- const config = []
510
- const shared = new Shared('default')
511
- if (props.getOfflineInfo) {
512
- shared.getOfflineInfo = async (data) => {
513
- return await props.getOfflineInfo(data)
514
- }
515
- }
516
- if (props.changeALittleRest) {
517
- shared.changeALittleRest = async (data) => {
518
- return await props.changeALittleRest(data)
519
- }
520
- }
521
- if (props.quickCallWin) {
522
- shared.quickCallWin = async (data) => {
523
- return await props.quickCallWin(data)
524
- }
525
- }
526
- (Object.keys(props.envMap).reduce((res, currentValue) => {
527
- res[currentValue] = [{
528
- name: props.name,
529
- host: props.envMap[currentValue].host,
530
- port: props.envMap[currentValue].port,
531
- base: props.envMap[currentValue].base,
532
- container: props.el,
533
- activeRule: (location) => {
534
- if (!this.showSoftPhone) {
535
- return false
536
- }
537
- if (props.blackList.includes(location.hash)) {
538
- return false
539
- }
540
- return true
541
- },
542
- props: {
543
- name: props.name
544
- }
545
- }]
546
- return res
547
- }, {})[props.env] || []).forEach(item => {
548
- config.push({
549
- name: item.name,
550
- entry: `${ item.host }${ (item.port ? `:${ item.port }` : '') + item.base }?name=${ item.name }`,
551
- container: item.container,
552
- activeRule: item.activeRule,
553
- props: { ...item.props, shared }
554
- })
555
- })
556
- return config
557
- }
558
-
559
- initState() {
560
- this.#qiankunActions = initGlobalState({
561
- type: 'qiankun-init',
562
- origin: props.origin,
563
- ancestorOrigin: props.ancestorOrigin,
564
- destinationOrigin: props.destinationOrigin,
565
- data: null
566
- })
567
- this.#qiankunActions.onGlobalStateChange((state) => {
568
- // state: 变更后的状态; prev 变更前的状态
569
- (new SoftphoneNotity()).useQinkunSoftphoneNotity(state)
570
- })
571
- addGlobalUncaughtErrorHandler((event) => {
572
- if (event.type === 'error' && event.error?.message === 'application \'softPhone\' died in status LOADING_SOURCE_CODE: Failed to fetch') {
573
- this.showSoftPhone = false
574
- }
575
- console.error(event)
576
- })
577
- }
578
-
579
- /**
580
- * 手动加载子应用
581
- */
582
- loadQiankunMicroApps() {
583
- const appConfig = this.getMicroAppConfig()[0]
584
- appConfig.props.shared.getUserInfo = getUserInfo
585
- appConfig.props.shared.setUserInfo = setUserInfo
586
- this.initState()
587
- this.app = loadMicroApp(appConfig, {
588
- sandbox: {
589
- experimentalStyleIsolation: true
590
- }
591
- })
592
- }
593
-
594
- /**
595
- * 卸载子应用
596
- */
597
- unmountQiankunMicroApps() {
598
- try {
599
- this.app?.unmount()
600
- this.#qiankunActions?.offGlobalStateChange()
601
- } catch (e) {
602
- //
603
- } finally {
604
- this.app = null
605
- }
606
- }
607
-
608
- registerWujieMicroApps() {
609
- const appConfig = this.getMicroAppConfig()[0]
610
- const url = appConfig.entry
611
- appConfig.props.shared.getUserInfo = getUserInfo
612
- appConfig.props.shared.setUserInfo = setUserInfo
613
-
614
- setupApp({
615
- name: props.name,
616
- plugins: [
617
- {
618
- cssBeforeLoaders: [{ src: `${ url }/index.css` }]
619
- }
620
- ],
621
- url,
622
- exec: true,
623
- props: {
624
- shared: appConfig.props.shared
625
- },
626
- fetch(url, options) {
627
- return window.fetch(url, { ...options, credentials: 'omit' })
628
- },
629
- degrade: !window.Proxy || !window.CustomElementRegistry,
630
- // @ts-ignore
631
- beforeLoad: (appWindow) => console.log(`${ appWindow.__WUJIE.id } beforeLoad 生命周期`),
632
- // @ts-ignore
633
- beforeMount: (appWindow) => console.log(`${ appWindow.__WUJIE.id } beforeMount 生命周期`),
634
- // @ts-ignore
635
- afterMount: (appWindow) => console.log(`${ appWindow.__WUJIE.id } afterMount 生命周期`),
636
- // @ts-ignore
637
- beforeUnmount: (appWindow) => console.log(`${ appWindow.__WUJIE.id } beforeUnmount 生命周期`),
638
- // @ts-ignore
639
- afterUnmount: (appWindow) => console.log(`${ appWindow.__WUJIE.id } afterUnmount 生命周期`),
640
- // @ts-ignore
641
- activated: (appWindow) => console.log(`${ appWindow.__WUJIE.id } activated 生命周期`),
642
- // @ts-ignore
643
- deactivated: (appWindow) => console.log(`${ appWindow.__WUJIE.id } deactivated 生命周期`)
644
- // loadError: (url, e) => console.log(`${url} 加载失败`, e),
645
- });
646
- (new SoftphoneNotity()).useWujieSoftphoneNotity()
647
- }
648
-
649
- registerQiankunMicroApps() {
650
- const appConfig = this.getMicroAppConfig()[0]
651
- appConfig.props.shared.getUserInfo = getUserInfo
652
- appConfig.props.shared.setUserInfo = setUserInfo
653
-
654
- registerMicroApps([appConfig], {
655
- // qiankun 生命周期钩子 - 加载前
656
- beforeLoad: [() => {
657
- // 加载子应用前,加载进度条
658
- // NProgress.start()
659
- return Promise.resolve()
660
- }],
661
- // qiankun 生命周期钩子 - 挂载后
662
- afterMount: [() => {
663
- // 加载子应用前,进度条加载完成
664
- // NProgress.done()
665
- return Promise.resolve()
666
- }],
667
- // qiankun 生命周期钩子 - 卸载后
668
- afterUnmount: [() => {
669
- return Promise.resolve()
670
- }]
671
- })
672
- this.initState()
673
- }
674
-
675
- startQiankun() {
676
- this.registerQiankunMicroApps()
677
- start({
678
- singular: false,
679
- prefetch: 'all',
680
- sandbox: {
681
- experimentalStyleIsolation: true
682
- }
683
- })
684
- }
685
-
686
- startWujie() {
687
- this.registerWujieMicroApps()
688
- // @ts-ignore
689
- startApp({
690
- name: props.name,
691
- el: props.el
692
- })
693
- }
694
-
695
- startMicrotask() {
696
- if (this.mode === 'wujie') {
697
- this.startWujie()
698
- } else {
699
- this.startQiankun()
700
- }
701
- }
702
- }
703
-
704
- const nfMicrophoneInstance = this.nfMicrophoneInstance = new MicroManager()
705
-
706
- // 通知
707
- class SoftphoneNotity {
708
- communicationList = {
709
- 'softphone-connect-registered': (data) => {
710
- props.softphoneConnectRegisteredCallBack?.(data)
711
- },
712
- 'softphone-session-state-change': (data) => {
713
- props.softphoneSessionStateChangeCallBack?.(data)
714
- },
715
- 'softphone-call-refresh': (data) => {
716
- props.softphoneCallRefreshCallBack?.(data)
717
- },
718
- 'softphone-connect': (data) => {
719
- props.softphoneConnectCallBack?.(data)
720
- },
721
- 'softphone-accept': (data) => {
722
- props.softphoneAcceptCallBack?.(data)
723
- },
724
- 'softphone-auto-ignore-callback': (data) => {
725
- props.softphoneAutoIgnoreCallback?.(data)
726
- },
727
- 'softphone-seats-status-change': (data) => {
728
- props.softphoneSeatStatusChangeCallBack?.(data)
729
- },
730
- 'softphone-ignore': (data) => {
731
- props.softphoneIgnoreCallBack?.(data)
732
- },
733
- 'softphone-hangup': (data) => {
734
- props.softphoneHangupCallBack?.(data)
735
- },
736
- 'softphone-incoming': (data) => {
737
- props.softphoneIncomingCallBack?.(data)
738
- },
739
- 'softphone-send-dtmf': (data) => {
740
- props.softphoneSendDtmfCallBack?.(data)
741
- },
742
- 'softphone-sign-overdued': () => {
743
- const done = (data) => {
744
- const {
745
- sign,
746
- timestamp
747
- } = data
748
- nfMicrophoneInstance.signOverdued({
749
- sign,
750
- timestamp
751
- })
752
- }
753
- props.softphoneSignOverduedCallBack?.(done)
754
- }
755
- }
756
- useQinkunSoftphoneNotity = (state) => {
757
- if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
758
- (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
759
- if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
760
- this.communicationList[state.type]?.(state.data)
761
- }
762
- }
763
- }
764
-
765
- useWujieSoftphoneNotity() {
766
- Object.keys(this.communicationList).forEach(key => {
767
- bus.$on(key, (state) => {
768
- if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
769
- (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
770
- if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
771
- this.communicationList[key]?.(state.data)
772
- }
773
- }
774
- })
775
- })
776
- }
777
- }
778
-
779
- // 注册软电话微应用
780
- if (this.option.mode === 'qiankun') {
781
- this.nfMicrophoneInstance.loadQiankunMicroApps()
782
- } else {
783
- this.nfMicrophoneInstance.startWujie()
784
- }
785
-
786
- return this
787
- }
788
-
789
-
790
- connect = () => {
791
- this.nfMicrophoneInstance.connect()
792
- }
793
-
794
- disconnect = () => {
795
- this.nfMicrophoneInstance.disconnect()
796
- }
797
-
798
- seatsStatusChange = (status) => {
799
- this.nfMicrophoneInstance.seatsStatusChange(status)
800
- }
801
-
802
- accept = () => {
803
- this.nfMicrophoneInstance.accept()
804
- }
805
- ignore = () => {
806
- this.nfMicrophoneInstance.ignore()
807
- }
808
- hangup = () => {
809
- this.nfMicrophoneInstance.hangup()
810
- }
811
- sendDtmf = () => {
812
- this.nfMicrophoneInstance.sendDtmf()
813
- }
814
-
815
- changeServerToRegister = () => {
816
- this.nfMicrophoneInstance.changeServerToRegister()
817
- }
818
-
819
- destory = () => {
820
- this.nfMicrophoneInstance.unmountQiankunMicroApps()
821
- this.nfMicrophoneInstance = undefined
822
- }
823
- }
824
- const softphoneManager = new SoftphoneManager()