@94ai/softphone 4.0.1 → 5.0.1
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/html-softphone-demo/index.html +80 -64
- package/html-softphone-demo/softphone.umd.min.js +1 -2
- package/lib/index.d.ts +3 -0
- package/lib/softphone.cjs.min.cjs +1 -1
- package/lib/softphone.esm-bundler.min.mjs +1 -1
- package/lib/softphone.umd.min.js +1 -2
- package/package.json +3 -3
- package/src/const/index.ts +0 -120
- package/src/index.ts +0 -123
- package/src/sdk/index.ts +0 -1986
- package/src/types/index.ts +0 -343
- package/src/utils/index.ts +0 -301
|
@@ -332,24 +332,24 @@ document.addEventListener('DOMContentLoaded', async (event) => {
|
|
|
332
332
|
* }
|
|
333
333
|
* },
|
|
334
334
|
*/
|
|
335
|
-
const userAgentManager = UserAgentFactory.getUserAgentManager({
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
})
|
|
335
|
+
// const userAgentManager = UserAgentFactory.getUserAgentManager({
|
|
336
|
+
// agentTag: '15018707394', // 生产线 坐席维度定位
|
|
337
|
+
// appKey: '032d44009bff1752', // 生产线 企业维度定位
|
|
338
|
+
// appSecret: '4c7304c94c5e8725613516d4d6db679b', // 生产线 企业维度定位 这里直接使用appSecret做演示
|
|
339
|
+
// refreshSpeekVolumn(value) { // 当来电接通时,实时查看坐席说话的音量实际传送到给对方的音量大小
|
|
340
|
+
// volumn.innerText = value
|
|
341
|
+
// },
|
|
342
|
+
// refreshRequirementCheck(value) { // 权限网络检测
|
|
343
|
+
// browserSoftphoneEnv.innerText = JSON.stringify(value, null, 2)
|
|
344
|
+
// },
|
|
345
|
+
// refreshChat(info) { // 刷新会话记录
|
|
346
|
+
// chatInfo.innerText = JSON.stringify(info, null, 2)
|
|
347
|
+
// },
|
|
348
|
+
// refreshChatErrorCallback(e) {
|
|
349
|
+
// console.log(e)
|
|
350
|
+
// },
|
|
351
|
+
// enableChatInfoPush: true // 开启会话记录实时推送,开启后,当任务外呼时,可以实时获取通话记录信息,实时回调到refreshChat,中途出现任何异常会回调refreshChatErrorCallback
|
|
352
|
+
// })
|
|
353
353
|
|
|
354
354
|
/**
|
|
355
355
|
* 获取token & 实时查到tag等自定义注入字段对接步骤:(海外:gateway.sg.94ai.com, 国内:gateway.94ai.com)
|
|
@@ -460,48 +460,58 @@ document.addEventListener('DOMContentLoaded', async (event) => {
|
|
|
460
460
|
// const sipServerHost = `sip:${extensionNumber}@${wsRegisterAddress}` // fs地址
|
|
461
461
|
// const wsAddress = `${wsProtocol}://${wsRegisterAddress}` // socket地址
|
|
462
462
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
//
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
463
|
+
const extensionNumber = '1001' // 生产线 分机账号
|
|
464
|
+
const extPassword = '946666' // 生产线 分机密码
|
|
465
|
+
const wsProtocol = 'ws' // 生产线 外呼服务器地址协议
|
|
466
|
+
const wsRegisterAddress = '192.168.0.92:5066' // 生产线 外呼服务器地址
|
|
467
|
+
const sipServerHost = `sip:${extensionNumber}@${wsRegisterAddress}` // fs地址
|
|
468
|
+
const wsAddress = `${wsProtocol}://${wsRegisterAddress}` // socket地址
|
|
469
|
+
|
|
470
|
+
const userAgentManager = UserAgentFactory.getUserAgentManager({
|
|
471
|
+
authorizationPassword: extPassword, // 分机密码
|
|
472
|
+
authorizationUsername: extensionNumber, // 分机账号
|
|
473
|
+
uri: UserAgent.makeURI(sipServerHost), // fs地址
|
|
474
|
+
transportOptions: {
|
|
475
|
+
server: wsAddress // socket地址
|
|
476
|
+
},
|
|
477
|
+
logLevel: 'error', // 日志等级,默认error
|
|
478
|
+
// viaHost, // fp.umd.min.js生成的唯一值,用来配查呼叫问题,可以不传,内部会自动生成
|
|
479
|
+
contactName: extensionNumber, // sip协议要求,同分机账号即可,注意类型为string, 不传默认同分机账号
|
|
480
|
+
clusterMode: true,
|
|
481
|
+
reClusterRegisterTimeout: 1000,
|
|
482
|
+
reClusterConnectTimeout: 1000,
|
|
483
|
+
// refreshSpeekVolumn(value) { // 当来电接通时,实时查看坐席说话的音量实际传送到给对方的音量大小
|
|
484
|
+
// volumn.innerText = value
|
|
485
|
+
// },
|
|
486
|
+
// refreshRequirementCheck(value) { // 权限网络检测
|
|
487
|
+
// browserSoftphoneEnv.innerText = JSON.stringify(value, null, 2)
|
|
488
|
+
// },
|
|
489
|
+
// refreshChat(info) {
|
|
490
|
+
// chatInfo.innerText = JSON.stringify(info, null, 2)
|
|
491
|
+
// },
|
|
492
|
+
// refreshChatErrorCallback(e) {
|
|
493
|
+
// console.log(e)
|
|
494
|
+
// },
|
|
495
|
+
// enableChatInfoPush: true // 开启会话记录实时推送,开启后,当任务外呼时,可以实时获取通话记录信息,实时回调到refreshChat,中途出现任何异常会回调refreshChatErrorCallback
|
|
496
|
+
})
|
|
487
497
|
|
|
488
498
|
/**
|
|
489
499
|
* 获取坐席当前状态信息(注意牵扯到openAPI的信息需要angentId,即方式一。如果通过方式二需要手动使用userAgentManager.requestOpenApi获取,即上述example3
|
|
490
500
|
*/
|
|
491
|
-
const angentInfo = await userAgentManager.getAgentInfo()
|
|
492
|
-
if (angentInfo.code === 200) { // 正确响应
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
} else {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
501
|
+
// const angentInfo = await userAgentManager.getAgentInfo()
|
|
502
|
+
// if (angentInfo.code === 200) { // 正确响应
|
|
503
|
+
// info.innerText = `1. ${JSON.stringify(angentInfo.data, null, 2)}`
|
|
504
|
+
// if (angentInfo.data.agentStatus === 1) { // 页面按钮的禁用状态
|
|
505
|
+
// nap.disabled = false
|
|
506
|
+
// online.disabled = true // 可切换在线
|
|
507
|
+
// } else {
|
|
508
|
+
// nap.disabled = true // 可切换小休
|
|
509
|
+
// online.disabled = false
|
|
510
|
+
// }
|
|
511
|
+
// } else {
|
|
512
|
+
// alert(angentInfo.message)
|
|
513
|
+
// throw new Error(angentInfo)
|
|
514
|
+
// }
|
|
505
515
|
|
|
506
516
|
/**
|
|
507
517
|
* 签入
|
|
@@ -690,14 +700,20 @@ document.addEventListener('DOMContentLoaded', async (event) => {
|
|
|
690
700
|
try {
|
|
691
701
|
await new Promise((resolve, reject) => {
|
|
692
702
|
const fn = async () => {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
703
|
+
try {
|
|
704
|
+
await userAgentManager.acceptInvite({
|
|
705
|
+
onAck (info) { // 👈 接听响应成功
|
|
706
|
+
resolve(info)
|
|
707
|
+
},
|
|
708
|
+
onAckTimeout () { // 👈 接听响应失败
|
|
709
|
+
reject(new Error('接听响应失败'))
|
|
710
|
+
}
|
|
711
|
+
}) // 👈 一键接听,下行代码被执行说明接听信令被成功发出
|
|
712
|
+
} catch (e) {
|
|
713
|
+
console.log('accept error:', e.message)
|
|
714
|
+
reject(e)
|
|
715
|
+
throw e
|
|
716
|
+
}
|
|
701
717
|
console.log('接听信令被成功发出')
|
|
702
718
|
}
|
|
703
719
|
fn()
|