@94ai/softphone 5.0.16 → 5.0.17

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.
@@ -90,10 +90,31 @@ const nfSoftPhone1 = (new SoftphoneManager()).initSoftphone({ // 👈 当多实
90
90
  softphoneIncomingCallBack: (data) => {console.log('softphone-incoming')},// 👈 来电回调
91
91
  softphoneSendDtmfCallBack: (data) => {console.log('softphone-send-dtmf')},// 👈 转人工回调
92
92
  softphoneConnectRegisteredCallBack: async (data) => {
93
+ getAgentInfo()
93
94
  console.log('softphone-connect-registered', data)
94
95
  },// 👈 动态绑定动作完成回调(在这之后才能执行动作类总线通讯)
95
96
  });
96
97
 
98
+ const getAgentInfo = async () => {
99
+ const signRes = await nfSoftPhone1.requestOpenApi({
100
+ url: '/v1/agent/getAgent',
101
+ data: {
102
+ agentTag: agentTag1,
103
+ // timestamp, // 单独授权参数
104
+ // appKey: appKey1, // 单独授权参数
105
+ // sign // 单独授权参数
106
+ }
107
+ })
108
+ const secretRes = await nfSoftPhone1.requestOpenApi({
109
+ url: '/v1/agent/getAgent',
110
+ data: {
111
+ agentTag: agentTag1,
112
+ appKey: appKey1, // 单独授权参数
113
+ appSecret: appSecret1 // 单独授权参数
114
+ }
115
+ })
116
+ console.log(signRes, secretRes)
117
+ }
97
118
  // setTimeout(() => {
98
119
  // nfSoftPhone1.destroy()
99
120
  // }, 3000)
@@ -55,6 +55,8 @@ class SoftphoneManager {
55
55
 
56
56
  instanceMap: {},
57
57
 
58
+ requestOpenApiCallBackMap: {},
59
+
58
60
  softphoneConnectCallBack: () => {console.log('softphone-connect')},
59
61
  softphoneCallRefreshCallBack: () => {console.log('softphone-call-refresh')},
60
62
  softphoneSeatStatusChangeCallBack: () => {console.log('softphone-seats-status-change')},
@@ -72,6 +74,23 @@ class SoftphoneManager {
72
74
  sign: undefined
73
75
  })
74
76
  },
77
+ softphoneRequestOpenApiCallBack: async (data) => {
78
+ // data: {
79
+ // origin
80
+ // ancestorOrigin
81
+ // destinationOrigin
82
+ // type: 'softphone-request-open-api'
83
+ // uuid
84
+ // code
85
+ // message
86
+ // data: {
87
+ // type: 'manual',
88
+ // param,
89
+ // res
90
+ // }
91
+ // }
92
+ await this.option.requestOpenApiCallBackMap[data.uuid](data)
93
+ },
75
94
  }
76
95
 
77
96
 
