From 071e3ed6253ce4d87f6c7a58d7cab02bb3916373 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 17 九月 2025 11:43:20 +0800
Subject: [PATCH] 电话更新

---
 src/components/CallButton/index.vue |   56 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/src/components/CallButton/index.vue b/src/components/CallButton/index.vue
index 0aa24ce..429a327 100644
--- a/src/components/CallButton/index.vue
+++ b/src/components/CallButton/index.vue
@@ -44,8 +44,8 @@
       sipStatus: "鏈繛鎺�",
       sipStatusClass: "status-disconnected",
       sipConfig: {
-        wsUrl: "wss://1192.170.66.107:7443",
-        sipUri: `${randomNum}` + "@1192.170.66.107",
+        wsUrl: "wss://192.168.100.6:7443",
+        sipUri: `${randomNum}` + "@192.168.100.6",
         password: "Smartor@2023",
         displayName: "Web 灏忛緳",
         // realm: "9.208.5.18:8090",
@@ -62,6 +62,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}`;
     },
@@ -70,13 +79,7 @@
     },
   },
   mounted() {
-    // 娴嬭瘯
-    const ws = new WebSocket("wss://9.208.5.18:7443");
-    ws.onopen = () => console.log("WebSocket 杩炴帴鎴愬姛");
-    ws.onerror = (e) => console.error("WebSocket 閿欒:", e);
-
-
-    // 鍒濆鍖朣IP杩炴帴
+    console.log('褰撳墠鍒嗘満鍙�',this.sipConfig);
 
     sipService.init(this.sipConfig);
     sipService.onStatusChange = (status) => {
@@ -101,15 +104,40 @@
       }
 
       try {
+        // 鍏堟鏌ユ槸鍚﹀彲浠ュ懠鍙�
+        const { canCall, reason } = sipService.canMakeCall();
+        if (!canCall) {
+          const { canCall, reason } = sipService.canMakeCall();
+          //this.$message.warning(reason);
+          //return;
+        }
         this.callStatus = "calling";
         this.isCalling = true;
+        console.log("寮�濮嬪懠鍙細", sipService);
 
-        await sipService.makeCall(this.phoneNumber);
+        await sipService.makeCall("0"+this.phoneNumber);
       } catch (error) {
-        console.error("鍛煎彨澶辫触:", error);
-        this.callStatus = "ended";
-        this.isCalling = false;
-        this.$message.error(`鍛煎彨澶辫触: ${error.message}`);
+        let registrationTime = Date.now(); // 璁板綍娉ㄩ攢鎴愬姛鏃堕棿
+        console.log(registrationTime, "鍛煎彨澶辫触鏃堕棿");
+        console.error("鍛煎彨澶辫触1:", error);
+        // this.callStatus = "ended";
+        // this.isCalling = false;
+        //this.$message.error(`鍛煎彨澶辫触: ${error.message}`);
+          try {
+          // 鍏堟鏌ユ槸鍚﹀彲浠ュ懠鍙�
+          const { canCall, reason } = sipService.canMakeCall();
+          if (!canCall) {
+            const { canCall, reason } = sipService.canMakeCall();
+          }
+          this.callStatus = "calling";
+          this.isCalling = true;
+          console.log("寮�濮嬪懠鍙細", sipService);
+
+          await sipService.makeCall("0"+this.phoneNumber);
+        } catch (error) {
+           this.callStatus = "ended";
+           this.isCalling = false;
+        }
       }
     },
 

--
Gitblit v1.9.3