ue-softphone-sdk 2.0.2 → 2.0.4

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.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "ue-softphone-sdk",
5
5
  "main": "dist/ue-softphone-sdk.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: cuixuecheng
3
3
  * @Date: 2023-02-21 18:40:21
4
4
  * @LastEditors: 杨钰宸
5
- * @LastEditTime: 2023-08-01 16:10:00
5
+ * @LastEditTime: 2023-08-03 10:01:36
6
6
  * @Description:
7
7
  */
8
8
 
@@ -396,6 +396,7 @@ export default class ueSoftphone {
396
396
  loginInfo.data.pushServer,
397
397
  loginInfo.data.agent
398
398
  );
399
+ debugger;
399
400
  if (loginType === "WEBRTC") {
400
401
  this.getWebrtcInfo(server, options);
401
402
  }
@@ -856,7 +857,8 @@ export default class ueSoftphone {
856
857
  agentNumber: ueSoftphone.agentInfo.agentNumber,
857
858
  accountId: ueSoftphone.agentInfo.accountId,
858
859
  agentId: ueSoftphone.agentInfo._id,
859
- loginType: params.loginType || ueSoftphone.initOptions.loginType
860
+ loginType:
861
+ params.loginType || ueSoftphone.agentInfo.loginType || ueSoftphone.initOptions.loginType
860
862
  };
861
863
  if (params.agentTimeout) {
862
864
  query.agentTimeout = params.agentTimeout;
@@ -2065,7 +2067,7 @@ export default class ueSoftphone {
2065
2067
  loginToken: ueSoftphone.loginToken,
2066
2068
  sessionId: ueSoftphone.agentInfo._id,
2067
2069
  accountId: ueSoftphone.agentInfo.accountId,
2068
- success: (res: any) => {
2070
+ success: async (res: any) => {
2069
2071
  if (res.success) {
2070
2072
  (params.success as Function)({
2071
2073
  success: true,
@@ -2073,8 +2075,18 @@ export default class ueSoftphone {
2073
2075
  ...audioObj
2074
2076
  });
2075
2077
  ueSoftphone.agentInfo.loginType = params.loginType;
2078
+
2076
2079
  if (params.loginType === "WEBRTC") {
2077
2080
  that._webPhoneApi().connect();
2081
+ } else if (params.loginType === "PSTN") {
2082
+ await ueSoftphone.request(server + "/platform/action/updateCallConfig", {
2083
+ verb: "POST",
2084
+ body: { agentCallConfig: {}, mobile: params.loginNumber! },
2085
+ loginToken: ueSoftphone.loginToken,
2086
+ sessionId: ueSoftphone.agentInfo._id,
2087
+ accountId: ueSoftphone.agentInfo.accountId
2088
+ });
2089
+ that._webPhoneApi().disconnect();
2078
2090
  } else {
2079
2091
  that._webPhoneApi().disconnect();
2080
2092
  }
@@ -2825,7 +2837,7 @@ class ueWebsocket {
2825
2837
  private ws: any;
2826
2838
  constructor(server: string, proto: any) {
2827
2839
  //@ts-ignore
2828
- this.ws = io.connect(server, proto);
2840
+ this.ws = io.connect(`wss://${server}`, proto);
2829
2841
  }
2830
2842
  public on(type: string, callback: Function) {
2831
2843
  if (type === "connect") {