@@ -166,6 +185,8 @@ class SoftphoneManager {
166
185
  this.option.softphoneSendDtmfCallBack?.(data)
167
186
  } else if (data.type === 'softphone-connect-registered') {
168
187
  this.option.softphoneConnectRegisteredCallBack?.(data)
188
+ } else if (data.type === 'softphone-request-open-api') {
189
+ this.option.softphoneRequestOpenApiCallBack?.(data)
169
190
  } else if (data.type === 'softphone-sign-overdued') {
170
191
  const done = (data) => {
171
192
  const {
@@ -411,7 +432,7 @@ class SoftphoneManager {
411
432
  return this
412
433
  }
413
434
 
414
- postMessageCommunicate = (type, status) => {
435
+ postMessageCommunicate = (type, status, param) => {
415
436
  const iframe = this.getSoftphoneDomElement('.nf-softphone-iframe')
416
437
  if (iframe) {
417
438
  iframe.contentWindow.postMessage(JSON.stringify({
@@ -421,7 +442,8 @@ class SoftphoneManager {
421
442
  type,
422
443
  data: {
423
444
  status,
424
- type: 'manual'
445
+ type: 'manual',
446
+ param,
425
447
  }
426
448
  }), '*')
427
449
  }
@@ -451,6 +473,37 @@ class SoftphoneManager {
451
473
  sendDtmf = () => {
452
474
  this.postMessageCommunicate('softphone-send-dtmf')
453
475
  }
476
+ requestOpenApi = async (param) => {
477
+ return new Promise(((resolve, reject) => {
478
+ const uuid = generateUUID()
479
+ this.option.requestOpenApiCallBackMap[uuid] = async (result) => {
480
+ // result: {
481
+ // origin
482
+ // ancestorOrigin
483
+ // destinationOrigin
484
+ // type: 'softphone-request-open-api'
485
+ // uuid
486
+ // code: 200,
487
+ // message: '成功',
488
+ // data: {
489
+ // type: 'manual',
490
+ // param: {}, // 请求参数
491
+ // res // 响应结果
492
+ // }
493
+ // }
494
+ if (result.code === 200) {
495
+ resolve(result.data.res)
496
+ } else {
497
+ reject(result)
498
+ }
499
+ delete this.option.requestOpenApiCallBackMap[uuid]
500
+ }
501
+ this.postMessageCommunicate('softphone-request-open-api', undefined, {
502
+ uuid,
503
+ param
504
+ })
505
+ }))
506
+ }
454
507
 
455
508
  removeTimer = () => {
456
509
  clearTimeout(this.timer)
@@ -184,9 +184,8 @@
184
184
  * - 相当于: userAgentManager.requestOpenApi({
185
185
  * url: '/v1/agent/updateAgentStatus',
186
186
  * data: {
187
- * agentTag: 'xxx',
188
187
  * agentId: 'xxx',
189
- * agentStatus: 3, // 3: 小休 1: 在线
188
+ * agentStatus: 3, // 3: 小休 1: 在线 0: 离线
190
189
  * }
191
190
  * })
192
191
  * - example3:获取当前坐席信息,也可以直接使用`const angentInfo = await userAgentManager.getAgentInfo()`
@@ -345,21 +344,22 @@ document.addEventListener('DOMContentLoaded', async (event) => {
345
344
  * },
346
345
  */
347
346
 
348
- // const agentTag = '15018707394' // 国内生产线 坐席维度定位
349
- // const appKey = '032d44009bff1752' // 国内生产线 企业维度定位
350
- // const appSecret = '4c7304c94c5e8725613516d4d6db679b' // 国内生产线 企业维度定位
351
- const agentId = '2357' // 海外生产线 坐席维度定位
352
- const appKey = 'a52e61f0d9ff1527' // 海外生产线 企业维度定位
353
- const appSecret = '7ed1d78fbe214ba8b8e6a2dc9c6955aa' // 海外生产线 企业维度定位
347
+ const agentTag = '15018707394' // 国内生产线 坐席维度定位
348
+ const appKey = '032d44009bff1752' // 国内生产线 企业维度定位
349
+ const appSecret = '4c7304c94c5e8725613516d4d6db679b' // 国内生产线 企业维度定位
350
+ // const agentId = '6897' // 海外生产线 坐席维度定位
351
+ // const appKey = '1f3a67d0affd2699' // 海外生产线 企业维度定位
352
+ // const appSecret = 'a62ac746d916e1da5f645783c587bae6' // 海外生产线 企业维度定位
354
353
  const timestamp = Date.now()
355
354
  const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(appKey + timestamp, appSecret))
356
355
 
357
356
  const userAgentManager = UserAgentFactory.getUserAgentManager({
357
+ // optionsPingAttempts: 1, // 网络抖动只检测一次
358
358
  /**
359
359
  * start - 海外特有参数
360
360
  */
361
- sgOpen: '1', // 是否切换海外代理, 默认'0'为国内
362
- sg: '1', // 是否切换海外环境, 默认'0'为国内
361
+ // sgOpen: '1', // 是否切换海外代理, 默认'0'为国内
362
+ // sg: '1', // 是否切换海外环境, 默认'0'为国内
363
363
  /**
364
364
  * end - 海外特有参数
365
365
  */
@@ -368,21 +368,22 @@ document.addEventListener('DOMContentLoaded', async (event) => {
368
368
  // agentId: '2357', // 海外生产线 坐席维度定位
369
369
  // appKey: 'a52e61f0d9ff1527', // 海外生产线 企业维度定位
370
370
  // appSecret: '7ed1d78fbe214ba8b8e6a2dc9c6955aa', // 海外生产线 企业维度定位 这里直接使用appSecret做演示
371
- // agentTag,
372
- agentId,
371
+ agentTag,
372
+ // agentId,
373
373
  appKey,
374
- timestamp,
375
- sign,
376
- signOverdued() {
377
- console.log('==sign已过期==')
378
- const timestamp = Date.now()
379
- const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(appKey + timestamp, appSecret))
380
- console.log('==重新生成sign==', sign)
381
- return {
382
- timestamp,
383
- sign,
384
- }
385
- },
374
+ appSecret,
375
+ // timestamp,
376
+ // sign,
377
+ // signOverdued() {
378
+ // console.log('==sign已过期==')
379
+ // const timestamp = Date.now()
380
+ // const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(appKey + timestamp, appSecret))
381
+ // console.log('==重新生成sign==', sign)
382
+ // return {
383
+ // timestamp,
384
+ // sign,
385
+ // }
386
+ // },
386
387
  // logLevel: 'debug', // 日志等级,默认error
387
388
  openXhrIntercept(xhr) { // 设置接口语言
388
389
  // xhr.setRequestHeader('language', 'es-ES')
@@ -924,18 +925,18 @@ document.addEventListener('DOMContentLoaded', async (event) => {
924
925
  // await userAgentManager.invite({
925
926
  // extension: call.value // 分机号外呼
926
927
  // })
927
- // const callInfo = await userAgentManager.callNumber(call.value) // 👈 一键手机号外呼
928
- const callInfo = await userAgentManager.requestOpenApi({ // 主动手机号外呼
929
- url: '/v1/task/importAgentCustomer',
930
- data: {
931
- agentTag: '15018707394',
932
- callType: 1001,
933
- customers: [{
934
- tag: '测试tag',
935
- number: call.value || 18617381945
936
- }]
937
- }
938
- })
928
+ const callInfo = await userAgentManager.callNumber(call.value || 18617381945) // 👈 一键手机号外呼
929
+ // const callInfo = await userAgentManager.requestOpenApi({ // 主动手机号外呼
930
+ // url: '/v1/task/importAgentCustomer',
931
+ // data: {
932
+ // agentTag: '15018707394',
933
+ // callType: 1001,
934
+ // customers: [{
935
+ // tag: '测试tag',
936
+ // number: call.value || 18617381945
937
+ // }]
938
+ // }
939
+ // })
939
940
  if (callInfo.code === 200) { // 正确响应
940
941
  alert('呼叫成功')
941
942
  } else {
@@ -0,0 +1,168 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport"
6
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
+ <title>microphone</title>
9
+ </head>
10
+ <body>
11
+ <style>
12
+ #dragable {
13
+ padding: 20px 0;
14
+ background: pink;
15
+ width: 660px!important;
16
+ height: auto!important;
17
+ transform: none!important;
18
+ cursor: move;
19
+ }
20
+ </style>
21
+
22
+ <div id="dragable">
23
+ <div style="min-width: 700px;" id="softphone-container"></div> <!-- 👈 软电话容器 -->
24
+ <br/>
25
+ <button id="taskButton" style="margin-left: 20px">任务呼叫</button>
26
+ : <input id="taskCall" placeholder="请输入任务id, 空值用测试任务" style="width: 180px"/> <input id="taskPhoneCall" placeholder="请输入手机号, 空值用测试手机号" style="width: 180px"/>
27
+ </div>
28
+
29
+ </body>
30
+ <script src="./util.js"></script>
31
+ <script src="./qiankun.js"></script>
32
+ <script src="./wujie.js"></script>
33
+ <script src="./CryptoJS.js"></script>
34
+ <script src="./microphone.js"></script>
35
+ <script src="./draggable.js"></script>
36
+ <script>
37
+ let nfSoftPhoneInstance
38
+ document.addEventListener('DOMContentLoaded', async (event) => {
39
+ new window.Draggable(document.getElementById('dragable'))
40
+
41
+ let sign = ''
42
+ const timestamp = Date.now()
43
+ // 国内
44
+ // const agentTag = 'zoujh-test'
45
+ // const appKey = '032d44009bff1752'
46
+ // const appSecret = '4c7304c94c5e8725613516d4d6db679b'
47
+ // 海外
48
+ const agentId = '2357'
49
+ const appKey = 'a52e61f0d9ff1527'
50
+ const appSecret = '7ed1d78fbe214ba8b8e6a2dc9c6955aa'
51
+
52
+ const str = appKey + timestamp
53
+ const sha1 = CryptoJS.HmacSHA1(str, appSecret)
54
+ sign = CryptoJS.enc.Base64.stringify(sha1)
55
+
56
+ let commonSoftphone // 软电话sdk实例
57
+
58
+ /**
59
+ 👈 拿到实例后可以手动触发软电话实例的各种动作,如签入,签出,接听,忽略,挂断等等,注意这个实例不是软电话实例,是链接软电话通讯的实例
60
+ */
61
+ nfSoftPhoneInstance = softphoneManager.initSoftphone({
62
+ el: document.getElementById('softphone-container'), // 👈 软电话容器
63
+ ancestorOrigin: 'nf-softphone1', // origin,ancestorOrigin,destinationOrigin具体含义参见下文,如果是单实例,可以写死origin=ai-softphone&destinationOrigin=nf-softphone&ancestorOrigin=nf-softphone
64
+ destinationOrigin: 'nf-softphone1',
65
+ name: 'nf-softphone1',
66
+
67
+ muteShow: '0', // 👈 屏蔽静音功能
68
+
69
+ // agentTag, // 👈 坐席唯一标志
70
+ agentId, // 👈 坐席唯一标志
71
+ appKey, // 👈 企业appKey
72
+ sign, // 👈 授权sign
73
+ timestamp,
74
+
75
+ /**
76
+ * start - 海外特有参数
77
+ */
78
+ sgGateway: '1', // 设置gatewayApi前缀调用地址, 默认undefined, 可选:'0'|'1'|string。示例: 'https://gateway.xxx.com'。 传'1'使用默认海外地址;传'0'或不传使用国内默认地址
79
+ sgBase: '1', // 设置baseApi前缀调用地址, 默认undefined, 可选:'0'|'1'|string。 示例: 'https://www.xxx.com/api'。 传'1'使用默认海外地址;传'0'或不传使用国内默认地址
80
+ sgOpen: '1', // 设置openApi前缀调用地址, 默认undefined, 可选:'0'|'1'|string。示例: 'https://www.xxx.com/openapi'。 传'1'使用默认海外地址;传'0'或不传使用国内默认地址
81
+
82
+ sgDomain: '1', // 切换海外环境代理, 默认undefined 可选:'0'|'1'。 传'1'切换海外;传'0'或不传使用国内
83
+ env: 'sg', // 切换海外环境微前端调用, 可选: 'dev' | 'test' | 'sg' | 'gray' | 'prod'
84
+ /**
85
+ * end - 海外特有参数
86
+ */
87
+
88
+ extStatus: '1', // 👈 初始化是否处于小休状态, 非1 小休 1 在线
89
+
90
+ softphoneConnectCallBack: async (data) => {
91
+ // if (data.status) {
92
+ // commonSoftphone = data.commonSoftphone
93
+ // const userAgentManager = await commonSoftphone.getUserAgentManager()
94
+ // const agentInfo = await userAgentManager.getAgentInfo()
95
+ // if (agentInfo.agentStatus != 1) {
96
+ // nfSoftPhoneInstance.seatsStatusChange(false)
97
+ // }
98
+ // }
99
+ }, // 👈 签入签出回调
100
+ softphoneAutoIgnoreCallback: (data) => {console.log('softphone-auto-ignore-callback', data)}, // 👈 自动忽略回调
101
+ softphoneCallRefreshCallBack: (data) => {console.log('softphone-call-refresh', data)}, // 👈 来电刷新来电记录列表回调
102
+ softphoneSeatStatusChangeCallBack: (data) => {console.log('softphone-seats-status-change', data)},// 👈 小休和在线切换回调
103
+ softphoneAcceptCallBack: (data) => {console.log('softphone-accept', data)},// 👈 接听回调
104
+ softphoneIgnoreCallBack: (data) => {console.log('softphone-ignore', data)},// 👈 忽略回调
105
+ softphoneHangupCallBack: (data) => {console.log('softphone-hangup', data)},// 👈 挂断回调
106
+ softphoneSessionStateChangeCallBack: (data) => {console.log('softphone-session-state-change', data)},// 👈 会话状态改变回调
107
+ softphoneIncomingCallBack: (data) => {console.log('softphone-incoming', data)},// 👈 来电回调
108
+ softphoneSendDtmfCallBack: (data) => {console.log('softphone-send-dtmf', data)},// 👈 转人工回调
109
+ softphoneConnectRegisteredCallBack: async (data) => {
110
+ // console.log('softphone-connect-registered', data)
111
+ // commonSoftphone = data.commonSoftphone
112
+ // const userAgentManager = await commonSoftphone.getUserAgentManager()
113
+ // const agentInfo = await userAgentManager.getAgentInfo()
114
+ // if (agentInfo.agentStatus != 1) {
115
+ // nfSoftPhoneInstance.seatsStatusChange(false)
116
+ // }
117
+ },// 👈 动态绑定动作完成回调(在这之后才能执行动作类总线通讯)
118
+ softphoneSignOverduedCallBack: (done) => { // 👈 注册sign过期后重新刷新sign逻辑
119
+ const timestamp = Date.now()
120
+ done({
121
+ timestamp,
122
+ sign: window.CryptoJS.enc.Base64.stringify(window.CryptoJS.HmacSHA1(appKey + timestamp, appSecret))
123
+ })
124
+ },
125
+ });
126
+
127
+ const taskButton = document.getElementById('taskButton')
128
+ const taskCall = document.getElementById('taskCall')
129
+ const taskPhoneCall = document.getElementById('taskPhoneCall')
130
+
131
+ // 任务外呼: 先桥接手机侧,手机侧接通后,再桥接坐席
132
+ const taskPhone = async () => {
133
+ const callInfo = await (await commonSoftphone.getUserAgentManager()).requestOpenApi({ // 任务外呼
134
+ url: '/v1/task/importTaskCustomer',
135
+ data: {
136
+ "requestId": generateUUID(), // 请求id,具有唯一性,用来做请求幂等处理,一个请求id有效期10分钟。不传则不做幂等处理
137
+ "taskId": taskCall.value || 93726, // 测试任务
138
+ "failReturn": 1, // 可选值:0,1,默认1。如导入的数据中有部分验证不通过数据:0表示导入验证成功的,返回失败的数据;1表示全部数据(包括验证成功及失败的)都不导入;
139
+ "customers":[
140
+ {
141
+ "tag": "xx", // 自定义透传参数,来电坐席电话端软电话sip头可以直接获取
142
+ "clientUrl": "xx", // 自定义来电弹屏显示的第三方页面,用来展示来电具体信息
143
+ "number": taskPhoneCall.value || 15018707394, // 外呼号码
144
+ "properties": { // 自定义透传参数,可以通过[挂断回调]回调给第三方后端,前端主动获取需要调用gateway接口
145
+ "尊称": "先生",
146
+ "姓名": "张三"
147
+ }
148
+ }
149
+ ]
150
+ }
151
+ })
152
+ if (callInfo.code === 200) { // 正确响应
153
+ alert('导号成功')
154
+ } else {
155
+ alert(callInfo.message)
156
+ }
157
+ }
158
+
159
+ taskButton.addEventListener('click', taskPhone) // 任务呼叫
160
+
161
+ })
162
+
163
+ document.addEventListener('unload', () => {
164
+ nfSoftPhoneInstance.destory()
165
+ })
166
+ </script>
167
+
168
+ </html>
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.Draggable=e()}(this,function(){"use strict";var t={grid:0,filterTarget:null,limit:{x:null,y:null},threshold:0,setCursor:!1,setPosition:!0,smoothDrag:!0,useGPU:!0,onDrag:u,onDragStart:u,onDragEnd:u},e={transform:function(){for(var t=" -o- -ms- -moz- -webkit-".split(" "),e=document.body.style,n=t.length;n--;){var o=t[n]+"transform";if(o in e)return o}}()},n={assign:function(){for(var t=arguments[0],e=arguments.length,n=1;n<e;n++){var o=arguments[n];for(var i in o)t[i]=o[i]}return t},bind:function(t,e){return function(){t.apply(e,arguments)}},on:function(t,e,o){if(e&&o)n.addEvent(t,e,o);else if(e)for(var i in e)n.addEvent(t,i,e[i])},off:function(t,e,o){if(e&&o)n.removeEvent(t,e,o);else if(e)for(var i in e)n.removeEvent(t,i,e[i])},limit:function(t,e){return e instanceof Array?t<(e=[+e[0],+e[1]])[0]?t=e[0]:t>e[1]&&(t=e[1]):t=+e,t},addEvent:"attachEvent"in Element.prototype?function(t,e,n){t.attachEvent("on"+e,n)}:function(t,e,n){t.addEventListener(e,n,!1)},removeEvent:"attachEvent"in Element.prototype?function(t,e,n){t.detachEvent("on"+e,n)}:function(t,e,n){t.removeEventListener(e,n)}};function o(e,o){var i=this,r=n.bind(i.start,i),s=n.bind(i.drag,i),u=n.bind(i.stop,i);if(!a(e))throw new TypeError("Draggable expects argument 0 to be an Element");o=n.assign({},t,o),n.assign(i,{element:e,handle:o.handle&&a(o.handle)?o.handle:e,handlers:{start:{mousedown:r,touchstart:r},move:{mousemove:s,mouseup:u,touchmove:s,touchend:u}},options:o}),i.initialize()}function i(t){return parseInt(t,10)}function r(t){return"currentStyle"in t?t.currentStyle:getComputedStyle(t)}function s(t){return null!=t}function a(t){return t instanceof Element||"undefined"!=typeof HTMLDocument&&t instanceof HTMLDocument}function u(){}return n.assign(o.prototype,{setOption:function(t,e){var n=this;return n.options[t]=e,n.initialize(),n},get:function(){var t=this.dragEvent;return{x:t.x,y:t.y}},set:function(t,e){var n=this.dragEvent;return n.original={x:n.x,y:n.y},this.move(t,e),this},dragEvent:{started:!1,x:0,y:0},initialize:function(){var t,o=this,i=o.element,s=(o.handle,i.style),a=r(i),u=o.options,f=e.transform,l=o._dimensions={height:i.offsetHeight,left:i.offsetLeft,top:i.offsetTop,width:i.offsetWidth};u.useGPU&&f&&("none"===(t=a[f])&&(t=""),s[f]=t+" translate3d(0,0,0)"),u.setPosition&&(s.display="block",s.left=l.left+"px",s.top=l.top+"px",s.width=l.width+"px",s.height=l.height+"px",s.bottom=s.right="auto",s.margin=0,s.position="absolute"),u.setCursor&&(s.cursor="move"),o.setLimit(u.limit),n.assign(o.dragEvent,{x:l.left,y:l.top}),n.on(o.handle,o.handlers.start)},start:function(t){var e=this,o=e.getCursor(t),i=e.element;e.useTarget(t.target||t.srcElement)&&(t.preventDefault&&!t.target.getAttribute("contenteditable")?t.preventDefault():t.target.getAttribute("contenteditable")||(t.returnValue=!1),e.dragEvent.oldZindex=i.style.zIndex,i.style.zIndex=1e4,e.setCursor(o),e.setPosition(),e.setZoom(),n.on(document,e.handlers.move))},drag:function(t){var e=this,n=e.dragEvent,o=e.element,i=e._cursor,r=e._dimensions,s=e.options,a=r.zoom,u=e.getCursor(t),f=s.threshold,l=(u.x-i.x)/a+r.left,d=(u.y-i.y)/a+r.top;!n.started&&f&&Math.abs(i.x-u.x)<f&&Math.abs(i.y-u.y)<f||(n.original||(n.original={x:l,y:d}),n.started||(s.onDragStart(o,l,d,t),n.started=!0),e.move(l,d)&&s.onDrag(o,n.x,n.y,t))},move:function(t,e){var n=this,o=n.dragEvent,i=n.options,r=i.grid,s=n.element.style,a=n.limit(t,e,o.original.x,o.original.y);return!i.smoothDrag&&r&&(a=n.round(a,r)),(a.x!==o.x||a.y!==o.y)&&(o.x=a.x,o.y=a.y,s.left=a.x+"px",s.top=a.y+"px",!0)},stop:function(t){var e,o=this,i=o.dragEvent,r=o.element,s=o.options,a=s.grid;n.off(document,o.handlers.move),r.style.zIndex=i.oldZindex,s.smoothDrag&&a&&(e=o.round({x:i.x,y:i.y},a),o.move(e.x,e.y),n.assign(o.dragEvent,e)),o.dragEvent.started&&s.onDragEnd(r,i.x,i.y,t),o.reset()},reset:function(){this.dragEvent.started=!1},round:function(t){var e=this.options.grid;return{x:e*Math.round(t.x/e),y:e*Math.round(t.y/e)}},getCursor:function(t){return{x:(t.targetTouches?t.targetTouches[0]:t).clientX,y:(t.targetTouches?t.targetTouches[0]:t).clientY}},setCursor:function(t){this._cursor=t},setLimit:function(t){var e=this,o=function(t,e){return{x:t,y:e}};if(t instanceof Function)e.limit=t;else if(a(t)){var i=e._dimensions,r=t.scrollHeight-i.height,u=t.scrollWidth-i.width;e.limit=function(t,e){return{x:n.limit(t,[0,u]),y:n.limit(e,[0,r])}}}else if(t){var f=s(t.x),l=s(t.y);e.limit=f||l?function(e,o){return{x:f?n.limit(e,t.x):e,y:l?n.limit(o,t.y):o}}:o}else e.limit=o},setPosition:function(){var t=this.element,e=t.style;n.assign(this._dimensions,{left:i(e.left)||t.offsetLeft,top:i(e.top)||t.offsetTop})},setZoom:function(){for(var t=this.element,e=1;t=t.offsetParent;){var n=r(t).zoom;if(n&&"normal"!==n){e=n;break}}this._dimensions.zoom=e},useTarget:function(t){var e=this.options.filterTarget;return!(e instanceof Function)||e(t)},destroy:function(){n.off(this.handle,this.handlers.start),n.off(document,this.handlers.move)}}),o});
@@ -8,6 +8,7 @@
8
8
  <title>microphone</title>
9
9
  </head>
10
10
  <body>
11
+ <br/>
11
12
  <div style="min-width: 700px;" id="softphone-container"></div> <!-- 👈 软电话容器 -->
12
13
  <br/>
13
14
  <button id="taskButton" style="margin-left: 20px">任务呼叫</button>
@@ -510,20 +510,17 @@ class SoftphoneManager {
510
510
  const shared = new Shared('default')
511
511
  if (props.getOfflineInfo) {
512
512
  shared.getOfflineInfo = async (data) => {
513
- return await props.getOfflineInfo
514
- !(data)
513
+ return await props.getOfflineInfo(data)
515
514
  }
516
515
  }
517
516
  if (props.changeALittleRest) {
518
517
  shared.changeALittleRest = async (data) => {
519
- return await props.changeALittleRest
520
- !(data)
518
+ return await props.changeALittleRest(data)
521
519
  }
522
520
  }
523
521
  if (props.quickCallWin) {
524
522
  shared.quickCallWin = async (data) => {
525
- return await props.quickCallWin
526
- !(data)
523
+ return await props.quickCallWin(data)
527
524
  }
528
525
  }
529
526
  (Object.keys(props.envMap).reduce((res, currentValue) => {