| | |
| | | init(config) { |
| | | try { |
| | | this.updateStatus("connecting", "连接中..."); |
| | | console.log(config); |
| | | |
| | | this.ua = new JsSIP.UA({ |
| | | sockets: [new JsSIP.WebSocketInterface(config.wsUrl)], |
| | |
| | | sessionTimersExpires: 300, |
| | | extraHeaders: [ |
| | | "Min-SE: 120", |
| | | "Route: <sip:@192.168.100.6>", |
| | | "Route: <sip:@192.168.10.124>", |
| | | "Accept: application/sdp", |
| | | "Supported: replaces, timer", |
| | | "Allow: INVITE, ACK, BYE, CANCEL, OPTIONS", |
| | |
| | | }; |
| | | |
| | | this.currentSession = this.ua.call( |
| | | `sip:${targetNumber}@192.168.100.6`, |
| | | `sip:${targetNumber}@192.168.10.124`, |
| | | options |
| | | ); |
| | | // 在会话创建后修改 SDP |
| | |
| | | .call(pc, offerOptions) |
| | | .then((offer) => { |
| | | const modifiedSdp = offer.sdp |
| | | .replace(/c=IN IP4 192\.168\.100\.10/g, "c=IN IP4 192.168.100.6") |
| | | .replace(/c=IN IP4 192\.168\.100\.10/g, "c=IN IP4 192.168.10.124") |
| | | .replace(/m=audio \d+ RTP\/AVP.*/, "m=audio 7078 RTP/AVP 0 8"); |
| | | return new RTCSessionDescription({ |
| | | type: "offer", |