ue-softphone-sdk 2.1.6 → 2.1.8

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": "ue-softphone-sdk",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "ue-softphone-sdk",
5
5
  "main": "dist/ue-softphone-sdk.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -534,6 +534,16 @@ export default class ueSoftphone {
534
534
  });
535
535
 
536
536
  this.Socketinstance.on("message", (event: any, fn: Function) => {
537
+ callbacks.message({
538
+ subtype: event.subType,
539
+ data: event.data
540
+ });
541
+ if (fn && typeof fn === "function") {
542
+ fn("success");
543
+ }
544
+ });
545
+
546
+ this.Socketinstance.on("event", (event: any) => {
537
547
  if (event.subType === "KICK_OFF") {
538
548
  this.Socketinstance.disconnect();
539
549
  try {
@@ -544,13 +554,6 @@ export default class ueSoftphone {
544
554
  error: "您的账号在其他网页登录"
545
555
  });
546
556
  }
547
- callbacks.message({
548
- subtype: event.subType,
549
- data: event.data
550
- });
551
- if (fn && typeof fn === "function") {
552
- fn("success");
553
- }
554
557
  });
555
558
  }
556
559
 
@@ -2061,8 +2064,10 @@ class ueWebsocket {
2061
2064
 
2062
2065
  if (type === "message") {
2063
2066
  this.ws.on("call", callback);
2067
+ }
2068
+
2069
+ if (type === "event") {
2064
2070
  this.ws.on("event", callback);
2065
- // this.ws.on("monitor", callback);
2066
2071
  }
2067
2072
  }
2068
2073
  public emit(type: string, params: any, callback: Function) {
package/src/new-index.ts CHANGED
@@ -249,9 +249,12 @@ class ueWebsocket {
249
249
 
250
250
  if (type === "message") {
251
251
  this.ws.on("call", callback);
252
- this.ws.on("event", callback);
253
252
  // this.ws.on("monitor", callback);
254
253
  }
254
+
255
+ if (type === "event") {
256
+ this.ws.on("event", callback);
257
+ }
255
258
  }
256
259
  public emit(type: string, params: any, callback: Function) {
257
260
  this.ws.emit(type, params, callback);
@@ -566,23 +569,27 @@ export default class ueSoftphone {
566
569
  });
567
570
 
568
571
  this.Socketinstance.on("message", (event: any, fn: Function) => {
572
+ callbacks.message({
573
+ subtype: event.subType,
574
+ data: event.data
575
+ });
576
+ if (fn && typeof fn === "function") {
577
+ fn("success");
578
+ }
579
+ });
580
+
581
+ this.Socketinstance.on("event", (event: any) => {
569
582
  if (event.subType === "KICK_OFF") {
570
583
  this.Socketinstance.disconnect();
571
584
  try {
572
585
  WebPhoneSdk.disconnect();
573
586
  } catch (error) {}
587
+
574
588
  callbacks.error({
575
589
  type: "accountError",
576
590
  error: "您的账号在其他网页登录"
577
591
  });
578
592
  }
579
- callbacks.message({
580
- subtype: event.subType,
581
- data: event.data
582
- });
583
- if (fn && typeof fn === "function") {
584
- fn("success");
585
- }
586
593
  });
587
594
  }
588
595