WXL (wul)
7 天以前 aa17f161f4337a82bf9dc9b70dd40bd33d3c0fe4
src/components/CallButton/index.vue
@@ -44,9 +44,9 @@
      sipStatus: "未连接",
      sipStatusClass: "status-disconnected",
      sipConfig: {
        wsUrl: "wss://192.168.10.124:7443",
        sipUri: `${randomNum}` + "@192.168.10.124",
        password: "Smartor@2023",
        wsUrl: "wss://192.169.129.198:7443",
        sipUri: `${randomNum}` + "@192.169.129.198",
        password: "heskj@1234",
        displayName: "Web 小龙",
      },
    };
@@ -61,6 +61,15 @@
      };
      return statusMap[this.callStatus];
    },
    countdownText() {
      if (this.sipStatus !== "已注册") return "";
      const { canCall, reason } = sipService.canMakeCall();
      if (!canCall && reason.includes("等待")) {
        return reason;
      }
      return "";
    },
    callStatusClass() {
      return `status-${this.callStatus}`;
    },
@@ -69,7 +78,7 @@
    },
  },
  mounted() {
    console.log('当前分机号',this.sipConfig);
    console.log("当前分机号", this.sipConfig);
    sipService.init(this.sipConfig);
    sipService.onStatusChange = (status) => {
@@ -94,12 +103,21 @@
      }
      try {
        // 先检查是否可以呼叫
        const { canCall, reason } = sipService.canMakeCall();
        if (!canCall) {
          this.$message.warning(reason);
          return;
        }
        this.callStatus = "calling";
        this.isCalling = true;
        console.log("开始呼叫:", sipService);
        await sipService.makeCall(this.phoneNumber);
      } catch (error) {
        console.error("呼叫失败:", error);
        let registrationTime = Date.now(); // 记录注销成功时间
        console.log(registrationTime, "呼叫失败时间");
        console.error("呼叫失败1:", error);
        this.callStatus = "ended";
        this.isCalling = false;
        this.$message.error(`呼叫失败: ${error.message}`);