From 22bd207587899810e9afb4c1a53f0d5dae1e2ece Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期五, 05 十二月 2025 16:28:42 +0800
Subject: [PATCH] 测试完成
---
src/utils/sipService.js | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/utils/sipService.js b/src/utils/sipService.js
index b6f0220..8f81f71 100644
--- a/src/utils/sipService.js
+++ b/src/utils/sipService.js
@@ -1,4 +1,5 @@
import JsSIP from "jssip";
+import { Notification, MessageBox, Message, Loading } from "element-ui";
class SipService {
constructor() {
@@ -30,10 +31,11 @@
this.ua.start();
// 浜嬩欢鐩戝惉
- // 浜嬩欢鐩戝惉
this.ua.on("registered", () => {
this.isRegistered = true;
this.registrationTime = Date.now(); // 璁板綍娉ㄥ唽鎴愬姛鏃堕棿
+ console.log(this.registrationTime, "娉ㄥ唽鏃堕棿");
+
this.updateStatus("registered", "宸叉敞鍐�");
});
@@ -44,6 +46,8 @@
this.ua.on("unregistered", () => {
this.isRegistered = false;
+ let registrationTime = Date.now(); // 璁板綍娉ㄩ攢鎴愬姛鏃堕棿
+ console.log(registrationTime, "娉ㄩ攢鏃堕棿");
this.updateStatus("disconnected", "宸叉敞閿�");
});
this.ua.on("disconnected", () =>
@@ -61,7 +65,7 @@
throw error;
}
}
-// 鏂板鏂规硶锛氭鏌ユ槸鍚﹀彲浠ュ懠鍙�
+ // 鏂板鏂规硶锛氭鏌ユ槸鍚﹀彲浠ュ懠鍙�
canMakeCall(minDelay = 2000) {
if (!this.isRegistered) {
return { canCall: false, reason: "SIP鏈敞鍐岋紝鏃犳硶鍛煎彨" };
@@ -74,7 +78,7 @@
const remaining = minDelay - timeSinceRegistration;
return {
canCall: false,
- reason: `娉ㄥ唽鎴愬姛锛岃绛夊緟 ${Math.ceil(remaining / 1000)} 绉掑悗鍐嶅懠鍙玚
+ reason: `娉ㄥ唽鎴愬姛锛岃祫婧愬姞杞戒腑璇风瓑寰� ${Math.ceil(remaining / 1000)} 绉掑悗鍐嶅懠鍙玚,
};
}
@@ -83,6 +87,7 @@
makeCall(targetNumber) {
const { canCall, reason } = this.canMakeCall();
if (!canCall) {
+ Message.error(reason);
return Promise.reject(new Error(reason));
}
return new Promise((resolve, reject) => {
@@ -118,7 +123,7 @@
};
this.currentSession = this.ua.call(
- `sip:${targetNumber}@192.169.129.198`,
+ `sip:${targetNumber}@192.168.10.124`,
options
);
@@ -199,7 +204,7 @@
errorMessage = "浼氳瘽鍙傛暟涓嶆弧瓒虫湇鍔″櫒瑕佹眰";
break;
default:
- errorMessage = `鍛煎彨澶辫触: ${e.cause || e.message}`;
+ errorMessage = `鍛煎彨澶辫触3: ${e.cause || e.message}`;
}
this.updateCallStatus("failed55", errorMessage);
--
Gitblit v1.9.3