WXL (wul)
7 天以前 d90b45d7e9e38e34c044b772006004f2a4cb8b8e
src/utils/sipService.js
@@ -11,7 +11,7 @@
    wsUrl: "wss://10.10.0.220:7443",
    domain: "10.10.0.220",
  },
   第一人民医院湖滨院区: {
  第一人民医院湖滨院区: {
    wsUrl: "wss://192.169.129.198:7443",
    domain: "192.169.129.198",
  },
@@ -35,6 +35,7 @@
    this.isRegistered = false; // 新增注册状态标志
    this.registrationTime = null; // 新增注册成功时间戳
    this.currentConfig = null; // 存储当前配置
    this.isManualEnd = false;
  }
  // 获取医院配置方法
  getHospitalConfig() {
@@ -136,7 +137,7 @@
  makeCall(targetNumber) {
    const { canCall, reason } = this.canMakeCall();
    if (!canCall) {
      Message.error(reason);
      Message.info(reason);
      return Promise.reject(new Error(reason));
    }
    return new Promise((resolve, reject) => {
@@ -162,6 +163,10 @@
          eventHandlers: {
            progress: () => this.updateCallStatus("calling", "呼叫中..."),
            failed: (e) => {
              if (this.isManualEnd) {
                console.log("主动挂断,忽略失败事件");
                return;
              }
              this.handleCallFailure(e, reject);
            },
            ended: () => this.updateCallStatus("ended", "通话结束"),
@@ -417,13 +422,16 @@
    });
  }
  endCall() {
    if (this.currentSession) {
      this.currentSession.terminate();
      this.updateCallStatus("ended", "通话已结束");
      this.currentSession = null;
    }
endCall() {
  if (this.currentSession) {
    this.isManualEnd = true;
    this.currentSession.terminate();
    this.updateCallStatus('ended', '通话已结束');
    this.currentSession = null;
    // 延迟重置标志,避免影响后续事件
    setTimeout(() => { this.isManualEnd = false; }, 100);
  }
}
  updateStatus(type, text) {
    console.log(`SIP状态更新: ${type} - ${text}`);