| | |
| | | import JsSIP from "jssip"; |
| | | import { Notification, MessageBox, Message, Loading } from "element-ui"; |
| | | // 医院机构与SIP服务器映射配置 |
| | | // 公司服务器192.168.100.6 |
| | | const HOSPITAL_CONFIG = { |
| | | 丽水市中医院: { |
| | | wsUrl: "wss://192.168.10.124:7443", |
| | |
| | | wsUrl: "wss://10.10.0.220:7443", |
| | | domain: "10.10.0.220", |
| | | }, |
| | | 杭州市第一人民医院湖滨院区: { |
| | | wsUrl: "wss://192.169.5.248:5060", |
| | | domain: "192.169.5.248", |
| | | 第一人民医院湖滨院区: { |
| | | wsUrl: "wss://192.169.129.198:7443", |
| | | domain: "192.169.129.198", |
| | | }, |
| | | 杭州市第一人民医院吴山院区: { |
| | | wsUrl: "wss://192.169.5.248:5060", |
| | | domain: "192.169.5.248", |
| | | 第一人民医院吴山院区: { |
| | | wsUrl: "wss://192.169.129.198:7443", |
| | | domain: "192.169.129.198", |
| | | }, |
| | | // 可以继续添加其他医院配置 |
| | | default: { |
| | |
| | | this.isRegistered = false; // 新增注册状态标志 |
| | | this.registrationTime = null; // 新增注册成功时间戳 |
| | | this.currentConfig = null; // 存储当前配置 |
| | | this.isManualEnd = false; |
| | | } |
| | | // 获取医院配置方法 |
| | | getHospitalConfig() { |
| | |
| | | makeCall(targetNumber) { |
| | | const { canCall, reason } = this.canMakeCall(); |
| | | if (!canCall) { |
| | | Message.error(reason); |
| | | Message.info(reason); |
| | | return Promise.reject(new Error(reason)); |
| | | } |
| | | return new Promise((resolve, reject) => { |
| | |
| | | eventHandlers: { |
| | | progress: () => this.updateCallStatus("calling", "呼叫中..."), |
| | | failed: (e) => { |
| | | if (this.isManualEnd) { |
| | | console.log("主动挂断,忽略失败事件"); |
| | | return; |
| | | } |
| | | this.handleCallFailure(e, reject); |
| | | }, |
| | | ended: () => this.updateCallStatus("ended", "通话结束"), |
| | |
| | | }); |
| | | } |
| | | |
| | | endCall() { |
| | | if (this.currentSession) { |
| | | this.currentSession.terminate(); |
| | | this.updateCallStatus("ended", "通话已结束"); |
| | | this.currentSession = null; |
| | | } |
| | | endCall() { |
| | | if (this.currentSession) { |
| | | this.isManualEnd = true; |
| | | this.currentSession.terminate(); |
| | | this.updateCallStatus('ended', '通话已结束'); |
| | | this.currentSession = null; |
| | | // 延迟重置标志,避免影响后续事件 |
| | | setTimeout(() => { this.isManualEnd = false; }, 100); |
| | | } |
| | | } |
| | | |
| | | updateStatus(type, text) { |
| | | console.log(`SIP状态更新: ${type} - ${text}`); |