ue-softphone-sdk 2.1.3 → 2.1.5

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/src/index.ts CHANGED
@@ -395,7 +395,6 @@ export default class ueSoftphone {
395
395
  loginInfo.data.pushServer,
396
396
  loginInfo.data.agent
397
397
  );
398
- debugger;
399
398
  if (loginType === "WEBRTC") {
400
399
  this.getWebrtcInfo(server, options);
401
400
  }
@@ -535,11 +534,15 @@ export default class ueSoftphone {
535
534
  });
536
535
 
537
536
  this.Socketinstance.on("message", (event: any, fn: Function) => {
538
- if (event.subType === "login" && event.data.eventType === "logout") {
537
+ if (event.subType === "KICK_OFF") {
539
538
  this.Socketinstance.disconnect();
540
- if (ueSoftphone.agentInfo.loginType === "WEBRTC") {
539
+ try {
541
540
  WebPhoneSdk.disconnect();
542
- }
541
+ } catch (error) {}
542
+ callbacks.error({
543
+ type: "accountError",
544
+ error: "您的账号在其他网页登录"
545
+ });
543
546
  }
544
547
  callbacks.message({
545
548
  subtype: event.subType,
@@ -1599,397 +1602,6 @@ export default class ueSoftphone {
1599
1602
  }
1600
1603
  });
1601
1604
  }
1602
- // listen(params: listenParams) {
1603
- // params.success =
1604
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1605
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1606
-
1607
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1608
- // params.fail({
1609
- // success: false,
1610
- // message: "initialization not complete!"
1611
- // });
1612
- // return;
1613
- // }
1614
-
1615
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1616
- // params.fail({
1617
- // success: false,
1618
- // message: "initialization not complete!"
1619
- // });
1620
- // return;
1621
- // }
1622
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1623
- // params.fail({
1624
- // success: false,
1625
- // message: "Parameter agentNumber is required!"
1626
- // });
1627
- // return;
1628
- // }
1629
-
1630
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1631
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/listen", {
1632
- // verb: "POST",
1633
- // body: params,
1634
- // loginToken: ueSoftphone.loginToken,
1635
- // sessionId: ueSoftphone.agentInfo._id,
1636
- // accountId: ueSoftphone.agentInfo.accountId,
1637
- // encryptionAlgorithm,
1638
- // encryptionFields,
1639
- // success: (res: any) => {
1640
- // if (res.success) {
1641
- // (params.success as Function)({
1642
- // success: true,
1643
- // message: "listen success",
1644
- // data: res.data.response.data
1645
- // });
1646
- // } else {
1647
- // (params.fail as Function)({
1648
- // success: false,
1649
- // message: res.message,
1650
- // code: res.code
1651
- // });
1652
- // }
1653
- // }
1654
- // });
1655
- // },
1656
- // loot(params: lootParams) {
1657
- // params.success =
1658
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1659
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1660
-
1661
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1662
- // params.fail({
1663
- // success: false,
1664
- // message: "initialization not complete!"
1665
- // });
1666
- // return;
1667
- // }
1668
-
1669
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1670
- // params.fail({
1671
- // success: false,
1672
- // message: "initialization not complete!"
1673
- // });
1674
- // return;
1675
- // }
1676
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1677
- // params.fail({
1678
- // success: false,
1679
- // message: "Parameter agentNumber is required!"
1680
- // });
1681
- // return;
1682
- // }
1683
-
1684
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1685
-
1686
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/loot", {
1687
- // verb: "POST",
1688
- // body: params,
1689
- // loginToken: ueSoftphone.loginToken,
1690
- // sessionId: ueSoftphone.agentInfo._id,
1691
- // accountId: ueSoftphone.agentInfo.accountId,
1692
- // encryptionAlgorithm,
1693
- // encryptionFields,
1694
- // success: (res: any) => {
1695
- // if (res.success) {
1696
- // (params.success as Function)({
1697
- // success: true,
1698
- // message: "loot success",
1699
- // data: res.data.response.data
1700
- // });
1701
- // } else {
1702
- // (params.fail as Function)({
1703
- // success: false,
1704
- // message: res.message,
1705
- // code: res.code
1706
- // });
1707
- // }
1708
- // }
1709
- // });
1710
- // },
1711
- // whisper(params: whisperParams) {
1712
- // params.success =
1713
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1714
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1715
-
1716
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1717
- // params.fail({
1718
- // success: false,
1719
- // message: "initialization not complete!"
1720
- // });
1721
- // return;
1722
- // }
1723
-
1724
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1725
- // params.fail({
1726
- // success: false,
1727
- // message: "initialization not complete!"
1728
- // });
1729
- // return;
1730
- // }
1731
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1732
- // params.fail({
1733
- // success: false,
1734
- // message: "Parameter agentNumber is required!"
1735
- // });
1736
- // return;
1737
- // }
1738
-
1739
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1740
-
1741
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/whisper", {
1742
- // verb: "POST",
1743
- // body: params,
1744
- // loginToken: ueSoftphone.loginToken,
1745
- // sessionId: ueSoftphone.agentInfo._id,
1746
- // accountId: ueSoftphone.agentInfo.accountId,
1747
- // encryptionAlgorithm,
1748
- // encryptionFields,
1749
- // success: (res: any) => {
1750
- // if (res.success) {
1751
- // (params.success as Function)({
1752
- // success: true,
1753
- // message: "whisper success",
1754
- // data: res.data.response.data
1755
- // });
1756
- // } else {
1757
- // (params.fail as Function)({
1758
- // success: false,
1759
- // message: res.message,
1760
- // code: res.code
1761
- // });
1762
- // }
1763
- // }
1764
- // });
1765
- // },
1766
- // breakin(params: breakinParams) {
1767
- // params.success =
1768
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1769
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1770
-
1771
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1772
- // params.fail({
1773
- // success: false,
1774
- // message: "initialization not complete!"
1775
- // });
1776
- // return;
1777
- // }
1778
-
1779
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1780
- // params.fail({
1781
- // success: false,
1782
- // message: "initialization not complete!"
1783
- // });
1784
- // return;
1785
- // }
1786
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1787
- // params.fail({
1788
- // success: false,
1789
- // message: "Parameter agentNumber is required!"
1790
- // });
1791
- // return;
1792
- // }
1793
-
1794
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1795
-
1796
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/breakin", {
1797
- // verb: "POST",
1798
- // body: params,
1799
- // loginToken: ueSoftphone.loginToken,
1800
- // sessionId: ueSoftphone.agentInfo._id,
1801
- // accountId: ueSoftphone.agentInfo.accountId,
1802
- // encryptionAlgorithm,
1803
- // encryptionFields,
1804
- // success: (res: any) => {
1805
- // if (res.success) {
1806
- // (params.success as Function)({
1807
- // success: true,
1808
- // message: "breakin success",
1809
- // data: res.data.response.data
1810
- // });
1811
- // } else {
1812
- // (params.fail as Function)({
1813
- // success: false,
1814
- // message: res.message,
1815
- // code: res.code
1816
- // });
1817
- // }
1818
- // }
1819
- // });
1820
- // },
1821
- // forcedHangup(params: forcedHangupParams) {
1822
- // params.success =
1823
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1824
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1825
-
1826
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1827
- // params.fail({
1828
- // success: false,
1829
- // message: "initialization not complete!"
1830
- // });
1831
- // return;
1832
- // }
1833
-
1834
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1835
- // params.fail({
1836
- // success: false,
1837
- // message: "initialization not complete!"
1838
- // });
1839
- // return;
1840
- // }
1841
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1842
- // params.fail({
1843
- // success: false,
1844
- // message: "Parameter agentNumber is required!"
1845
- // });
1846
- // return;
1847
- // }
1848
-
1849
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1850
-
1851
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/hangup", {
1852
- // verb: "POST",
1853
- // body: params,
1854
- // loginToken: ueSoftphone.loginToken,
1855
- // sessionId: ueSoftphone.agentInfo._id,
1856
- // accountId: ueSoftphone.agentInfo.accountId,
1857
- // encryptionAlgorithm,
1858
- // encryptionFields,
1859
- // success: (res: any) => {
1860
- // if (res.success) {
1861
- // (params.success as Function)({
1862
- // success: true,
1863
- // message: "forcedHangup success",
1864
- // data: res.data.response.data
1865
- // });
1866
- // } else {
1867
- // (params.fail as Function)({
1868
- // success: false,
1869
- // message: res.message,
1870
- // code: res.code
1871
- // });
1872
- // }
1873
- // }
1874
- // });
1875
- // },
1876
- // signin(params: signinParams) {
1877
- // params.success =
1878
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1879
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1880
-
1881
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1882
- // params.fail({
1883
- // success: false,
1884
- // message: "initialization not complete!"
1885
- // });
1886
- // return;
1887
- // }
1888
-
1889
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1890
- // params.fail({
1891
- // success: false,
1892
- // message: "initialization not complete!"
1893
- // });
1894
- // return;
1895
- // }
1896
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1897
- // params.fail({
1898
- // success: false,
1899
- // message: "Parameter agentNumber is required!"
1900
- // });
1901
- // return;
1902
- // }
1903
- // if (params.loginType === null || params.loginType === undefined) {
1904
- // params.fail({
1905
- // success: false,
1906
- // message: "Parameter loginType is required!"
1907
- // });
1908
- // return;
1909
- // }
1910
-
1911
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1912
-
1913
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signin", {
1914
- // verb: "POST",
1915
- // body: params,
1916
- // loginToken: ueSoftphone.loginToken,
1917
- // sessionId: ueSoftphone.agentInfo._id,
1918
- // accountId: ueSoftphone.agentInfo.accountId,
1919
- // encryptionAlgorithm,
1920
- // encryptionFields,
1921
- // success: (res: any) => {
1922
- // if (res.success) {
1923
- // (params.success as Function)({
1924
- // success: true,
1925
- // message: "signin success",
1926
- // data: res.data.response.data
1927
- // });
1928
- // } else {
1929
- // (params.fail as Function)({
1930
- // success: false,
1931
- // message: res.message,
1932
- // code: res.code
1933
- // });
1934
- // }
1935
- // }
1936
- // });
1937
- // },
1938
- // signout(params: signoutParams) {
1939
- // params.success =
1940
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1941
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1942
-
1943
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1944
- // params.fail({
1945
- // success: false,
1946
- // message: "initialization not complete!"
1947
- // });
1948
- // return;
1949
- // }
1950
-
1951
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1952
- // params.fail({
1953
- // success: false,
1954
- // message: "initialization not complete!"
1955
- // });
1956
- // return;
1957
- // }
1958
- // if (params.agentNumber === null || params.agentNumber === undefined) {
1959
- // params.fail({
1960
- // success: false,
1961
- // message: "Parameter agentNumber is required!"
1962
- // });
1963
- // return;
1964
- // }
1965
-
1966
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1967
-
1968
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signout", {
1969
- // verb: "POST",
1970
- // body: params,
1971
- // loginToken: ueSoftphone.loginToken,
1972
- // sessionId: ueSoftphone.agentInfo._id,
1973
- // accountId: ueSoftphone.agentInfo.accountId,
1974
- // encryptionAlgorithm,
1975
- // encryptionFields,
1976
- // success: (res: any) => {
1977
- // if (res.success) {
1978
- // (params.success as Function)({
1979
- // success: true,
1980
- // message: "signout success",
1981
- // data: res.data.response.data
1982
- // });
1983
- // } else {
1984
- // (params.fail as Function)({
1985
- // success: false,
1986
- // message: res.message,
1987
- // code: res.code
1988
- // });
1989
- // }
1990
- // }
1991
- // });
1992
- // }
1993
1605
  };
1994
1606
  };
