Browse Source

fix: 修改逻辑

余尚辉 3 months ago
parent
commit
706fd02681

+ 5 - 5
dist/hs-cti.d.ts

@@ -4,11 +4,11 @@
 - Version 1.0.9 
 - JS Standard any
 - Author platformfe
-- Built on 2024/11/27 10:37:38
+- Built on 2024/11/28 16:42:50
 - GitHub 
-- Branch main
-- CommitID 987d86cd91cde7d1c235ad106d79fc92c305b8ff
-- CommitMessage fix: 修改socket地址
+- Branch dev_20241128
+- CommitID 19adbaf3eac6f9386a1ab1630ea855872d8554ca
+- CommitMessage fix: 完善代码
 */
 /**
  * Minimal `EventEmitter` interface that is molded against the Node.js
@@ -545,7 +545,7 @@ declare class HsCTI extends EventEmitter {
     /** @public bye SDK SIP 挂断 */
     bye(): Promise<CTIRes>;
     /** @public serverBye 挂断且流转坐席状态 */
-    serverBye(): Promise<CTIRes | undefined>;
+    serverBye(): Promise<CTIRes>;
     /** @public turnHang 流转坐席状态-通话结束 */
     private turnHang;
     /** @public getAgentStatus 获取坐席状态 */

+ 26 - 20
dist/hs-cti.es5.esm.js

@@ -4,11 +4,11 @@
 - Version 1.0.9 
 - JS Standard es5
 - Author platformfe
-- Built on 2024/11/27 10:37:38
+- Built on 2024/11/28 16:42:50
 - GitHub 
-- Branch main
-- CommitID 987d86cd91cde7d1c235ad106d79fc92c305b8ff
-- CommitMessage fix: 修改socket地址
+- Branch dev_20241128
+- CommitID 19adbaf3eac6f9386a1ab1630ea855872d8554ca
+- CommitMessage fix: 完善代码
 */
 import { Web, RequestPendingError, SessionState, UserAgent, UserAgentState, Registerer, RegistererState, Inviter, Invitation, Session, Messager } from 'sip.js';
 import io from 'socket.io-client';
@@ -4219,15 +4219,17 @@ var HsCTI = /** @class */function (_super) {
       var lastStatus = this._ctiStatusList.slice(-1)[0];
       if (lastStatus !== CTIStatus.Initial) return;
       this.setAudioSrc(AudioName.ByeAudio, false);
-      switch (this.scene) {
-        case Scene.Robot:
-        case Scene.Monitor:
-          this.setAudioSrc(AudioName.RingAudio, true);
-          break;
-        case Scene.Manual:
-          this.setAudioSrc(AudioName.WaitAudio, true);
-          break;
-      }
+      this.setAudioSrc(AudioName.RingAudio, true);
+      this.setAudioSrc(AudioName.WaitAudio, true);
+      // switch (this.scene) {
+      //   case Scene.Robot:
+      //   case Scene.Monitor:
+      //     this.setAudioSrc(AudioName.RingAudio, true)
+      //     break
+      //   case Scene.Manual:
+      //     this.setAudioSrc(AudioName.WaitAudio, true)
+      //     break
+      // }
       this.getInitConfig();
     }
   });
@@ -4498,7 +4500,7 @@ var HsCTI = /** @class */function (_super) {
         },
         onInvite: function (invitation) {
           // this.scene = Scene.Robot
-          var callId = invitation.request.getHeader('P-LIBRA-CallId') || '';
+          var callId = invitation.request.getHeader('P-LIBRA-CallId') || invitation.request.getHeader('P-LIBRA-Callid') || '';
           console.log(callId, 2888888888);
           // const ctiFlowId =
           //   invitation.request.getHeader('P-LIBRA-CtiFlowId') || ''
@@ -4553,10 +4555,14 @@ var HsCTI = /** @class */function (_super) {
                   _this.stopAudio(AudioName.ByeAudio, false);
                 }, 1000);
                 _this.stopLocalAudio();
