From a5cba9ab040f6f97558046885dce3017f9bab7e9 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 11 八月 2026 14:12:29 +0800
Subject: [PATCH] 提交

---
 src/components/CallButton/index.vue |   46 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/src/components/CallButton/index.vue b/src/components/CallButton/index.vue
index d95fb2f..71f35a3 100644
--- a/src/components/CallButton/index.vue
+++ b/src/components/CallButton/index.vue
@@ -162,7 +162,10 @@
           // 澶勭悊鍚勭鐘舵��
           if (status.type === "registered") {
             this.handleRegistered();
-          } else if (status.type === "failed" || status.type === "disconnected") {
+          } else if (
+            status.type === "failed" ||
+            status.type === "disconnected"
+          ) {
             this.handleDisconnected();
           } else if (status.type === "connecting") {
             this.handleConnecting();
@@ -172,7 +175,8 @@
         // 鐩戝惉閫氳瘽鐘舵�佸彉鍖�
         sipService.onCallStatusChange = (status) => {
           this.callStatus = status.type;
-          this.isCalling = status.type === "calling" || status.type === "connected";
+          this.isCalling =
+            status.type === "calling" || status.type === "connected";
           this.updateLastActivityTime(); // 閫氳瘽鐘舵�佸彉鍖栨椂鏇存柊娲诲姩鏃堕棿
 
           this.$emit("call-status-change", status);
@@ -180,7 +184,6 @@
 
         // 璁剧疆瓒呮椂澶勭悊
         this.setupRegistrationTimeout();
-
       } catch (error) {
         console.error("SIP鏈嶅姟鍒濆鍖栧け璐�:", error);
         this.handleDisconnected();
@@ -272,7 +275,10 @@
       }
 
       this.reconnectCount++;
-      const delay = Math.min(this.reconnectDelay * Math.pow(1.5, this.reconnectCount - 1), 30000);
+      const delay = Math.min(
+        this.reconnectDelay * Math.pow(1.5, this.reconnectCount - 1),
+        30000
+      );
 
       console.log(`璁″垝鍦�${delay}ms鍚庨噸杩烇紝绗�${this.reconnectCount}娆″皾璇昤);
 
@@ -295,12 +301,11 @@
         this.cleanupSipConnection();
 
         // 绛夊緟涓�娈垫椂闂�
-        await new Promise(resolve => setTimeout(resolve, 1000));
+        await new Promise((resolve) => setTimeout(resolve, 1000));
 
         // 閲嶆柊鍒濆鍖�
         await this.CallgetList(); // 閲嶆柊鑾峰彇鍒嗘満鍙�
         this.initSipService();
-
       } catch (error) {
         console.error("閲嶈繛澶辫触:", error);
         this.isReconnecting = false;
@@ -338,7 +343,7 @@
 
     async startCall() {
       if (!this.phoneNumber) {
-        this.$message.error("璇疯緭鍏ョ數璇濆彿鐮�");
+        this.$message.warning("璇疯緭鍏ョ數璇濆彿鐮�");
         return;
       }
 
@@ -357,6 +362,15 @@
       } catch (error) {
         console.error("鍛煎彨澶辫触1:", error);
 
+        if (
+          error.message.includes("Canceled") ||
+          error.message.includes("鏈敞鍐�")
+        ) {
+          console.warn("鍛煎彨鍥犻〉闈㈢寮�鎴栨湭娉ㄥ唽鑰屽彇娑堬紝涓嶉噸璇�");
+          this.callStatus = "ended";
+          this.isCalling = false;
+          return;
+        }
         try {
           // 灏濊瘯鍔�0鍐嶆鍛煎彨
           const { canCall, reason } = sipService.canMakeCall();
@@ -371,7 +385,7 @@
         } catch (error) {
           this.callStatus = "ended";
           this.isCalling = false;
-          this.$message.error("鍛煎彨澶辫触锛岃妫�鏌ョ綉缁滄垨鍙风爜");
+          this.$message.warning("褰撳墠鍛煎彨鍗犵嚎涓紝璇风◢鍚庡啀鎷�");
         }
       }
     },
@@ -393,7 +407,17 @@
           orgName == "绗竴浜烘皯鍖婚櫌鍚村北闄㈠尯"
         ) {
           this.sipConfig.sipUri = `${this.randomNum}@192.169.129.198`;
+        } else if (
+          orgName == "鐪佺珛鍚屽痉缈犺嫅闄㈠尯" ||
+          orgName == "鐪佺珛鍚屽痉涔嬫睙闄㈠尯"||
+          orgName == "鐪佺珛鍚屽痉闂叉灄闄㈠尯"||
+          orgName == "鐪佺珛鍚屽痉澶╃洰灞辫矾闄㈠尯"||
+          orgName == "鐪佺珛鍚屽痉闈掑北婀栭櫌鍖�"
+        ) {
+          this.sipConfig.sipUri = `${this.randomNum}@220.88.10.62`;
         }
+        console.log(this.sipConfig.sipUri);
+
       } catch (error) {
         console.error("鑾峰彇鍒嗘満鍙峰け璐�:", error);
         throw error; // 鎶涘嚭閿欒浠ヤ究涓婂眰澶勭悊
@@ -451,7 +475,11 @@
     },
   },
   beforeUnmount() {
-    this.cleanupResources();
+    if (this.isCalling) {
+      this.endCall(); // 鍐呴儴璁剧疆浜� isManualEnd
+    }
+    // 鍏朵粬娓呯悊锛堝瀹氭椂鍣級...
+    this.cleanupResources(); // 浣嗘敞鎰忎笉瑕侀噸澶嶆竻鐞嗗畾鏃跺櫒锛屽彲浼樺寲鍒ゆ柇
   },
 };
 </script>

--
Gitblit v1.9.3