1995
1607
 
@@ -2037,13 +1649,6 @@ export default class ueSoftphone {
2037
1649
  loginNumber = ueSoftphone.agentInfo.webrtcSipNumber;
2038
1650
  }
2039
1651
 
2040
- if (loginNumber === null || loginNumber === undefined) {
2041
- params.fail({
2042
- success: false,
2043
- message: "Please fill in the loginNumber field according to the document"
2044
- });
2045
- return;
2046
- }
2047
1652
  const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2048
1653
  const query: UpdateLoginTypeParams = {
2049
1654
  loginType: params.loginType,
@@ -2214,11 +1819,6 @@ export default class ueSoftphone {
2214
1819
  if (res.success) {
2215
1820
  if (params) {
2216
1821
  ueSoftphone.Socketinstance.disconnect();
2217
- // if (ueSoftphone.initOptions.hasMonitor) {
2218
- // // 有监控的话,退出的时候,要把监控的socket也关掉
2219
- // ueSoftphone.MonitorSocketinstance.disconnect();
2220
- // clearInterval(ueSoftphone.ueTimer); // 清除定时器
2221
- // }
2222
1822
  if (ueSoftphone.agentInfo.loginType === "WEBRTC") {
2223
1823
  WebPhoneSdk.disconnect();
2224
1824
  }
@@ -2440,396 +2040,6 @@ export default class ueSoftphone {
2440
2040
  }
2441
2041
  };
2442
2042
  };
2443
-
2444
- // private _monitorApi = () => {
2445
- // return {
2446
- // // 监听
2447
- // listen(params: listenParams) {
2448
- // params.success =
2449
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2450
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2451
-
2452
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2453
- // params.fail({
2454
- // success: false,
2455
- // message: "initialization not complete!"
2456
- // });
2457
- // return;
2458
- // }
2459
-
2460
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2461
- // params.fail({
2462
- // success: false,
2463
- // message: "initialization not complete!"
2464
- // });
2465
- // return;
2466
- // }
2467
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2468
- // params.fail({
2469
- // success: false,
2470
- // message: "Parameter agentNumber is required!"
2471
- // });
2472
- // return;
2473
- // }
2474
-
2475
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2476
-
2477
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/listen", {
2478
- // verb: "POST",
2479
- // body: params,
2480
- // loginToken: ueSoftphone.loginToken,
2481
- // sessionId: ueSoftphone.agentInfo._id,
2482
- // accountId: ueSoftphone.agentInfo.accountId,
2483
- // success: (res: any) => {
2484
- // if (res.success) {
2485
- // (params.success as Function)({
2486
- // success: true,
2487
- // message: "listen success",
2488
- // data: res.data.response.data
2489
- // });
2490
- // } else {
2491
- // (params.fail as Function)({
2492
- // success: false,
2493
- // message: res.message,
2494
- // code: res.code
2495
- // });
2496
- // }
2497
- // }
2498
- // });
2499
- // },
2500
- // // 抢接
2501
- // loot(params: lootParams) {
2502
- // params.success =
2503
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2504
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2505
-
2506
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2507
- // params.fail({
2508
- // success: false,
2509
- // message: "initialization not complete!"
2510
- // });
2511
- // return;
2512
- // }
2513
-
2514
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2515
- // params.fail({
2516
- // success: false,
2517
- // message: "initialization not complete!"
2518
- // });
2519
- // return;
2520
- // }
2521
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2522
- // params.fail({
2523
- // success: false,
2524
- // message: "Parameter agentNumber is required!"
2525
- // });
2526
- // return;
2527
- // }
2528
-
2529
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2530
-
2531
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/loot", {
2532
- // verb: "POST",
2533
- // body: params,
2534
- // loginToken: ueSoftphone.loginToken,
2535
- // sessionId: ueSoftphone.agentInfo._id,
2536
- // accountId: ueSoftphone.agentInfo.accountId,
2537
- // success: (res: any) => {
2538
- // if (res.success) {
2539
- // (params.success as Function)({
2540
- // success: true,
2541
- // message: "loot success",
2542
- // data: res.data.response.data
2543
- // });
2544
- // } else {
2545
- // (params.fail as Function)({
2546
- // success: false,
2547
- // message: res.message,
2548
- // code: res.code
2549
- // });
2550
- // }
2551
- // }
2552
- // });
2553
- // },
2554
- // // 耳语
2555
- // whisper(params: whisperParams) {
2556
- // params.success =
2557
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2558
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2559
-
2560
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2561
- // params.fail({
2562
- // success: false,
2563
- // message: "initialization not complete!"
2564
- // });
2565
- // return;
2566
- // }
2567
-
2568
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2569
- // params.fail({
2570
- // success: false,
2571
- // message: "initialization not complete!"
2572
- // });
2573
- // return;
2574
- // }
2575
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2576
- // params.fail({
2577
- // success: false,
2578
- // message: "Parameter agentNumber is required!"
2579
- // });
2580
- // return;
2581
- // }
2582
-
2583
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2584
-
2585
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/whisper", {
2586
- // verb: "POST",
2587
- // body: params,
2588
- // loginToken: ueSoftphone.loginToken,
2589
- // sessionId: ueSoftphone.agentInfo._id,
2590
- // accountId: ueSoftphone.agentInfo.accountId,
2591
- // success: (res: any) => {
2592
- // if (res.success) {
2593
- // (params.success as Function)({
2594
- // success: true,
2595
- // message: "whisper success",
2596
- // data: res.data.response.data
2597
- // });
2598
- // } else {
2599
- // (params.fail as Function)({
2600
- // success: false,
2601
- // message: res.message,
2602
- // code: res.code
2603
- // });
2604
- // }
2605
- // }
2606
- // });
2607
- // },
2608
- // // 强插
2609
- // breakin(params: breakinParams) {
2610
- // params.success =
2611
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2612
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2613
-
2614
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2615
- // params.fail({
2616
- // success: false,
2617
- // message: "initialization not complete!"
2618
- // });
2619
- // return;
2620
- // }
2621
-
2622
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2623
- // params.fail({
2624
- // success: false,
2625
- // message: "initialization not complete!"
2626
- // });
2627
- // return;
2628
- // }
2629
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2630
- // params.fail({
2631
- // success: false,
2632
- // message: "Parameter agentNumber is required!"
2633
- // });
2634
- // return;
2635
- // }
2636
-
2637
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2638
-
2639
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/breakin", {
2640
- // verb: "POST",
2641
- // body: params,
2642
- // loginToken: ueSoftphone.loginToken,
2643
- // sessionId: ueSoftphone.agentInfo._id,
2644
- // accountId: ueSoftphone.agentInfo.accountId,
2645
- // success: (res: any) => {
2646
- // if (res.success) {
2647
- // (params.success as Function)({
2648
- // success: true,
2649
- // message: "breakin success",
2650
- // data: res.data.response.data
2651
- // });
2652
- // } else {
2653
- // (params.fail as Function)({
2654
- // success: false,
2655
- // message: res.message,
2656
- // code: res.code
2657
- // });
2658
- // }
2659
- // }
2660
- // });
2661
- // },
2662
- // // 强拆
2663
- // forcedHangup(params: forcedHangupParams) {
2664
- // params.success =
2665
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2666
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2667
-
2668
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2669
- // params.fail({
2670
- // success: false,
2671
- // message: "initialization not complete!"
2672
- // });
2673
- // return;
2674
- // }
2675
-
2676
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2677
- // params.fail({
2678
- // success: false,
2679
- // message: "initialization not complete!"
2680
- // });
2681
- // return;
2682
- // }
2683
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2684
- // params.fail({
2685
- // success: false,
2686
- // message: "Parameter agentNumber is required!"
2687
- // });
2688
- // return;
2689
- // }
2690
-
2691
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2692
-
2693
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/hangup", {
2694
- // verb: "POST",
2695
- // body: params,
2696
- // loginToken: ueSoftphone.loginToken,
2697
- // sessionId: ueSoftphone.agentInfo._id,
2698
- // accountId: ueSoftphone.agentInfo.accountId,
2699
- // success: (res: any) => {
2700
- // if (res.success) {
2701
- // (params.success as Function)({
2702
- // success: true,
2703
- // message: "forcedHangup success",
2704
- // data: res.data.response.data
2705
- // });
2706
- // } else {
2707
- // (params.fail as Function)({
2708
- // success: false,
2709
- // message: res.message,
2710
- // code: res.code
2711
- // });
2712
- // }
2713
- // }
2714
- // });
2715
- // },
2716
- // // 签入
2717
- // signin(params: signinParams) {
2718
- // params.success =
2719
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2720
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2721
-
2722
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2723
- // params.fail({
2724
- // success: false,
2725
- // message: "initialization not complete!"
2726
- // });
2727
- // return;
2728
- // }
2729
-
2730
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2731
- // params.fail({
2732
- // success: false,
2733
- // message: "initialization not complete!"
2734
- // });
2735
- // return;
2736
- // }
2737
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2738
- // params.fail({
2739
- // success: false,
2740
- // message: "Parameter agentNumber is required!"
2741
- // });
2742
- // return;
2743
- // }
2744
- // if (params.loginType === null || params.loginType === undefined) {
2745
- // params.fail({
2746
- // success: false,
2747
- // message: "Parameter loginType is required!"
2748
- // });
2749
- // return;
2750
- // }
2751
-
2752
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2753
-
2754
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signin", {
2755
- // verb: "POST",
2756
- // body: params,
2757
- // loginToken: ueSoftphone.loginToken,
2758
- // sessionId: ueSoftphone.agentInfo._id,
2759
- // accountId: ueSoftphone.agentInfo.accountId,
2760
- // success: (res: any) => {
2761
- // if (res.success) {
2762
- // (params.success as Function)({
2763
- // success: true,
2764
- // message: "signin success",
2765
- // data: res.data.response.data
2766
- // });
2767
- // } else {
2768
- // (params.fail as Function)({
2769
- // success: false,
2770
- // message: res.message,
2771
- // code: res.code
2772
- // });
2773
- // }
2774
- // }
2775
- // });
2776
- // },
2777
- // // 签出
2778
- // signout(params: signoutParams) {
2779
- // params.success =
2780
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2781
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2782
-
2783
- // if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
2784
- // params.fail({
2785
- // success: false,
2786
- // message: "initialization not complete!"
2787
- // });
2788
- // return;
2789
- // }
2790
-
2791
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2792
- // params.fail({
2793
- // success: false,
2794
- // message: "initialization not complete!"
2795
- // });
2796
- // return;
2797
- // }
2798
- // if (params.agentNumber === null || params.agentNumber === undefined) {
2799
- // params.fail({
2800
- // success: false,
2801
- // message: "Parameter agentNumber is required!"
2802
- // });
2803
- // return;
2804
- // }
2805
-
2806
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2807
-
2808
- // ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signout", {
2809
- // verb: "POST",
2810
- // body: params,
2811
- // loginToken: ueSoftphone.loginToken,
2812
- // sessionId: ueSoftphone.agentInfo._id,
2813
- // accountId: ueSoftphone.agentInfo.accountId,
2814
- // success: (res: any) => {
2815
- // if (res.success) {
2816
- // (params.success as Function)({
2817
- // success: true,
2818
- // message: "signout success",
2819
- // data: res.data.response.data
2820
- // });
2821
- // } else {
2822
- // (params.fail as Function)({
2823
- // success: false,
2824
- // message: res.message,
2825
- // code: res.code
2826
- // });
2827
- // }
2828
- // }
2829
- // });
2830
- // }
2831
- // };
2832
- // };
2833
2043
  }
2834
2044
 
2835
2045
  class ueWebsocket {
@@ -2851,7 +2061,7 @@ class ueWebsocket {
2851
2061
 
2852
2062
  if (type === "message") {
2853
2063
  this.ws.on("call", callback);
2854
- // this.ws.on("commonEvent", callback);
2064
+ this.ws.on("event", callback);
2855
2065
  // this.ws.on("monitor", callback);
2856
2066
  }
2857
2067
  }