-                _this._callStatus = CallStatus.Stopped;
+                // this._baseParams.scene = Scene.Manual
                 setBaseOption(BaseOption.TrackParams, {
                   call_id: ''
                 });
+                if (_this.scene == Scene.Manual) {
+                  _this.scene = Scene.Robot;
+                  _this._baseParams.scene = Scene.Robot;
+                }
                 break;
             }
           });
@@ -4821,6 +4827,8 @@ var HsCTI = /** @class */function (_super) {
         return __generator(this, function (_a) {
           switch (_a.label) {
             case 0:
+              this.scene = Scene.Robot;
+              this._baseParams.scene = Scene.Robot;
               return [4 /*yield*/, agentSetIdle(this._baseParams)];
             case 1:
               return [2 /*return*/, _a.sent()];
@@ -4856,6 +4864,8 @@ var HsCTI = /** @class */function (_super) {
         return __generator(this, function (_a) {
           switch (_a.label) {
             case 0:
+              this.scene = Scene.Manual;
+              this._baseParams.scene = Scene.Manual;
               // 如果当前通话状态处于外呼开始,则不允许再次调用此方法并上报埋点
               if (this._callStatus === CallStatus.Started) {
                 return [2 /*return*/];
@@ -4994,10 +5004,6 @@ var HsCTI = /** @class */function (_super) {
             case 0:
               _a.trys.push([0, 2,, 3]);
               this.bye();
-              // 如果人工外呼场景下,没有flowId则不调用并上报埋点
-              if (!this._baseParams.ctiFlowId && this.scene === Scene.Manual) {
-                return [2 /*return*/];
-              }
               return [4 /*yield*/, this.turnHang()];
             case 1:
               res = _a.sent();
@@ -5024,7 +5030,7 @@ var HsCTI = /** @class */function (_super) {
           switch (_a.label) {
             case 0:
               return [4 /*yield*/, manualHang(__assign(__assign({}, this._baseParams), {
-                callId: this._callId
+                call_id: this._callId
               }))];
             case 1:
               res = _a.sent();

File diff suppressed because it is too large
+ 4 - 4
dist/hs-cti.es5.esm.prod.js


+ 26 - 20
dist/hs-cti.es5.umd.js

@@ -4,11 +4,11 @@
 - Version 1.0.9 
 - JS Standard es5
 - Author platformfe
-- Built on 2024/11/27 10:37:38
+- Built on 2024/11/28 16:42:50
 - GitHub 
-- Branch main
-- CommitID 987d86cd91cde7d1c235ad106d79fc92c305b8ff
-- CommitMessage fix: 修改socket地址
+- Branch dev_20241128
+- CommitID 19adbaf3eac6f9386a1ab1630ea855872d8554ca
+- CommitMessage fix: 完善代码
 */
 (function (global, factory) {
     typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sip.js'), require('socket.io-client')) :
@@ -4222,15 +4222,17 @@
           var lastStatus = this._ctiStatusList.slice(-1)[0];
           if (lastStatus !== exports.CTIStatus.Initial) return;
           this.setAudioSrc(AudioName.ByeAudio, false);
-          switch (this.scene) {
-            case exports.Scene.Robot:
-            case exports.Scene.Monitor:
-              this.setAudioSrc(AudioName.RingAudio, true);
-              break;
-            case exports.Scene.Manual:
-              this.setAudioSrc(AudioName.WaitAudio, true);
-              break;
-          }
+          this.setAudioSrc(AudioName.RingAudio, true);
+          this.setAudioSrc(AudioName.WaitAudio, true);
+          // switch (this.scene) {
+          //   case Scene.Robot:
+          //   case Scene.Monitor:
+          //     this.setAudioSrc(AudioName.RingAudio, true)
+          //     break
+          //   case Scene.Manual:
+          //     this.setAudioSrc(AudioName.WaitAudio, true)
+          //     break
+          // }
           this.getInitConfig();
         }
       });
@@ -4501,7 +4503,7 @@
             },
             onInvite: function (invitation) {
               // this.scene = Scene.Robot
-              var callId = invitation.request.getHeader('P-LIBRA-CallId') || '';
+              var callId = invitation.request.getHeader('P-LIBRA-CallId') || invitation.request.getHeader('P-LIBRA-Callid') || '';
               console.log(callId, 2888888888);
               // const ctiFlowId =
               //   invitation.request.getHeader('P-LIBRA-CtiFlowId') || ''
@@ -4556,10 +4558,14 @@
                       _this.stopAudio(AudioName.ByeAudio, false);
                     }, 1000);
                     _this.stopLocalAudio();
-                    _this._callStatus = exports.CallStatus.Stopped;
+                    // this._baseParams.scene = Scene.Manual
                     setBaseOption(BaseOption.TrackParams, {
                       call_id: ''
                     });
+                    if (_this.scene == exports.Scene.Manual) {
+                      _this.scene = exports.Scene.Robot;
+                      _this._baseParams.scene = exports.Scene.Robot;
+                    }
                     break;
                 }
               });
@@ -4824,6 +4830,8 @@
             return __generator(this, function (_a) {
               switch (_a.label) {
                 case 0:
+                  this.scene = exports.Scene.Robot;
+                  this._baseParams.scene = exports.Scene.Robot;
                   return [4 /*yield*/, agentSetIdle(this._baseParams)];
                 case 1:
                   return [2 /*return*/, _a.sent()];
@@ -4859,6 +4867,8 @@
             return __generator(this, function (_a) {
               switch (_a.label) {
                 case 0:
+                  this.scene = exports.Scene.Manual;
+                  this._baseParams.scene = exports.Scene.Manual;
                   // 如果当前通话状态处于外呼开始,则不允许再次调用此方法并上报埋点
                   if (this._callStatus === exports.CallStatus.Started) {
                     return [2 /*return*/];
@@ -4997,10 +5007,6 @@
                 case 0:
                   _a.trys.push([0, 2,, 3]);
                   this.bye();
-                  // 如果人工外呼场景下,没有flowId则不调用并上报埋点
-                  if (!this._baseParams.ctiFlowId && this.scene === exports.Scene.Manual) {
-                    return [2 /*return*/];
-                  }
                   return [4 /*yield*/, this.turnHang()];
                 case 1:
                   res = _a.sent();
@@ -5027,7 +5033,7 @@
               switch (_a.label) {
                 case 0:
                   return [4 /*yield*/, manualHang(__assign(__assign({}, this._baseParams), {
-                    callId: this._callId
+                    call_id: this._callId
                   }))];
                 case 1:
                   res = _a.sent();

File diff suppressed because it is too large
+ 4 - 4
dist/hs-cti.es5.umd.prod.js


+ 29 - 19
dist/hs-cti.es6.esm.js

@@ -4,11 +4,11 @@
 - Version 1.0.9 
 - JS Standard es6
 - Author platformfe
-- Built on 2024/11/27 10:37:38
+- Built on 2024/11/28 16:42:50
 - GitHub 
-- Branch main
-- CommitID 987d86cd91cde7d1c235ad106d79fc92c305b8ff
-- CommitMessage fix: 修改socket地址
+- Branch dev_20241128
+- CommitID 19adbaf3eac6f9386a1ab1630ea855872d8554ca
+- CommitMessage fix: 完善代码
 */
 import { Web, UserAgent, UserAgentState, Registerer, RegistererState, Inviter, Invitation, Session, Messager, RequestPendingError, SessionState } from 'sip.js';
 import io from 'socket.io-client';
@@ -3514,15 +3514,17 @@ class HsCTI extends EventEmitter {
     const [lastStatus] = this._ctiStatusList.slice(-1);
     if (lastStatus !== CTIStatus.Initial) return;
     this.setAudioSrc(AudioName.ByeAudio, false);
-    switch (this.scene) {
-      case Scene.Robot:
-      case Scene.Monitor:
-        this.setAudioSrc(AudioName.RingAudio, true);
-        break;
-      case Scene.Manual:
-        this.setAudioSrc(AudioName.WaitAudio, true);
-        break;
-    }
+    this.setAudioSrc(AudioName.RingAudio, true);
+    this.setAudioSrc(AudioName.WaitAudio, true);
+    // switch (this.scene) {
+    //   case Scene.Robot:
+    //   case Scene.Monitor:
+    //     this.setAudioSrc(AudioName.RingAudio, true)
+    //     break
+    //   case Scene.Manual:
+    //     this.setAudioSrc(AudioName.WaitAudio, true)
+    //     break
+    // }
     this.getInitConfig();
   }
   getInitConfig() {
@@ -3760,7 +3762,7 @@ class HsCTI extends EventEmitter {
       },
       onInvite: invitation => {
         // this.scene = Scene.Robot
-        const callId = invitation.request.getHeader('P-LIBRA-CallId') || '';
+        const callId = invitation.request.getHeader('P-LIBRA-CallId') || invitation.request.getHeader('P-LIBRA-Callid') || '';
         console.log(callId, 2888888888);
         // const ctiFlowId =
         //   invitation.request.getHeader('P-LIBRA-CtiFlowId') || ''
@@ -3815,10 +3817,14 @@ class HsCTI extends EventEmitter {
                 this.stopAudio(AudioName.ByeAudio, false);
               }, 1000);
               this.stopLocalAudio();
-              this._callStatus = CallStatus.Stopped;
+              // this._baseParams.scene = Scene.Manual
               setBaseOption(BaseOption.TrackParams, {
                 call_id: ''
               });
+              if (this.scene == Scene.Manual) {
+                this.scene = Scene.Robot;
+                this._baseParams.scene = Scene.Robot;
+              }
               break;
           }
         });
@@ -4012,6 +4018,8 @@ class HsCTI extends EventEmitter {
   /** @public setIdle 服务端置闲,坐席状态变更 */
   setIdle() {
     return __awaiter(this, void 0, void 0, function* () {
+      this.scene = Scene.Robot;
+      this._baseParams.scene = Scene.Robot;
       return yield agentSetIdle(this._baseParams);
     });
   }
@@ -4023,6 +4031,8 @@ class HsCTI extends EventEmitter {
   }
   makeCall(params) {
     return __awaiter(this, void 0, void 0, function* () {
+      this.scene = Scene.Manual;
+      this._baseParams.scene = Scene.Manual;
       // 如果当前通话状态处于外呼开始,则不允许再次调用此方法并上报埋点
       if (this._callStatus === CallStatus.Started) {
         return;
@@ -4126,9 +4136,9 @@ class HsCTI extends EventEmitter {
       try {
         this.bye();
         // 如果人工外呼场景下,没有flowId则不调用并上报埋点
-        if (!this._baseParams.ctiFlowId && this.scene === Scene.Manual) {
-          return;
-        }
+        // if (!this._baseParams.ctiFlowId && this.scene === Scene.Manual) {
+        //   return
+        // }
         const res = yield this.turnHang();
         return Promise.resolve(res);
       } catch (error) {
@@ -4140,7 +4150,7 @@ class HsCTI extends EventEmitter {
   turnHang() {
     return __awaiter(this, void 0, void 0, function* () {
       const res = yield manualHang(Object.assign(Object.assign({}, this._baseParams), {
-        callId: this._callId
+        call_id: this._callId
       }));
       this._callId = '';
       return res;

File diff suppressed because it is too large
+ 4 - 4
dist/hs-cti.es6.esm.prod.js


+ 29 - 19
dist/hs-cti.es6.umd.js

@@ -4,11 +4,11 @@
 - Version 1.0.9 
 - JS Standard es6
 - Author platformfe
-- Built on 2024/11/27 10:37:38
+- Built on 2024/11/28 16:42:50
 - GitHub 
-- Branch main
-- CommitID 987d86cd91cde7d1c235ad106d79fc92c305b8ff
-- CommitMessage fix: 修改socket地址
+- Branch dev_20241128
+- CommitID 19adbaf3eac6f9386a1ab1630ea855872d8554ca
+- CommitMessage fix: 完善代码
 */
 (function (global, factory) {
     typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sip.js'), require('socket.io-client')) :
@@ -3517,15 +3517,17 @@
         const [lastStatus] = this._ctiStatusList.slice(-1);
         if (lastStatus !== exports.CTIStatus.Initial) return;
         this.setAudioSrc(AudioName.ByeAudio, false);
-        switch (this.scene) {
-          case exports.Scene.Robot:
-          case exports.Scene.Monitor:
-            this.setAudioSrc(AudioName.RingAudio, true);
-            break;
-          case exports.Scene.Manual:
-            this.setAudioSrc(AudioName.WaitAudio, true);
-            break;
-        }
+        this.setAudioSrc(AudioName.RingAudio, true);
+        this.setAudioSrc(AudioName.WaitAudio, true);
+        // switch (this.scene) {
+        //   case Scene.Robot:
+        //   case Scene.Monitor:
+        //     this.setAudioSrc(AudioName.RingAudio, true)
+        //     break
+        //   case Scene.Manual:
+        //     this.setAudioSrc(AudioName.WaitAudio, true)
+        //     break
+        // }
         this.getInitConfig();
       }
       getInitConfig() {
@@ -3763,7 +3765,7 @@
           },
           onInvite: invitation => {
             // this.scene = Scene.Robot
-            const callId = invitation.request.getHeader('P-LIBRA-CallId') || '';
+            const callId = invitation.request.getHeader('P-LIBRA-CallId') || invitation.request.getHeader('P-LIBRA-Callid') || '';
             console.log(callId, 2888888888);
             // const ctiFlowId =
             //   invitation.request.getHeader('P-LIBRA-CtiFlowId') || ''
@@ -3818,10 +3820,14 @@
                     this.stopAudio(AudioName.ByeAudio, false);
                   }, 1000);
                   this.stopLocalAudio();
-                  this._callStatus = exports.CallStatus.Stopped;
+                  // this._baseParams.scene = Scene.Manual
                   setBaseOption(BaseOption.TrackParams, {
                     call_id: ''
                   });
+                  if (this.scene == exports.Scene.Manual) {
+                    this.scene = exports.Scene.Robot;
+                    this._baseParams.scene = exports.Scene.Robot;
+                  }
                   break;
               }
             });
@@ -4015,6 +4021,8 @@
       /** @public setIdle 服务端置闲,坐席状态变更 */
       setIdle() {
         return __awaiter(this, void 0, void 0, function* () {
+          this.scene = exports.Scene.Robot;
+          this._baseParams.scene = exports.Scene.Robot;
           return yield agentSetIdle(this._baseParams);
         });
       }
@@ -4026,6 +4034,8 @@
       }
       makeCall(params) {
         return __awaiter(this, void 0, void 0, function* () {
+          this.scene = exports.Scene.Manual;
+          this._baseParams.scene = exports.Scene.Manual;
           // 如果当前通话状态处于外呼开始,则不允许再次调用此方法并上报埋点
           if (this._callStatus === exports.CallStatus.Started) {
             return;
@@ -4129,9 +4139,9 @@
           try {
             this.bye();
             // 如果人工外呼场景下,没有flowId则不调用并上报埋点
-            if (!this._baseParams.ctiFlowId && this.scene === exports.Scene.Manual) {
-              return;
-            }
+            // if (!this._baseParams.ctiFlowId && this.scene === Scene.Manual) {
+            //   return
+            // }
             const res = yield this.turnHang();
             return Promise.resolve(res);
           } catch (error) {
@@ -4143,7 +4153,7 @@
       turnHang() {
         return __awaiter(this, void 0, void 0, function* () {
           const res = yield manualHang(Object.assign(Object.assign({}, this._baseParams), {
-            callId: this._callId
+            call_id: this._callId
           }));
           this._callId = '';
           return res;

File diff suppressed because it is too large
+ 4 - 4
dist/hs-cti.es6.umd.prod.js


+ 1 - 1
src/api/hs-cti/ctiSdkModel.ts

@@ -53,7 +53,7 @@ export interface CTIManualCallOptions {
 export type ctiManualCallParams = CTIBaseOptions & CTIManualCallOptions
 
 export interface ctiManualHangParams extends CTIBaseOptions {
-  callId: string
+  call_id: string
 }
 
 export interface ctiListenParams extends CTIBaseOptions {

+ 20 - 10
src/hs-cti/HsCTI-trash.ts

@@ -246,15 +246,17 @@ export class SdCTI extends EventEmitter {
     const [lastStatus] = this._ctiStatusList.slice(-1)
     if (lastStatus !== CTIStatus.Initial) return
     this.setAudioSrc(AudioName.ByeAudio, false)
-    switch (this.scene) {
-      case Scene.Robot:
-      case Scene.Monitor:
-        this.setAudioSrc(AudioName.RingAudio, true)
-        break
-      case Scene.Manual:
-        // this.setAudioSrc(AudioName.WaitAudio, true)
-        break
-    }
+    this.setAudioSrc(AudioName.RingAudio, true)
+    this.setAudioSrc(AudioName.WaitAudio, true)
+    // switch (this.scene) {
+    //   case Scene.Robot:
+    //   case Scene.Monitor:
+    //     this.setAudioSrc(AudioName.RingAudio, true)
+    //     break
+    //   case Scene.Manual:
+    //     // this.setAudioSrc(AudioName.WaitAudio, true)
+    //     break
+    // }
     this.getInitConfig()
   }
 
@@ -914,6 +916,10 @@ export class SdCTI extends EventEmitter {
               }, 1000)
               self.stopLocalAudio()
               self._incomingSession = undefined
+              if (self.scene == Scene.Manual) {
+                self.scene = Scene.Robot
+                self._baseParams.scene = Scene.Robot
+              }
               break
             default:
               break
@@ -1222,6 +1228,8 @@ export class SdCTI extends EventEmitter {
   @checkCTIStatus(ExceptMessage.CustomNetworkErrorMsg)
   @handleApiRes()
   public async setIdle() {
+    this.scene = Scene.Robot
+    this._baseParams.scene = Scene.Robot
     return await agentSetIdle(this._baseParams)
   }
 
@@ -1239,6 +1247,8 @@ export class SdCTI extends EventEmitter {
   @checkCTIStatus(ExceptMessage.CommonNetworkErrorMsg)
   @handleApiRes()
   public async makeCall({ called, caller, ext }: CTIManualCallOptions) {
+    this.scene = Scene.Manual
+    this._baseParams.scene = Scene.Manual
     /** 主动外呼之前先获取 ctiFlowId,如果状态不正确直接 return */
     const flowIdRes = await this._getCtiFlowId()
     if (flowIdRes && flowIdRes.code !== 0) {
@@ -1351,7 +1361,7 @@ export class SdCTI extends EventEmitter {
   @checkCTIStatus(ExceptMessage.CommonNetworkErrorMsg)
   @handleApiRes()
   private async turnHang() {
-    return await manualHang({ ...this._baseParams, callId: this._callId })
+    return await manualHang({ ...this._baseParams, call_id: this._callId })
   }
   /** @public getAgentStatus 获取坐席状态 */
   @handleApiRes()

+ 28 - 15
src/hs-cti/HsCTI.ts

@@ -245,15 +245,17 @@ export class HsCTI extends EventEmitter {
     const [lastStatus] = this._ctiStatusList.slice(-1)
     if (lastStatus !== CTIStatus.Initial) return
     this.setAudioSrc(AudioName.ByeAudio, false)
-    switch (this.scene) {
-      case Scene.Robot:
-      case Scene.Monitor:
-        this.setAudioSrc(AudioName.RingAudio, true)
-        break
-      case Scene.Manual:
-        this.setAudioSrc(AudioName.WaitAudio, true)
-        break
-    }
+    this.setAudioSrc(AudioName.RingAudio, true)
+    this.setAudioSrc(AudioName.WaitAudio, true)
+    // switch (this.scene) {
+    //   case Scene.Robot:
+    //   case Scene.Monitor:
+    //     this.setAudioSrc(AudioName.RingAudio, true)
+    //     break
+    //   case Scene.Manual:
+    //     this.setAudioSrc(AudioName.WaitAudio, true)
+    //     break
+    // }
     this.getInitConfig()
   }
 
@@ -483,7 +485,10 @@ export class HsCTI extends EventEmitter {
       },
       onInvite: (invitation: Invitation) => {
         // this.scene = Scene.Robot
-        const callId = invitation.request.getHeader('P-LIBRA-CallId') || ''
+        const callId =
+          invitation.request.getHeader('P-LIBRA-CallId') ||
+          invitation.request.getHeader('P-LIBRA-Callid') ||
+          ''
         console.log(callId, 2888888888)
         // const ctiFlowId =
         //   invitation.request.getHeader('P-LIBRA-CtiFlowId') || ''
@@ -545,10 +550,14 @@ export class HsCTI extends EventEmitter {
                 this.stopAudio(AudioName.ByeAudio, false)
               }, 1000)
               this.stopLocalAudio()
-              this._callStatus = CallStatus.Stopped
+              // this._baseParams.scene = Scene.Manual
               setBaseOption(BaseOption.TrackParams, {
                 call_id: ''
               })
+              if (this.scene == Scene.Manual) {
+                this.scene = Scene.Robot
+                this._baseParams.scene = Scene.Robot
+              }
               break
             default:
               break
@@ -765,6 +774,8 @@ export class HsCTI extends EventEmitter {
   @checkCTIStatus('置闲')
   @handleApiRes()
   public async setIdle() {
+    this.scene = Scene.Robot
+    this._baseParams.scene = Scene.Robot
     return await agentSetIdle(this._baseParams)
   }
 
@@ -777,6 +788,8 @@ export class HsCTI extends EventEmitter {
 
   @checkCTIStatus('人工外呼')
   public async makeCall(params: CTIManualCallOptions) {
+    this.scene = Scene.Manual
+    this._baseParams.scene = Scene.Manual
     // 如果当前通话状态处于外呼开始,则不允许再次调用此方法并上报埋点
     if (this._callStatus === CallStatus.Started) {
       return
@@ -880,9 +893,9 @@ export class HsCTI extends EventEmitter {
     try {
       this.bye()
       // 如果人工外呼场景下,没有flowId则不调用并上报埋点
-      if (!this._baseParams.ctiFlowId && this.scene === Scene.Manual) {
-        return
-      }
+      // if (!this._baseParams.ctiFlowId && this.scene === Scene.Manual) {
+      //   return
+      // }
       const res = await this.turnHang()
       return Promise.resolve(res)
     } catch (error) {
@@ -893,7 +906,7 @@ export class HsCTI extends EventEmitter {
   /** @public turnHang 流转坐席状态-通话结束 */
   @handleApiRes()
   private async turnHang() {
-    const res = await manualHang({ ...this._baseParams, callId: this._callId })
+    const res = await manualHang({ ...this._baseParams, call_id: this._callId })
     this._callId = ''
     return res
   }

+ 5 - 2
src/sdk.html

@@ -37,7 +37,7 @@ const HS_CTI = getInstance({
     saas_id: 'mdj',
     // 目前每个业务线写死,用于后端鉴权,前端仅透传
     // 业务场景详见 Scene 枚举,
-    scene: Scene.Robot,
+    scene: Scene.Manual,
     // SDK 日志等级
     loggerLevel: LoggerLevels.debug,
     // 环境变量
@@ -77,7 +77,10 @@ window.addEventListener('load', ()=>{
   })
 
   buy_btn.addEventListener('click', () => {
-    HS_CTI.bye()
+    // HS_CTI.bye()
+    HS_CTI.serverBye().then((res) => {
+        console.log(res)
+      })
   })
   // HS_CTI.getAgentStatus().then((res) => {
   //     console.log(res)

Some files were not shown because too many files changed in this diff