@94ai/softphone 5.0.13 → 5.0.15

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.
@@ -80,6 +80,7 @@ const nfSoftPhone1 = (new SoftphoneManager()).initSoftphone({ // 👈 当多实
80
80
  softphoneConnectCallBack: (data) => {
81
81
  console.log('softphone-connect')
82
82
  }, // 👈 签入签出回调
83
+ softphoneAutoIgnoreCallback: (data) => {console.log('softphone-auto-ignore-callback', data)}, // 👈 自动忽略回调
83
84
  softphoneCallRefreshCallBack: (data) => {console.log('softphone-call-refresh')}, // 👈 来电刷新来电记录列表回调
84
85
  softphoneSeatStatusChangeCallBack: (data) => {console.log('softphone-seats-status-change')},// 👈 小休和在线切换回调
85
86
  softphoneAcceptCallBack: (data) => {console.log('softphone-accept')},// 👈 接听回调
@@ -61,6 +61,7 @@ class SoftphoneManager {
61
61
  softphoneAcceptCallBack: () => {console.log('softphone-accept')},
62
62
  softphoneIgnoreCallBack: () => {console.log('softphone-ignore')},
63
63
  softphoneHangupCallBack: () => {console.log('softphone-hangup')},
64
+ softphoneAutoIgnoreCallback: () => {console.log('softphone-auto-ignore-callback')},
64
65
  softphoneSessionStateChangeCallBack: () => {console.log('softphone-session-state-change')},
65
66
  softphoneIncomingCallBack: () => {console.log('softphone-incoming')},
66
67
  softphoneSendDtmfCallBack: () => {console.log('softphone-send-dtmf')},
@@ -155,6 +156,8 @@ class SoftphoneManager {
155
156
  this.option.softphoneIgnoreCallBack?.(data)
156
157
  } else if (data.type === 'softphone-hangup') {
157
158
  this.option.softphoneHangupCallBack?.(data)
159
+ } else if (data.type === 'softphone-auto-ignore-callback') {
160
+ this.option.softphoneAutoIgnoreCallback?.(data)
158
161
  } else if (data.type === 'softphone-session-state-change') {
159
162
  this.option.softphoneSessionStateChangeCallBack?.(data)
160
163
  } else if (data.type === 'softphone-incoming') {
@@ -75,6 +75,7 @@ document.addEventListener('DOMContentLoaded', async (event) => {
75
75
  // }
76
76
  // }))
77
77
  }, // 👈 签入签出回调
78
+ softphoneAutoIgnoreCallback: (data) => {console.log('softphone-auto-ignore-callback', data)}, // 👈 自动忽略回调
78
79
  softphoneCallRefreshCallBack: (data) => {console.log('softphone-call-refresh', data)}, // 👈 来电刷新来电记录列表回调
79
80
  softphoneSeatStatusChangeCallBack: (data) => {console.log('softphone-seats-status-change', data)},// 👈 小休和在线切换回调
80
81
  softphoneAcceptCallBack: (data) => {console.log('softphone-accept', data)},// 👈 接听回调
@@ -80,6 +80,9 @@ class SoftphoneManager {
80
80
  softphoneAcceptCallBack: () => {
81
81
  console.log('softphone-accept')
82
82
  },
83
+ softphoneAutoIgnoreCallback: () => {
84
+ console.log('softphone-auto-ignore-callback')
85
+ },
83
86
  softphoneIgnoreCallBack: () => {
84
87
  console.log('softphone-ignore')
85
88
  },
@@ -285,42 +288,34 @@ class SoftphoneManager {
285
288
  sgOpen,
286
289
  sgDomain
287
290
  } = props
288
- if (sgOpen) {
289
- if (isDomainOrIP(sgOpen)) {
290
- return sgOpen
291
+ if (isDomainOrIP(sgOpen)) {
292
+ return sgOpen
293
+ }
294
+ if (sgOpen === '1') {
295
+ if (sgDomain === '1') {
296
+ return 'https://seat.teleai.com/teleaiopenapi'
291
297
  }
292
- if (sgOpen === '1') {
293
- if (sgDomain === '1') {
294
- return 'https://seat.teleai.com/sgopenapi'
295
- } else {
296
- return 'https://seat.teleai.com/openapi'
297
- }
298
- } else if (sgOpen === '0') {
299
- if (sgDomain === '1') {
300
- return 'https://seat.94ai.com/sgopenapi'
301
- } else {
302
- return 'https://seat.94ai.com/openapi'
303
- }
298
+ return 'https://seat.teleai.com/openapi'
299
+ } else {
300
+ if (sgDomain === '1') {
301
+ return 'https://seat.94ai.com/teleaiopenapi'
304
302
  }
303
+ return 'https://seat.94ai.com/openapi'
305
304
  }
306
- return 'https://seat.94ai.com/openapi'
307
305
  }
308
306
 
309
307
  getBase() {
310
308
  const {
311
309
  sgBase
312
310
  } = props
313
- if (sgBase) {
314
- if (isDomainOrIP(sgBase)) {
315
- return sgBase
316
- }
317
- if (sgBase === '1') {
318
- return 'https://seat.teleai.com/api'
319
- } else if (sgBase === '0') {
320
- return 'https://seat.94ai.com/api'
321
- }
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'
322
318
  }
323
- return undefined
324
319
  }
325
320
 
326
321
  getIsOem() {
@@ -729,6 +724,9 @@ class SoftphoneManager {
729
724
  'softphone-accept': (data) => {
730
725
  props.softphoneAcceptCallBack?.(data)
731
726
  },
727
+ 'softphone-auto-ignore-callback': (data) => {
728
+ props.softphoneAutoIgnoreCallback?.(data)
729
+ },
732
730
  'softphone-seats-status-change': (data) => {
733
731
  props.softphoneSeatStatusChangeCallBack?.(data)
734
732
  },
@@ -1,4 +1,7 @@
1
1
  function isDomainOrIP(str) {
2
+ if (!str) {
3
+ return false
4
+ }
2
5
  const ipPattern = /^(\d{1,3}\.){3}\d{1,3}$/
3
6
  const domainPattern = /^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/
4
7
  if (ipPattern.test(str)) {