WXL (wul)
2 天以前 f08b755cd2db76f99b96355e8e1f60dda50fffdb
src/components/CallButton/index.vue
@@ -47,7 +47,7 @@
      sipStatus: "未连接",
      sipStatusClass: "status-disconnected",
      sipConfig: {
        wsUrl: "wss://192.168.100.6:7443",
        wsUrl: "wss://192.168.10.124:7443",
        sipUri: "",
        password: "Smartor@2023",
        displayName: "Web 小龙",
@@ -92,7 +92,10 @@
    sipService.onStatusChange = (status) => {
      this.sipStatus = status.text;
      this.sipStatusClass = `status-${status.type}`;
      // 注册成功
      if (status.type === "registered") {
        this.startCallsetState();
      }
      // 处理注册失败和断开连接情况
      if (status.type === "failed" || status.type === "disconnected") {
        this.overCallsetState(); // 释放分机号
@@ -127,7 +130,7 @@
        this.isCalling = true;
        console.log("开始呼叫:", sipService);
        await sipService.makeCall("0" + this.phoneNumber);
        await sipService.makeCall(this.phoneNumber);
      } catch (error) {
        let registrationTime = Date.now(); // 记录注销成功时间
        console.log(registrationTime, "呼叫失败时间");
@@ -159,11 +162,10 @@
        this.randomNum = res.data[0].tel;
        this.randomID = res.data[0].id;
        // 正确设置 sipUri
        this.sipConfig.sipUri = `${this.randomNum}@192.168.100.6`;
        this.startCallsetState();
        this.sipConfig.sipUri = `${this.randomNum}@192.168.10.124`;
      } catch (error) {
        console.error("获取分机号失败:", error);
        this.updateStatus("failed", "获取分机号失败");
        // this.updateStatus("failed", "获取分机号失败");
      }
    },
    async startCallsetState() {