|
@@ -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;
|