module-develop-kit 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs-virtual-dir/index2.js +5 -3
- package/dist/commonjs-virtual-dir/index3.js +3 -5
- package/dist/commonjs-virtual-dir/index4.js +2 -2
- package/dist/commonjs-virtual-dir/index5.js +2 -2
- package/dist/main.d.ts +10 -0
- package/dist/src/outside-call/CallManagement.js +113 -99
- package/dist/src/outside-call/utils.js +22 -25
- package/dist/src/shield/crypto/sm4.js +1 -1
- package/dist/vendor/jsbn/index.js +1 -1
- package/dist/vendor/sdp-transform/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as o } from "../vendor/sdp-transform/lib/index.js";
|
|
3
|
+
var t = o();
|
|
4
|
+
const a = /* @__PURE__ */ r(t);
|
|
3
5
|
export {
|
|
4
|
-
|
|
6
|
+
a as default
|
|
5
7
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var t = o();
|
|
4
|
-
const a = /* @__PURE__ */ r(t);
|
|
1
|
+
import { __require as r } from "../vendor/gm-crypt/index.js";
|
|
2
|
+
var p = r();
|
|
5
3
|
export {
|
|
6
|
-
|
|
4
|
+
p as g
|
|
7
5
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -181,8 +181,18 @@ export declare interface ICallConfig extends SipAccount {
|
|
|
181
181
|
credential: string;
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
|
+
/**
|
|
185
|
+
* ice 传输策略
|
|
186
|
+
*/
|
|
187
|
+
iceTransportPolicy?: string;
|
|
188
|
+
/**
|
|
189
|
+
* ice 候选收集最大时长
|
|
190
|
+
* @default 2000
|
|
191
|
+
*/
|
|
192
|
+
iceCandidateTimeout?: number;
|
|
184
193
|
/**
|
|
185
194
|
* 是否开发环境
|
|
195
|
+
* @deprecated 该属性已废弃,所有情况都会传递 iceConfig
|
|
186
196
|
*/
|
|
187
197
|
isDev?: boolean;
|
|
188
198
|
/**
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { J as
|
|
2
|
-
import { C as
|
|
3
|
-
import { ECallStatus as
|
|
4
|
-
import { CallLogger as
|
|
5
|
-
import { EventBus as
|
|
6
|
-
class
|
|
1
|
+
import { J as C } from "../../commonjs-virtual-dir/JsSIP.js";
|
|
2
|
+
import { C as h } from "../../commonjs-virtual-dir/Constants.js";
|
|
3
|
+
import { ECallStatus as a, EMIT_EVENT_NAME as y } from "./constants.js";
|
|
4
|
+
import { CallLogger as e, getIceServersByCallConfig as m, formatSdp as T } from "./utils.js";
|
|
5
|
+
import { EventBus as I } from "../utils/eventBus.js";
|
|
6
|
+
class $ {
|
|
7
7
|
ua = null;
|
|
8
8
|
session = null;
|
|
9
9
|
eventBus;
|
|
10
|
-
callStatus =
|
|
10
|
+
callStatus = a.INITIAL;
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
12
12
|
stopPlayTipAudio = () => {
|
|
13
13
|
};
|
|
14
14
|
// 有可能会出现 音频还未加载成功,但是会话已经结束的情况
|
|
15
15
|
isStop = !1;
|
|
16
16
|
constructor(o, t) {
|
|
17
|
-
this.eventBus = new
|
|
17
|
+
this.eventBus = new I(), this.playTipAudio(t.tipAudioUrl), this.initUa(o, t);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* 监听状态更新
|
|
21
21
|
* @param callback
|
|
22
22
|
*/
|
|
23
23
|
onStatusUpdate(o) {
|
|
24
|
-
this.eventBus.$on(
|
|
24
|
+
this.eventBus.$on(y.UPDATE_STATUS, o, !0);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* 更新状态,触发状态更新
|
|
@@ -29,8 +29,8 @@ class g {
|
|
|
29
29
|
* @param cause
|
|
30
30
|
* @param statusCode
|
|
31
31
|
*/
|
|
32
|
-
updateStatus(o, t,
|
|
33
|
-
this.callStatus = o, this.eventBus.$emit(
|
|
32
|
+
updateStatus(o, t, s) {
|
|
33
|
+
this.callStatus = o, this.eventBus.$emit(y.UPDATE_STATUS, o, t, s);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* 初始化sip和websocket的链接
|
|
@@ -40,30 +40,30 @@ class g {
|
|
|
40
40
|
*/
|
|
41
41
|
initUa(o, t) {
|
|
42
42
|
try {
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
this.ua = new
|
|
46
|
-
sockets: [
|
|
43
|
+
e.log("wssUrl", t.wssUrl), e.log("当前作席", t.extension);
|
|
44
|
+
const s = new C.WebSocketInterface(t.wssUrl);
|
|
45
|
+
this.ua = new C.UA({
|
|
46
|
+
sockets: [s],
|
|
47
47
|
uri: `sip:${t.extension}@${t.sipIp}`,
|
|
48
48
|
password: t.password,
|
|
49
49
|
realm: t.realm || t.sipIp,
|
|
50
50
|
register_expires: 300,
|
|
51
51
|
session_timers_expires: 120,
|
|
52
52
|
pcConfig: {
|
|
53
|
-
iceServers:
|
|
53
|
+
iceServers: m(t)
|
|
54
54
|
},
|
|
55
55
|
extra_headers: [`X-Call-ID: ${t.callId}`]
|
|
56
56
|
}), this.ua.on("registered", () => {
|
|
57
|
-
|
|
57
|
+
e.log("SIP 注册成功"), this.initSession(o, t);
|
|
58
58
|
}), this.ua.on("connected", () => {
|
|
59
|
-
|
|
59
|
+
e.log("WebSocket已连接");
|
|
60
60
|
}), this.ua.on("disconnected", () => {
|
|
61
|
-
|
|
62
|
-
}), this.ua.on("registrationFailed", (
|
|
63
|
-
this.updateStatus(
|
|
64
|
-
}), this.ua.start(), this.updateStatus(
|
|
65
|
-
} catch (
|
|
66
|
-
|
|
61
|
+
e.warn("WebSocket已断开"), a.PENDING === this.callStatus && this.updateStatus(a.RECONNECT, h.causes.CONNECTION_ERROR);
|
|
62
|
+
}), this.ua.on("registrationFailed", (n) => {
|
|
63
|
+
this.updateStatus(a.FAILED, n.cause, n.response.status_code), e.error(`SIP 注册失败 cause: ${n?.cause} status_code: ${n?.response?.status_code}`), this.stop();
|
|
64
|
+
}), this.ua.start(), this.updateStatus(a.PENDING);
|
|
65
|
+
} catch (s) {
|
|
66
|
+
e.error("SIP 初始化失败", s?.message), this.stop(), this.updateStatus(a.FAILED, h.causes.SIP_FAILURE_CODE);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -71,27 +71,27 @@ class g {
|
|
|
71
71
|
*/
|
|
72
72
|
optimizationCall() {
|
|
73
73
|
const o = Date.now();
|
|
74
|
-
|
|
75
|
-
const t = 80 * 1e3 + o,
|
|
74
|
+
e.log("开始接听倒计时:", o);
|
|
75
|
+
const t = 80 * 1e3 + o, s = () => {
|
|
76
76
|
requestAnimationFrame(() => {
|
|
77
|
-
|
|
77
|
+
a.PENDING === this.callStatus && (Date.now() > t ? (e.error("接听超时", Date.now()), this.updateStatus(a.FAILED, h.causes.NO_ANSWER), this.stop()) : s());
|
|
78
78
|
});
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
s();
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* 音频检测,存在有早期媒体但是并无声音的情况,所以增加音频分析检测;
|
|
84
84
|
*/
|
|
85
85
|
audioCheck(o) {
|
|
86
86
|
try {
|
|
87
|
-
const t = new (Reflect.get(window, "AudioContext") || Reflect.get(window, "webkitAudioContext"))(),
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
87
|
+
const t = new (Reflect.get(window, "AudioContext") || Reflect.get(window, "webkitAudioContext"))(), s = t.createAnalyser(), n = t.createMediaStreamSource(o.streams[0]);
|
|
88
|
+
n.connect(s), s.fftSize = 256;
|
|
89
|
+
const d = s.frequencyBinCount, u = new Uint8Array(d), l = () => {
|
|
90
|
+
s.getByteTimeDomainData(u), u.some((f) => Math.abs(f - 128) > 2) && (e.log("【音频分析】检测到有效声音"), n.disconnect(), this.stopPlayTipAudio()), requestAnimationFrame(l);
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
l();
|
|
93
93
|
} catch (t) {
|
|
94
|
-
|
|
94
|
+
e.error("音频分析模块初始化失败", t?.message);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
@@ -101,64 +101,77 @@ class g {
|
|
|
101
101
|
* @private
|
|
102
102
|
*/
|
|
103
103
|
getSessionEventHandlers(o, t) {
|
|
104
|
-
let
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
let s = !1;
|
|
105
|
+
const n = o.call.split("").slice(-4).join("");
|
|
106
|
+
e.log("开始呼叫(尾号):", `sip:${n}@${t.sipIp}`);
|
|
107
|
+
const d = t.iceTransportPolicy === "relay";
|
|
108
|
+
let u = null;
|
|
109
|
+
const l = () => {
|
|
110
|
+
u && clearTimeout(u), u = null;
|
|
111
|
+
}, { iceCandidateTimeout: p = 2e3 } = t;
|
|
112
|
+
return {
|
|
113
|
+
sdp: (i) => {
|
|
114
|
+
i.sdp = T(i.sdp);
|
|
109
115
|
},
|
|
110
116
|
connecting: () => {
|
|
111
|
-
|
|
117
|
+
a.PENDING !== this.callStatus && this.updateStatus(a.PENDING), e.log("正在连接...");
|
|
112
118
|
},
|
|
113
|
-
progress: (
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
-
|
|
119
|
+
progress: (i) => {
|
|
120
|
+
if (e.log("呼叫进行中..."), this.optimizationCall(), i.response) {
|
|
121
|
+
const r = i.response.status_code, c = i.response.body;
|
|
122
|
+
r === 183 && c ? (e.log("收到 183 (带SDP),确认有早期媒体,停止本地提示音。"), this.stopPlayTipAudio()) : (r === 180 || r === 183 && !c) && e.log(`收到 ${r} (无SDP),继续播放本地提示音。`);
|
|
117
123
|
}
|
|
118
124
|
},
|
|
119
|
-
ended: (
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
this.updateStatus(
|
|
125
|
+
ended: (i) => {
|
|
126
|
+
if (a.FAILED !== this.callStatus) {
|
|
127
|
+
const r = s ? i?.cause : h.causes.REJECTED;
|
|
128
|
+
this.updateStatus(a.ENDED, r), e.log("通话已结束 cause: ", r);
|
|
123
129
|
}
|
|
124
130
|
this.stop();
|
|
125
131
|
},
|
|
126
|
-
failed: (
|
|
127
|
-
const { cause:
|
|
132
|
+
failed: (i) => {
|
|
133
|
+
const { cause: r, message: c = {} } = i, S = r === "Canceled";
|
|
128
134
|
this.updateStatus(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
),
|
|
133
|
-
`通话已取消 cause: ${
|
|
134
|
-
) :
|
|
135
|
-
`通话失败 cause: ${
|
|
135
|
+
S ? a.CANCELLED : a.FAILED,
|
|
136
|
+
r,
|
|
137
|
+
c?.status_code
|
|
138
|
+
), S ? e.warn(
|
|
139
|
+
`通话已取消 cause: ${r} status_code: ${c?.status_code || ""}`
|
|
140
|
+
) : e.error(
|
|
141
|
+
`通话失败 cause: ${r} status_code: ${c?.status_code || ""}`
|
|
136
142
|
), this.stop();
|
|
137
143
|
},
|
|
138
144
|
accepted: () => {
|
|
139
|
-
this.stopPlayTipAudio(),
|
|
145
|
+
this.stopPlayTipAudio(), e.log("通话已接听");
|
|
140
146
|
},
|
|
141
147
|
confirmed: () => {
|
|
142
|
-
this.updateStatus(
|
|
143
|
-
const
|
|
144
|
-
|
|
148
|
+
this.updateStatus(a.ANSWERED), e.log("通话已确认");
|
|
149
|
+
const i = setTimeout(() => {
|
|
150
|
+
s = !0, clearTimeout(i);
|
|
145
151
|
}, 1500);
|
|
146
152
|
},
|
|
147
|
-
peerconnection: (
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
+
peerconnection: (i) => {
|
|
154
|
+
const r = i.peerconnection;
|
|
155
|
+
e.log("RTCPeerConnection 已创建或更新,正在设置 ontrack 监听器"), r.ontrack = (c) => {
|
|
156
|
+
if (c.track.kind === "audio" && c.streams[0]) {
|
|
157
|
+
e.log(c.track, "track"), e.log(`接收到远程媒体轨道 (track): ${c.track.kind}`);
|
|
158
|
+
const S = c.streams[0];
|
|
153
159
|
this.stopPlayTipAudio();
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
})) :
|
|
160
|
+
const E = document.getElementById(t.playAudioId);
|
|
161
|
+
E ? (E.srcObject = S, E.play().catch((A) => {
|
|
162
|
+
e.error("播放远程音频失败 (来自 ontrack)", A);
|
|
163
|
+
})) : e.error("无法播放远程音频,播放元素不存在", `${t.playAudioId}`), this.audioCheck(c);
|
|
158
164
|
}
|
|
159
|
-
},
|
|
160
|
-
|
|
165
|
+
}, r.addEventListener("iceconnectionstatechange", () => {
|
|
166
|
+
e.log(`ICE状态: ${r.iceConnectionState}`), r.iceConnectionState === "disconnected" && (e.error("ICE连接断开"), this.updateStatus(a.FAILED, h.causes.CONNECTION_ERROR), this.stop());
|
|
161
167
|
});
|
|
168
|
+
},
|
|
169
|
+
icecandidate: d ? (i) => {
|
|
170
|
+
e.log("relay 模式 ice 候选:", i.candidate), i.ready();
|
|
171
|
+
} : (i) => {
|
|
172
|
+
l(), u = setTimeout(() => {
|
|
173
|
+
i.ready(), l(), e.log(`ice 候选候选${p}ms 后获取结束`);
|
|
174
|
+
}, p), i.candidate ? e.log("ice 候选:", i.candidate) : (l(), e.log("ice 候选结束"), i.ready());
|
|
162
175
|
}
|
|
163
176
|
};
|
|
164
177
|
}
|
|
@@ -168,11 +181,11 @@ class g {
|
|
|
168
181
|
*/
|
|
169
182
|
initSession(o, t) {
|
|
170
183
|
if (!this.ua) {
|
|
171
|
-
this.updateStatus(
|
|
184
|
+
this.updateStatus(a.FAILED, h.causes.SIP_FAILURE_CODE), e.error("SIP 未初始化");
|
|
172
185
|
return;
|
|
173
186
|
}
|
|
174
187
|
try {
|
|
175
|
-
const
|
|
188
|
+
const n = {
|
|
176
189
|
eventHandlers: this.getSessionEventHandlers(o, t),
|
|
177
190
|
mediaConstraints: { audio: !0, video: !1 },
|
|
178
191
|
rtcOfferConstraints: {
|
|
@@ -180,15 +193,16 @@ class g {
|
|
|
180
193
|
offerToReceiveVideo: !1
|
|
181
194
|
},
|
|
182
195
|
rtcConfiguration: {
|
|
183
|
-
iceServers:
|
|
196
|
+
iceServers: m(t)
|
|
184
197
|
},
|
|
185
|
-
sessionTimersExpires: 180
|
|
198
|
+
sessionTimersExpires: 180,
|
|
199
|
+
pcConfig: {
|
|
200
|
+
iceServers: m(t)
|
|
201
|
+
}
|
|
186
202
|
};
|
|
187
|
-
t.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
} catch (e) {
|
|
191
|
-
s.error("SIP 会话创建失败", e?.message), this.stop();
|
|
203
|
+
t.iceTransportPolicy && n.pcConfig && (e.log("iceTransportPolicy", t.iceTransportPolicy), n.pcConfig.iceTransportPolicy = t.iceTransportPolicy), this.session = this.ua.call(`sip:${o.call}@${t.sipIp}`, n);
|
|
204
|
+
} catch (s) {
|
|
205
|
+
e.error("SIP 会话创建失败", s?.message), this.stop();
|
|
192
206
|
}
|
|
193
207
|
}
|
|
194
208
|
/**
|
|
@@ -196,26 +210,26 @@ class g {
|
|
|
196
210
|
* @private
|
|
197
211
|
*/
|
|
198
212
|
async playTipAudio(o) {
|
|
199
|
-
let t,
|
|
213
|
+
let t, s;
|
|
200
214
|
try {
|
|
201
|
-
|
|
202
|
-
const
|
|
215
|
+
e.log("开始播放提示音");
|
|
216
|
+
const u = await (await fetch(o || `https://store.zxfqf.com/file/uMgvB0wt9f.mp3?t=${Date.now()}`)).arrayBuffer();
|
|
203
217
|
t = new (window.AudioContext || Reflect.get(window, "webkitAudioContext"))(), await t.suspend();
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
} catch (
|
|
209
|
-
|
|
218
|
+
const l = await t.decodeAudioData(u);
|
|
219
|
+
s = t.createBufferSource(), s.buffer = l, s.connect(t.destination), s.loop = !0, s.loopStart = 0, s.loopEnd = l.duration;
|
|
220
|
+
const p = t.currentTime;
|
|
221
|
+
e.log("音频播放开始时间:", p), await t.resume(), s.start(p);
|
|
222
|
+
} catch (d) {
|
|
223
|
+
e.error("播放音频失败", d?.message);
|
|
210
224
|
}
|
|
211
|
-
let
|
|
225
|
+
let n = !1;
|
|
212
226
|
this.stopPlayTipAudio = () => {
|
|
213
|
-
|
|
214
|
-
|
|
227
|
+
n || (e.log("停止播放提示音"), n = !0, s.stop(), s.disconnect(), t.close().finally(() => {
|
|
228
|
+
s = null, t = null, this.stopPlayTipAudio = () => {
|
|
215
229
|
};
|
|
216
230
|
}));
|
|
217
|
-
}, this.onStatusUpdate((
|
|
218
|
-
|
|
231
|
+
}, this.onStatusUpdate((d) => {
|
|
232
|
+
a.ANSWERED === d && this.stopPlayTipAudio();
|
|
219
233
|
}), this.isStop && this.stopPlayTipAudio();
|
|
220
234
|
}
|
|
221
235
|
/**
|
|
@@ -226,7 +240,7 @@ class g {
|
|
|
226
240
|
try {
|
|
227
241
|
this.ua?.stop?.(), !this.session?.isEnded?.() && this.session?.terminate();
|
|
228
242
|
} catch (o) {
|
|
229
|
-
|
|
243
|
+
e.error("挂断失败", o?.message);
|
|
230
244
|
} finally {
|
|
231
245
|
this.isStop = !0, this.stopPlayTipAudio();
|
|
232
246
|
}
|
|
@@ -241,9 +255,9 @@ class g {
|
|
|
241
255
|
* 挂断电话
|
|
242
256
|
*/
|
|
243
257
|
hangUp() {
|
|
244
|
-
|
|
258
|
+
a.ANSWERED === this.callStatus ? (this.updateStatus(a.ENDED), e.warn("客服正常挂断结束通话")) : (this.updateStatus(a.CANCELLED), e.warn("客服取消通话")), this.stop(), this.destroy();
|
|
245
259
|
}
|
|
246
260
|
}
|
|
247
261
|
export {
|
|
248
|
-
|
|
262
|
+
$ as CallManagement
|
|
249
263
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import c from "../../commonjs-virtual-dir/index2.js";
|
|
2
|
+
const g = {
|
|
3
3
|
log(e, ...r) {
|
|
4
4
|
console.log(`%c【${(/* @__PURE__ */ new Date()).toLocaleString()}】`, "color: green; font-weight: bold;", e, ...r);
|
|
5
5
|
},
|
|
@@ -9,42 +9,39 @@ const u = {
|
|
|
9
9
|
error(e, ...r) {
|
|
10
10
|
console.log(`%c【${(/* @__PURE__ */ new Date()).toLocaleString()}】`, "color: red; font-weight: bold;", e, ...r);
|
|
11
11
|
}
|
|
12
|
+
}, a = /* @__PURE__ */ new Map([
|
|
13
|
+
["PCMA", 1],
|
|
14
|
+
["G729", 2],
|
|
15
|
+
["G722", 3],
|
|
16
|
+
["PCMU", 4]
|
|
17
|
+
]), s = (e) => (e.type === "audio" && (e.rtp.sort((r, o) => {
|
|
18
|
+
const t = a.get(r.codec) || 1 / 0, n = a.get(o.codec) || 1 / 0;
|
|
19
|
+
return t - n;
|
|
20
|
+
}), e.payloads = e.rtp.map((r) => r.payload).join(" ")), e), p = (e) => {
|
|
21
|
+
const r = c.parse(e);
|
|
22
|
+
return r.media = r.media.map(s), c.write(r);
|
|
12
23
|
}, S = (e) => {
|
|
13
|
-
const r = a.parse(e);
|
|
14
|
-
return r.media = r.media.map((t) => {
|
|
15
|
-
if (t.type === "audio") {
|
|
16
|
-
const n = t.payloads;
|
|
17
|
-
if (n?.includes("8")) {
|
|
18
|
-
const o = n.split(" "), s = o.findIndex((c) => c === "8");
|
|
19
|
-
o.splice(s, 1), o.unshift("8"), t.payloads = o.join(" ");
|
|
20
|
-
const i = t.rtp, l = i.find((c) => c.codec === "PCMA"), d = i.findIndex((c) => c.codec === "PCMA");
|
|
21
|
-
i.splice(d, 1), l && i.unshift(l);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
}), a.write(r);
|
|
26
|
-
}, f = (e) => {
|
|
27
24
|
if (typeof e != "number" || Number.isNaN(e))
|
|
28
25
|
throw new TypeError("输入必须是数字类型");
|
|
29
26
|
if (e < 0 || !Number.isInteger(e))
|
|
30
27
|
throw new RangeError("请输入非负整数");
|
|
31
|
-
const r = e / 1e3,
|
|
32
|
-
return `${
|
|
33
|
-
},
|
|
28
|
+
const r = e / 1e3, o = Math.floor(r / 60), t = Math.floor(r % 60), n = String(o).padStart(2, "0"), i = String(t).padStart(2, "0");
|
|
29
|
+
return `${n}:${i}`;
|
|
30
|
+
}, d = (e) => {
|
|
34
31
|
const r = [
|
|
35
32
|
{
|
|
36
33
|
urls: [e.iceService.stunServerUrl]
|
|
37
34
|
}
|
|
38
35
|
];
|
|
39
36
|
if (e.iceService.turnServer) {
|
|
40
|
-
const { urls:
|
|
41
|
-
|
|
37
|
+
const { urls: o, username: t, credential: n } = e.iceService.turnServer;
|
|
38
|
+
o && t && n && r.push(e.iceService.turnServer);
|
|
42
39
|
}
|
|
43
40
|
return r;
|
|
44
41
|
};
|
|
45
42
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
g as CallLogger,
|
|
44
|
+
p as formatSdp,
|
|
45
|
+
S as formatSeconds,
|
|
46
|
+
d as getIceServersByCallConfig
|
|
50
47
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as r } from "../../../commonjs-virtual-dir/
|
|
1
|
+
import { __exports as r } from "../../../commonjs-virtual-dir/index4.js";
|
|
2
2
|
import { __require as t } from "./parser.js";
|
|
3
3
|
import { __require as m } from "./writer.js";
|
|
4
4
|
import { __require as p } from "./grammar.js";
|