sip-connector 9.1.0 → 9.2.1
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/{SipConnector-Eb3K8Ixo.js → SipConnector-7Qar6pDS.js} +283 -276
- package/dist/SipConnector-BhCqlPz2.cjs +1 -0
- package/dist/SipConnector.d.ts +8 -2
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +2 -1
- package/dist/__fixtures__/RTCRtpSenderMock.d.ts +4 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +87 -51
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +13 -13
- package/dist/SipConnector-Qzp-_Vxz.cjs +0 -1
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
import { CancelableRequest as N, isCanceledError as
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var Rt = (r, e, t) => e in r ? At(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => Rt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CancelableRequest as N, isCanceledError as It } from "@krivega/cancelable-promise";
|
|
5
5
|
import Oe from "events-constructor";
|
|
6
6
|
import { repeatedCallsAsync as De } from "repeated-calls";
|
|
7
|
-
import
|
|
8
|
-
const
|
|
7
|
+
import V from "debug";
|
|
8
|
+
const mt = "Connection Error", Le = "Request Timeout", pt = "SIP Failure Code", ft = "Internal Error", Pt = "Busy", He = "Rejected", Ot = "Redirected", Dt = "Unavailable", Mt = "Not Found", vt = "Address Incomplete", yt = "Incompatible SDP", bt = "Missing SDP", wt = "Authentication Error", We = "Terminated", Ut = "WebRTC Error", ke = "Canceled", Lt = "No Answer", Ht = "Expires", Wt = "No ACK", kt = "Dialog Error", qt = "User Denied Media Access", Bt = "Bad Media Description", Ft = "RTP Timeout", ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
9
|
__proto__: null,
|
|
10
|
-
ADDRESS_INCOMPLETE:
|
|
11
|
-
AUTHENTICATION_ERROR:
|
|
12
|
-
BAD_MEDIA_DESCRIPTION:
|
|
13
|
-
BUSY:
|
|
10
|
+
ADDRESS_INCOMPLETE: vt,
|
|
11
|
+
AUTHENTICATION_ERROR: wt,
|
|
12
|
+
BAD_MEDIA_DESCRIPTION: Bt,
|
|
13
|
+
BUSY: Pt,
|
|
14
14
|
BYE: We,
|
|
15
15
|
CANCELED: ke,
|
|
16
|
-
CONNECTION_ERROR:
|
|
17
|
-
DIALOG_ERROR:
|
|
18
|
-
EXPIRES:
|
|
19
|
-
INCOMPATIBLE_SDP:
|
|
20
|
-
INTERNAL_ERROR:
|
|
21
|
-
MISSING_SDP:
|
|
22
|
-
NOT_FOUND:
|
|
23
|
-
NO_ACK:
|
|
24
|
-
NO_ANSWER:
|
|
25
|
-
REDIRECTED:
|
|
16
|
+
CONNECTION_ERROR: mt,
|
|
17
|
+
DIALOG_ERROR: kt,
|
|
18
|
+
EXPIRES: Ht,
|
|
19
|
+
INCOMPATIBLE_SDP: yt,
|
|
20
|
+
INTERNAL_ERROR: ft,
|
|
21
|
+
MISSING_SDP: bt,
|
|
22
|
+
NOT_FOUND: Mt,
|
|
23
|
+
NO_ACK: Wt,
|
|
24
|
+
NO_ANSWER: Lt,
|
|
25
|
+
REDIRECTED: Ot,
|
|
26
26
|
REJECTED: He,
|
|
27
27
|
REQUEST_TIMEOUT: Le,
|
|
28
|
-
RTP_TIMEOUT:
|
|
29
|
-
SIP_FAILURE_CODE:
|
|
30
|
-
UNAVAILABLE:
|
|
31
|
-
USER_DENIED_MEDIA_ACCESS:
|
|
32
|
-
WEBRTC_ERROR:
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
28
|
+
RTP_TIMEOUT: Ft,
|
|
29
|
+
SIP_FAILURE_CODE: pt,
|
|
30
|
+
UNAVAILABLE: Dt,
|
|
31
|
+
USER_DENIED_MEDIA_ACCESS: qt,
|
|
32
|
+
WEBRTC_ERROR: Ut
|
|
33
|
+
}, Symbol.toStringTag, { value: "Module" })), Y = "incomingCall", x = "declinedIncomingCall", G = "failedIncomingCall", $ = "terminatedIncomingCall", H = "connecting", m = "connected", u = "disconnected", M = "newRTCSession", p = "registered", X = "unregistered", f = "registrationFailed", qe = "newMessage", J = "sipEvent", z = "availableSecondRemoteStream", Q = "notAvailableSecondRemoteStream", j = "mustStopPresentation", v = "shareState", K = "enterRoom", Z = "useLicense", ee = "peerconnection:confirmed", te = "peerconnection:ontrack", y = "channels", ne = "channels:notify", se = "ended:fromserver", ie = "main-cam-control", re = "admin-stop-main-cam", oe = "admin-start-main-cam", ae = "admin-stop-mic", ce = "admin-start-mic", b = "admin-force-sync-media-state", _e = "participant:added-to-list-moderators", Ee = "participant:removed-from-list-moderators", he = "participant:move-request-to-stream", le = "participant:move-request-to-spectators", de = "participation:accepting-word-request", Te = "participation:cancelling-word-request", Se = "webcast:started", ue = "webcast:stopped", Ce = "account:changed", Ne = "account:deleted", ge = "conference:participant-token-issued", P = "ended", Be = "sending", Fe = "reinvite", Ve = "replaces", Ye = "refer", xe = "progress", Ge = "accepted", w = "confirmed", U = "peerconnection", A = "failed", $e = "muted", Xe = "unmuted", Ae = "newDTMF", Re = "newInfo", Je = "hold", ze = "unhold", Qe = "update", je = "sdp", Ke = "icecandidate", Ze = "getusermediafailed", et = "peerconnection:createofferfailed", tt = "peerconnection:createanswerfailed", nt = "peerconnection:setlocaldescriptionfailed", st = "peerconnection:setremotedescriptionfailed", it = "presentation:start", rt = "presentation:started", ot = "presentation:end", Ie = "presentation:ended", L = "presentation:failed", at = "SPECTATOR", ct = 1e6, ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
34
34
|
__proto__: null,
|
|
35
35
|
ACCEPTED: Ge,
|
|
36
|
-
ACCOUNT_CHANGED:
|
|
37
|
-
ACCOUNT_DELETED:
|
|
36
|
+
ACCOUNT_CHANGED: Ce,
|
|
37
|
+
ACCOUNT_DELETED: Ne,
|
|
38
38
|
ADMIN_FORCE_SYNC_MEDIA_STATE: b,
|
|
39
|
-
ADMIN_START_MAIN_CAM:
|
|
40
|
-
ADMIN_START_MIC:
|
|
41
|
-
ADMIN_STOP_MAIN_CAM:
|
|
42
|
-
ADMIN_STOP_MIC:
|
|
43
|
-
AVAILABLE_SECOND_REMOTE_STREAM_EVENT:
|
|
39
|
+
ADMIN_START_MAIN_CAM: oe,
|
|
40
|
+
ADMIN_START_MIC: ce,
|
|
41
|
+
ADMIN_STOP_MAIN_CAM: re,
|
|
42
|
+
ADMIN_STOP_MIC: ae,
|
|
43
|
+
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: z,
|
|
44
44
|
CHANNELS: y,
|
|
45
|
-
CHANNELS_NOTIFY:
|
|
46
|
-
CONFERENCE_PARTICIPANT_TOKEN_ISSUED:
|
|
45
|
+
CHANNELS_NOTIFY: ne,
|
|
46
|
+
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: ge,
|
|
47
47
|
CONFIRMED: w,
|
|
48
48
|
CONNECTED: m,
|
|
49
49
|
CONNECTING: H,
|
|
50
|
-
DECLINED_INCOMING_CALL:
|
|
50
|
+
DECLINED_INCOMING_CALL: x,
|
|
51
51
|
DISCONNECTED: u,
|
|
52
52
|
ENDED: P,
|
|
53
|
-
ENDED_FROM_SERVER:
|
|
54
|
-
ENTER_ROOM:
|
|
53
|
+
ENDED_FROM_SERVER: se,
|
|
54
|
+
ENTER_ROOM: K,
|
|
55
55
|
FAILED: A,
|
|
56
|
-
FAILED_INCOMING_CALL:
|
|
56
|
+
FAILED_INCOMING_CALL: G,
|
|
57
57
|
GET_USER_MEDIA_FAILED: Ze,
|
|
58
58
|
HOLD: Je,
|
|
59
59
|
ICE_CANDIDATE: Ke,
|
|
60
|
-
INCOMING_CALL:
|
|
61
|
-
MAIN_CAM_CONTROL:
|
|
62
|
-
MUST_STOP_PRESENTATION_EVENT:
|
|
60
|
+
INCOMING_CALL: Y,
|
|
61
|
+
MAIN_CAM_CONTROL: ie,
|
|
62
|
+
MUST_STOP_PRESENTATION_EVENT: j,
|
|
63
63
|
MUTED: $e,
|
|
64
|
-
NEW_DTMF:
|
|
65
|
-
NEW_INFO:
|
|
64
|
+
NEW_DTMF: Ae,
|
|
65
|
+
NEW_INFO: Re,
|
|
66
66
|
NEW_MESSAGE: qe,
|
|
67
67
|
NEW_RTC_SESSION: M,
|
|
68
|
-
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:
|
|
68
|
+
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: Q,
|
|
69
69
|
ONE_MEGABIT_IN_BITS: ct,
|
|
70
|
-
PARTICIPANT_ADDED_TO_LIST_MODERATORS:
|
|
71
|
-
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:
|
|
72
|
-
PARTICIPANT_MOVE_REQUEST_TO_STREAM:
|
|
73
|
-
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:
|
|
70
|
+
PARTICIPANT_ADDED_TO_LIST_MODERATORS: _e,
|
|
71
|
+
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: le,
|
|
72
|
+
PARTICIPANT_MOVE_REQUEST_TO_STREAM: he,
|
|
73
|
+
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: Ee,
|
|
74
74
|
PARTICIPATION_ACCEPTING_WORD_REQUEST: de,
|
|
75
|
-
PARTICIPATION_CANCELLING_WORD_REQUEST:
|
|
75
|
+
PARTICIPATION_CANCELLING_WORD_REQUEST: Te,
|
|
76
76
|
PEER_CONNECTION: U,
|
|
77
|
-
PEER_CONNECTION_CONFIRMED:
|
|
77
|
+
PEER_CONNECTION_CONFIRMED: ee,
|
|
78
78
|
PEER_CONNECTION_CREATE_ANSWER_FAILED: tt,
|
|
79
79
|
PEER_CONNECTION_CREATE_OFFER_FAILED: et,
|
|
80
|
-
PEER_CONNECTION_ONTRACK:
|
|
80
|
+
PEER_CONNECTION_ONTRACK: te,
|
|
81
81
|
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: nt,
|
|
82
82
|
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: st,
|
|
83
83
|
PRESENTATION_END: ot,
|
|
84
|
-
PRESENTATION_ENDED:
|
|
84
|
+
PRESENTATION_ENDED: Ie,
|
|
85
85
|
PRESENTATION_FAILED: L,
|
|
86
86
|
PRESENTATION_START: it,
|
|
87
87
|
PRESENTATION_STARTED: rt,
|
|
@@ -89,70 +89,70 @@ const ft = "Connection Error", Le = "Request Timeout", Pt = "SIP Failure Code",
|
|
|
89
89
|
REFER: Ye,
|
|
90
90
|
REGISTERED: p,
|
|
91
91
|
REGISTRATION_FAILED: f,
|
|
92
|
-
REINVITE:
|
|
92
|
+
REINVITE: Fe,
|
|
93
93
|
REPLACES: Ve,
|
|
94
94
|
SDP: je,
|
|
95
|
-
SENDING:
|
|
95
|
+
SENDING: Be,
|
|
96
96
|
SHARE_STATE: v,
|
|
97
|
-
SIP_EVENT:
|
|
97
|
+
SIP_EVENT: J,
|
|
98
98
|
SPECTATOR: at,
|
|
99
|
-
TERMINATED_INCOMING_CALL:
|
|
99
|
+
TERMINATED_INCOMING_CALL: $,
|
|
100
100
|
UNHOLD: ze,
|
|
101
101
|
UNMUTED: Xe,
|
|
102
|
-
UNREGISTERED:
|
|
102
|
+
UNREGISTERED: X,
|
|
103
103
|
UPDATE: Qe,
|
|
104
|
-
USE_LICENSE:
|
|
105
|
-
WEBCAST_STARTED:
|
|
106
|
-
WEBCAST_STOPPED:
|
|
104
|
+
USE_LICENSE: Z,
|
|
105
|
+
WEBCAST_STARTED: Se,
|
|
106
|
+
WEBCAST_STOPPED: ue
|
|
107
107
|
}, Symbol.toStringTag, { value: "Module" })), _t = [
|
|
108
|
-
V,
|
|
109
108
|
Y,
|
|
110
|
-
G,
|
|
111
109
|
x,
|
|
110
|
+
$,
|
|
111
|
+
G,
|
|
112
112
|
de,
|
|
113
|
-
le,
|
|
114
|
-
Ee,
|
|
115
|
-
te,
|
|
116
|
-
Ne,
|
|
117
|
-
ue,
|
|
118
|
-
Ce,
|
|
119
113
|
Te,
|
|
114
|
+
he,
|
|
115
|
+
ne,
|
|
116
|
+
ge,
|
|
117
|
+
Ce,
|
|
118
|
+
Ne,
|
|
120
119
|
Se,
|
|
121
|
-
|
|
122
|
-
_e
|
|
123
|
-
|
|
120
|
+
ue,
|
|
121
|
+
_e,
|
|
122
|
+
Ee
|
|
123
|
+
], me = [
|
|
124
124
|
H,
|
|
125
125
|
m,
|
|
126
126
|
u,
|
|
127
127
|
M,
|
|
128
128
|
p,
|
|
129
|
-
|
|
129
|
+
X,
|
|
130
130
|
f,
|
|
131
131
|
qe,
|
|
132
|
-
|
|
132
|
+
J
|
|
133
133
|
], Et = [
|
|
134
|
-
J,
|
|
135
134
|
z,
|
|
136
135
|
Q,
|
|
137
|
-
v,
|
|
138
136
|
j,
|
|
137
|
+
v,
|
|
139
138
|
K,
|
|
140
139
|
Z,
|
|
141
140
|
ee,
|
|
141
|
+
te,
|
|
142
142
|
y,
|
|
143
|
-
ne,
|
|
144
143
|
se,
|
|
145
|
-
re,
|
|
146
144
|
ie,
|
|
147
145
|
oe,
|
|
146
|
+
re,
|
|
148
147
|
ae,
|
|
148
|
+
ce,
|
|
149
149
|
b,
|
|
150
|
-
|
|
151
|
-
],
|
|
150
|
+
le
|
|
151
|
+
], pe = [
|
|
152
152
|
P,
|
|
153
153
|
H,
|
|
154
|
-
Fe,
|
|
155
154
|
Be,
|
|
155
|
+
Fe,
|
|
156
156
|
Ve,
|
|
157
157
|
Ye,
|
|
158
158
|
xe,
|
|
@@ -162,8 +162,8 @@ const ft = "Connection Error", Le = "Request Timeout", Pt = "SIP Failure Code",
|
|
|
162
162
|
A,
|
|
163
163
|
$e,
|
|
164
164
|
Xe,
|
|
165
|
-
ge,
|
|
166
165
|
Ae,
|
|
166
|
+
Re,
|
|
167
167
|
Je,
|
|
168
168
|
ze,
|
|
169
169
|
Qe,
|
|
@@ -177,27 +177,27 @@ const ft = "Connection Error", Le = "Request Timeout", Pt = "SIP Failure Code",
|
|
|
177
177
|
it,
|
|
178
178
|
rt,
|
|
179
179
|
ot,
|
|
180
|
-
|
|
180
|
+
Ie,
|
|
181
181
|
L
|
|
182
|
-
], ht = [...
|
|
183
|
-
...
|
|
182
|
+
], ht = [...me, ..._t], lt = [
|
|
183
|
+
...pe,
|
|
184
184
|
...Et
|
|
185
|
-
],
|
|
185
|
+
], ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
186
186
|
__proto__: null,
|
|
187
|
-
SESSION_EVENT_NAMES:
|
|
188
|
-
SESSION_JSSIP_EVENT_NAMES:
|
|
187
|
+
SESSION_EVENT_NAMES: lt,
|
|
188
|
+
SESSION_JSSIP_EVENT_NAMES: pe,
|
|
189
189
|
SESSION_SYNTHETICS_EVENT_NAMES: Et,
|
|
190
190
|
UA_EVENT_NAMES: ht,
|
|
191
|
-
UA_JSSIP_EVENT_NAMES:
|
|
191
|
+
UA_JSSIP_EVENT_NAMES: me,
|
|
192
192
|
UA_SYNTHETICS_EVENT_NAMES: _t
|
|
193
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
193
|
+
}, Symbol.toStringTag, { value: "Module" })), Vt = (r) => {
|
|
194
194
|
const e = [];
|
|
195
195
|
return r && e.push(`X-Vinteo-Remote: ${r}`), e;
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
},
|
|
196
|
+
}, Yt = "content-type", xt = "x-webrtc-enter-room", O = "application/vinteo.webrtc.sharedesktop", Gt = "application/vinteo.webrtc.roomname", $t = "application/vinteo.webrtc.channels", Xt = "application/vinteo.webrtc.mediastate", Jt = "application/vinteo.webrtc.refusal", Me = "application/vinteo.webrtc.maincam", zt = "application/vinteo.webrtc.mic", Qt = "application/vinteo.webrtc.uselic", jt = "X-WEBRTC-USE-LICENSE", Kt = "X-WEBRTC-PARTICIPANT-NAME", ve = "X-WEBRTC-INPUT-CHANNELS", ye = "X-WEBRTC-OUTPUT-CHANNELS", Zt = "X-WEBRTC-MAINCAM", en = "X-WEBRTC-MIC", be = "X-WEBRTC-SYNC", tn = "X-WEBRTC-MAINCAM-RESOLUTION", nn = "X-WEBRTC-MEDIA-STATE", sn = "X-Vinteo-Media-Type", rn = "X-Vinteo-MainCam-State", on = "X-Vinteo-Mic-State", an = "application/vinteo.webrtc.partstate", cn = "X-WEBRTC-PARTSTATE", _n = "application/vinteo.webrtc.notify", En = "X-VINTEO-NOTIFY", R = "x-webrtc-share-state", hn = `${R}: LETMESTARTPRESENTATION`, ln = `${R}: STOPPRESENTATION`, dt = "YOUCANRECEIVECONTENT", Tt = "CONTENTEND", St = "YOUMUSTSTOPSENDCONTENT", dn = `${R}: ${St}`, Tn = `${R}: ${dt}`, Sn = `${R}: ${Tt}`, un = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Cn = `${un}: LETMESTARTMAINCAM`, fe = "sip-connector", k = V(fe), is = () => {
|
|
197
|
+
V.enable(fe);
|
|
198
|
+
}, rs = () => {
|
|
199
|
+
V.enable(`-${fe}`);
|
|
200
|
+
}, Nn = (r, e) => {
|
|
201
201
|
r.getVideoTracks().forEach((n) => {
|
|
202
202
|
"contentHint" in n && n.contentHint !== e && (n.contentHint = e);
|
|
203
203
|
});
|
|
@@ -209,47 +209,47 @@ const ft = "Connection Error", Le = "Request Timeout", Pt = "SIP Failure Code",
|
|
|
209
209
|
if (!r || e === "recvonly" && t === "recvonly")
|
|
210
210
|
return;
|
|
211
211
|
const s = t === "recvonly" ? [] : r.getAudioTracks(), o = e === "recvonly" ? [] : r.getVideoTracks(), a = [...s, ...o], c = new MediaStream(a);
|
|
212
|
-
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" &&
|
|
212
|
+
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" && Nn(c, n), c;
|
|
213
213
|
};
|
|
214
|
-
var I = /* @__PURE__ */ ((r) => (r.PAUSE_MAIN_CAM = "PAUSEMAINCAM", r.RESUME_MAIN_CAM = "RESUMEMAINCAM", r.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", r.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", r.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", r))(I || {}),
|
|
215
|
-
function
|
|
214
|
+
var I = /* @__PURE__ */ ((r) => (r.PAUSE_MAIN_CAM = "PAUSEMAINCAM", r.RESUME_MAIN_CAM = "RESUMEMAINCAM", r.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", r.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", r.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", r))(I || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(q || {}), B = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(B || {}), gn = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(gn || {});
|
|
215
|
+
function An(r) {
|
|
216
216
|
return (e) => `sip:${e}@${r}`;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
const Rn = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (r) => r.trim().replaceAll(" ", "_"), In = Rn(1e5, 99999999), mn = (r) => r.some((t) => {
|
|
219
219
|
const { kind: n } = t;
|
|
220
220
|
return n === "video";
|
|
221
|
-
}),
|
|
221
|
+
}), pn = "Error decline with 603", fn = 1006, Pn = (r) => typeof r == "object" && r !== null && "code" in r && r.code === fn, On = (r) => r.message === pn, Dn = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), ut = 1, Ct = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, Mn = Ct(
|
|
222
222
|
ut
|
|
223
|
-
),
|
|
223
|
+
), vn = (r, e) => {
|
|
224
224
|
const t = r === void 0 ? void 0 : Math.max(r, ut);
|
|
225
|
-
if (t !== void 0 &&
|
|
225
|
+
if (t !== void 0 && Mn(
|
|
226
226
|
t,
|
|
227
227
|
e
|
|
228
228
|
))
|
|
229
229
|
return t;
|
|
230
|
-
},
|
|
231
|
-
if (
|
|
230
|
+
}, yn = Ct(), bn = (r, e) => {
|
|
231
|
+
if (yn(r, e))
|
|
232
232
|
return r;
|
|
233
|
-
},
|
|
233
|
+
}, wn = async (r, e, t) => {
|
|
234
234
|
const n = r.getParameters();
|
|
235
235
|
(n.encodings === void 0 || n.encodings.length === 0) && (n.encodings = [{}]);
|
|
236
|
-
const [s] = n.encodings, o = s.scaleResolutionDownBy, a =
|
|
236
|
+
const [s] = n.encodings, o = s.scaleResolutionDownBy, a = vn(
|
|
237
237
|
e.scaleResolutionDownBy,
|
|
238
238
|
o
|
|
239
239
|
);
|
|
240
240
|
let c = !1;
|
|
241
241
|
a !== void 0 && (n.encodings[0].scaleResolutionDownBy = a, c = !0);
|
|
242
|
-
const _ = s.maxBitrate, E =
|
|
242
|
+
const _ = s.maxBitrate, E = bn(e.maxBitrate, _);
|
|
243
243
|
return E !== void 0 && (n.encodings[0].maxBitrate = E, c = !0), c ? (t && t(n), r.setParameters(n).then(() => ({ parameters: n, isChanged: c }))) : { parameters: n, isChanged: c };
|
|
244
|
-
},
|
|
245
|
-
const n =
|
|
244
|
+
}, Un = async (r, e, t) => {
|
|
245
|
+
const n = Dn(r, e);
|
|
246
246
|
if (n)
|
|
247
|
-
return
|
|
248
|
-
},
|
|
247
|
+
return wn(n, { maxBitrate: t });
|
|
248
|
+
}, Ln = 486, Hn = 487, F = "local", Ue = "remote", Wn = 3, kn = 1, os = (r = new Error()) => {
|
|
249
249
|
const { originator: e, cause: t } = r;
|
|
250
|
-
return
|
|
251
|
-
}, g = "SipConnector",
|
|
252
|
-
class
|
|
250
|
+
return It(r) ? !0 : typeof t == "string" ? t === Le || t === He || e === F && (t === ke || t === We) : !1;
|
|
251
|
+
}, g = "SipConnector", qn = "channels", Bn = "WebcastStarted", Fn = "WebcastStopped", Vn = "accountChanged", Yn = "accountDeleted", xn = "addedToListModerators", Gn = "removedFromListModerators", $n = "ParticipationRequestAccepted", Xn = "ParticipationRequestRejected", Jn = "ParticipantMovedToWebcast", zn = "ConferenceParticipantTokenIssued";
|
|
252
|
+
class as {
|
|
253
253
|
constructor({ JsSIP: e }) {
|
|
254
254
|
i(this, "_isRegisterConfig", !1);
|
|
255
255
|
i(this, "_connectionConfiguration", {});
|
|
@@ -289,41 +289,41 @@ class _s {
|
|
|
289
289
|
try {
|
|
290
290
|
await this.unregister();
|
|
291
291
|
} catch (e) {
|
|
292
|
-
|
|
292
|
+
k("tryRegister", e);
|
|
293
293
|
}
|
|
294
294
|
return this.register();
|
|
295
295
|
});
|
|
296
|
-
i(this, "declineToIncomingCall", async ({ statusCode: e =
|
|
296
|
+
i(this, "declineToIncomingCall", async ({ statusCode: e = Hn } = {}) => new Promise((t, n) => {
|
|
297
297
|
if (!this.isAvailableIncomingCall) {
|
|
298
298
|
n(new Error("no incomingSession"));
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
const s = this.incomingSession, o = this.remoteCallerData;
|
|
302
|
-
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(
|
|
302
|
+
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(x, o), t(s.terminate({ status_code: e }));
|
|
303
303
|
}));
|
|
304
|
-
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode:
|
|
304
|
+
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Ln }));
|
|
305
305
|
i(this, "removeIncomingSession", () => {
|
|
306
306
|
delete this.incomingSession;
|
|
307
307
|
});
|
|
308
|
-
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t =
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return _ || E;
|
|
308
|
+
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = Wn } = {}) => {
|
|
309
|
+
const n = async () => this._cancelableConnect.request(e), s = (o) => {
|
|
310
|
+
var E;
|
|
311
|
+
const c = !!((E = this.ua) != null && E.isConnected()) && this.hasEqualConnectionConfiguration(e), _ = !!o && !Pn(o);
|
|
312
|
+
return c || _;
|
|
314
313
|
};
|
|
315
314
|
return this._cancelableConnectWithRepeatedCalls = De({
|
|
316
|
-
targetFunction:
|
|
317
|
-
isComplete:
|
|
315
|
+
targetFunction: n,
|
|
316
|
+
isComplete: s,
|
|
318
317
|
callLimit: t,
|
|
319
318
|
isRejectAsValid: !0,
|
|
319
|
+
isCheckBeforeCall: !1,
|
|
320
320
|
onAfterCancel: () => {
|
|
321
321
|
this._cancelableConnect.cancelRequest();
|
|
322
322
|
}
|
|
323
|
-
}), this._cancelableConnectWithRepeatedCalls.then((
|
|
324
|
-
if (
|
|
325
|
-
return
|
|
326
|
-
throw
|
|
323
|
+
}), this._cancelableConnectWithRepeatedCalls.then((o) => {
|
|
324
|
+
if (o instanceof this.JsSIP.UA)
|
|
325
|
+
return o;
|
|
326
|
+
throw o;
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
329
|
i(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
@@ -331,8 +331,8 @@ class _s {
|
|
|
331
331
|
this.incomingSession = t;
|
|
332
332
|
const n = this.remoteCallerData;
|
|
333
333
|
t.on(A, (s) => {
|
|
334
|
-
this.removeIncomingSession(), s.originator === F ? this._uaEvents.trigger(
|
|
335
|
-
}), this._uaEvents.trigger(
|
|
334
|
+
this.removeIncomingSession(), s.originator === F ? this._uaEvents.trigger($, n) : this._uaEvents.trigger(G, n);
|
|
335
|
+
}), this._uaEvents.trigger(Y, n);
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
i(this, "_connect", async (e) => this.initUa(e).then(async () => this._start()));
|
|
@@ -346,23 +346,23 @@ class _s {
|
|
|
346
346
|
registerExpires: c,
|
|
347
347
|
connectionRecoveryMinInterval: _,
|
|
348
348
|
connectionRecoveryMaxInterval: E,
|
|
349
|
-
userAgent:
|
|
350
|
-
displayName:
|
|
351
|
-
register:
|
|
349
|
+
userAgent: h,
|
|
350
|
+
displayName: l = "",
|
|
351
|
+
register: d = !1,
|
|
352
352
|
extraHeaders: T = []
|
|
353
353
|
}) => {
|
|
354
354
|
if (!n)
|
|
355
355
|
throw new Error("sipServerUrl is required");
|
|
356
356
|
if (!s)
|
|
357
357
|
throw new Error("sipWebSocketServerURL is required");
|
|
358
|
-
if (
|
|
358
|
+
if (d && !e)
|
|
359
359
|
throw new Error("user is required for authorized connection");
|
|
360
|
-
if (
|
|
360
|
+
if (d && !t)
|
|
361
361
|
throw new Error("password is required for authorized connection");
|
|
362
362
|
this._connectionConfiguration = {
|
|
363
363
|
sipServerUrl: n,
|
|
364
|
-
displayName:
|
|
365
|
-
register:
|
|
364
|
+
displayName: l,
|
|
365
|
+
register: d,
|
|
366
366
|
user: e,
|
|
367
367
|
password: t
|
|
368
368
|
};
|
|
@@ -371,22 +371,27 @@ class _s {
|
|
|
371
371
|
sipServerUrl: n,
|
|
372
372
|
sipWebSocketServerURL: s,
|
|
373
373
|
password: t,
|
|
374
|
-
displayName:
|
|
375
|
-
register:
|
|
374
|
+
displayName: l,
|
|
375
|
+
register: d,
|
|
376
376
|
sessionTimers: a,
|
|
377
377
|
registerExpires: c,
|
|
378
378
|
connectionRecoveryMinInterval: _,
|
|
379
379
|
connectionRecoveryMaxInterval: E,
|
|
380
|
-
userAgent:
|
|
380
|
+
userAgent: h
|
|
381
381
|
});
|
|
382
|
-
this.getSipServerUrl = S.getSipServerUrl, this.socket = S.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!
|
|
383
|
-
const Pe =
|
|
384
|
-
Pe && this.ua && this.ua.on(Pe,
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
|
|
382
|
+
return this.getSipServerUrl = S.getSipServerUrl, this.socket = S.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!d, this.ua = this._createUa({ ...C, remoteAddress: o, extraHeaders: T }), this._uaEvents.eachTriggers((W, Nt) => {
|
|
383
|
+
const Pe = me.find((gt) => gt === Nt);
|
|
384
|
+
Pe && this.ua && this.ua.on(Pe, W);
|
|
385
|
+
}), this.ua;
|
|
386
|
+
});
|
|
387
|
+
i(this, "_createUa", ({
|
|
388
|
+
remoteAddress: e,
|
|
389
|
+
extraHeaders: t = [],
|
|
390
|
+
...n
|
|
391
|
+
}) => {
|
|
392
|
+
const s = new this.JsSIP.UA(n), a = [...e ? Vt(e) : [], ...t];
|
|
393
|
+
return a.length > 0 && s.registrator().setExtraHeaders(a), s;
|
|
388
394
|
});
|
|
389
|
-
i(this, "_createUa", (e) => new this.JsSIP.UA(e));
|
|
390
395
|
i(this, "_start", async () => new Promise((e, t) => {
|
|
391
396
|
const { ua: n } = this;
|
|
392
397
|
if (!n) {
|
|
@@ -439,15 +444,15 @@ class _s {
|
|
|
439
444
|
audioMode: c,
|
|
440
445
|
degradationPreference: _,
|
|
441
446
|
contentHint: E,
|
|
442
|
-
offerToReceiveAudio:
|
|
443
|
-
offerToReceiveVideo:
|
|
444
|
-
}) => new Promise((
|
|
447
|
+
offerToReceiveAudio: h = !0,
|
|
448
|
+
offerToReceiveVideo: l = !0
|
|
449
|
+
}) => new Promise((d, T) => {
|
|
445
450
|
const { ua: C } = this;
|
|
446
451
|
if (!C) {
|
|
447
452
|
T(new Error("this.ua is not initialized"));
|
|
448
453
|
return;
|
|
449
454
|
}
|
|
450
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(
|
|
455
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(d).catch((S) => {
|
|
451
456
|
T(S);
|
|
452
457
|
}), this.session = C.call(this.getSipServerUrl(e), {
|
|
453
458
|
extraHeaders: n,
|
|
@@ -464,8 +469,8 @@ class _s {
|
|
|
464
469
|
iceServers: o
|
|
465
470
|
},
|
|
466
471
|
rtcOfferConstraints: {
|
|
467
|
-
offerToReceiveAudio:
|
|
468
|
-
offerToReceiveVideo:
|
|
472
|
+
offerToReceiveAudio: h,
|
|
473
|
+
offerToReceiveVideo: l
|
|
469
474
|
}
|
|
470
475
|
});
|
|
471
476
|
}));
|
|
@@ -478,34 +483,34 @@ class _s {
|
|
|
478
483
|
audioMode: a,
|
|
479
484
|
degradationPreference: c,
|
|
480
485
|
contentHint: _
|
|
481
|
-
}) => new Promise((E,
|
|
486
|
+
}) => new Promise((E, h) => {
|
|
482
487
|
if (!this.isAvailableIncomingCall) {
|
|
483
|
-
|
|
488
|
+
h(new Error("no incomingSession"));
|
|
484
489
|
return;
|
|
485
490
|
}
|
|
486
491
|
this.session = this.incomingSession, this.removeIncomingSession();
|
|
487
|
-
const { session:
|
|
488
|
-
if (!
|
|
489
|
-
|
|
492
|
+
const { session: l } = this;
|
|
493
|
+
if (!l) {
|
|
494
|
+
h(new Error("No session established"));
|
|
490
495
|
return;
|
|
491
496
|
}
|
|
492
497
|
this._sessionEvents.eachTriggers((T, C) => {
|
|
493
|
-
const S =
|
|
494
|
-
S &&
|
|
495
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number =
|
|
496
|
-
|
|
498
|
+
const S = pe.find((W) => W === C);
|
|
499
|
+
S && l.on(S, T);
|
|
500
|
+
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = l.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch((T) => {
|
|
501
|
+
h(T);
|
|
497
502
|
});
|
|
498
|
-
const
|
|
503
|
+
const d = D(e, {
|
|
499
504
|
videoMode: o,
|
|
500
505
|
audioMode: a,
|
|
501
506
|
contentHint: _
|
|
502
507
|
});
|
|
503
|
-
|
|
508
|
+
l.answer({
|
|
504
509
|
extraHeaders: n,
|
|
505
510
|
videoMode: o,
|
|
506
511
|
audioMode: a,
|
|
507
512
|
degradationPreference: c,
|
|
508
|
-
mediaStream:
|
|
513
|
+
mediaStream: d,
|
|
509
514
|
pcConfig: {
|
|
510
515
|
iceServers: s
|
|
511
516
|
}
|
|
@@ -513,23 +518,23 @@ class _s {
|
|
|
513
518
|
}));
|
|
514
519
|
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
|
|
515
520
|
const s = () => {
|
|
516
|
-
this.onSession(U,
|
|
521
|
+
this.onSession(U, h), this.onSession(w, l);
|
|
517
522
|
}, o = () => {
|
|
518
|
-
this.offSession(U,
|
|
523
|
+
this.offSession(U, h), this.offSession(w, l);
|
|
519
524
|
}, a = () => {
|
|
520
525
|
this.onSession(A, _), this.onSession(P, _);
|
|
521
526
|
}, c = () => {
|
|
522
527
|
this.offSession(A, _), this.offSession(P, _);
|
|
523
|
-
}, _ = (
|
|
524
|
-
o(), c(), n(
|
|
528
|
+
}, _ = (d) => {
|
|
529
|
+
o(), c(), n(d);
|
|
525
530
|
};
|
|
526
531
|
let E;
|
|
527
|
-
const
|
|
528
|
-
E =
|
|
529
|
-
this._sessionEvents.trigger(
|
|
532
|
+
const h = ({ peerconnection: d }) => {
|
|
533
|
+
E = d, E.ontrack = (T) => {
|
|
534
|
+
this._sessionEvents.trigger(te, E), e && e(T);
|
|
530
535
|
};
|
|
531
|
-
},
|
|
532
|
-
E && this._sessionEvents.trigger(
|
|
536
|
+
}, l = () => {
|
|
537
|
+
E && this._sessionEvents.trigger(ee, E), o(), c(), t(E);
|
|
533
538
|
};
|
|
534
539
|
s(), a();
|
|
535
540
|
}));
|
|
@@ -542,7 +547,7 @@ class _s {
|
|
|
542
547
|
n(new Error("No session established"));
|
|
543
548
|
return;
|
|
544
549
|
}
|
|
545
|
-
this.onceSession(
|
|
550
|
+
this.onceSession(Ae, ({ originator: o }) => {
|
|
546
551
|
o === F && t();
|
|
547
552
|
}), s.sendDTMF(e, {
|
|
548
553
|
duration: 120,
|
|
@@ -556,7 +561,7 @@ class _s {
|
|
|
556
561
|
try {
|
|
557
562
|
await this.stopPresentation();
|
|
558
563
|
} catch (t) {
|
|
559
|
-
|
|
564
|
+
k("error stop presentation: ", t);
|
|
560
565
|
}
|
|
561
566
|
if (this._restoreSession(), !e.isEnded())
|
|
562
567
|
return e.terminateAsync();
|
|
@@ -564,16 +569,16 @@ class _s {
|
|
|
564
569
|
});
|
|
565
570
|
i(this, "_handleShareState", (e) => {
|
|
566
571
|
switch (e) {
|
|
567
|
-
case
|
|
568
|
-
this._sessionEvents.trigger(
|
|
572
|
+
case dt: {
|
|
573
|
+
this._sessionEvents.trigger(z, void 0);
|
|
569
574
|
break;
|
|
570
575
|
}
|
|
571
576
|
case Tt: {
|
|
572
|
-
this._sessionEvents.trigger(
|
|
577
|
+
this._sessionEvents.trigger(Q, void 0);
|
|
573
578
|
break;
|
|
574
579
|
}
|
|
575
580
|
case St: {
|
|
576
|
-
this._sessionEvents.trigger(
|
|
581
|
+
this._sessionEvents.trigger(j, void 0);
|
|
577
582
|
break;
|
|
578
583
|
}
|
|
579
584
|
}
|
|
@@ -590,61 +595,61 @@ class _s {
|
|
|
590
595
|
});
|
|
591
596
|
i(this, "_handleNotify", (e) => {
|
|
592
597
|
switch (e.cmd) {
|
|
593
|
-
case
|
|
598
|
+
case qn: {
|
|
594
599
|
const t = e;
|
|
595
600
|
this._triggerChannelsNotify(t);
|
|
596
601
|
break;
|
|
597
602
|
}
|
|
598
|
-
case
|
|
603
|
+
case Bn: {
|
|
599
604
|
const t = e;
|
|
600
605
|
this._triggerWebcastStartedNotify(t);
|
|
601
606
|
break;
|
|
602
607
|
}
|
|
603
|
-
case
|
|
608
|
+
case Fn: {
|
|
604
609
|
const t = e;
|
|
605
610
|
this._triggerWebcastStoppedNotify(t);
|
|
606
611
|
break;
|
|
607
612
|
}
|
|
608
|
-
case
|
|
613
|
+
case xn: {
|
|
609
614
|
const t = e;
|
|
610
615
|
this._triggerAddedToListModeratorsNotify(t);
|
|
611
616
|
break;
|
|
612
617
|
}
|
|
613
|
-
case
|
|
618
|
+
case Gn: {
|
|
614
619
|
const t = e;
|
|
615
620
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
616
621
|
break;
|
|
617
622
|
}
|
|
618
|
-
case
|
|
623
|
+
case $n: {
|
|
619
624
|
const t = e;
|
|
620
625
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
621
626
|
break;
|
|
622
627
|
}
|
|
623
|
-
case
|
|
628
|
+
case Xn: {
|
|
624
629
|
const t = e;
|
|
625
630
|
this._triggerParticipationCancellingWordRequest(t);
|
|
626
631
|
break;
|
|
627
632
|
}
|
|
628
|
-
case
|
|
633
|
+
case Jn: {
|
|
629
634
|
const t = e;
|
|
630
635
|
this._triggerParticipantMoveRequestToStream(t);
|
|
631
636
|
break;
|
|
632
637
|
}
|
|
633
|
-
case
|
|
638
|
+
case Vn: {
|
|
634
639
|
this._triggerAccountChangedNotify();
|
|
635
640
|
break;
|
|
636
641
|
}
|
|
637
|
-
case
|
|
642
|
+
case Yn: {
|
|
638
643
|
this._triggerAccountDeletedNotify();
|
|
639
644
|
break;
|
|
640
645
|
}
|
|
641
|
-
case
|
|
646
|
+
case zn: {
|
|
642
647
|
const t = e;
|
|
643
648
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
644
649
|
break;
|
|
645
650
|
}
|
|
646
651
|
default:
|
|
647
|
-
|
|
652
|
+
k("unknown cmd", e.cmd);
|
|
648
653
|
}
|
|
649
654
|
});
|
|
650
655
|
i(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
@@ -654,7 +659,7 @@ class _s {
|
|
|
654
659
|
conference: e
|
|
655
660
|
};
|
|
656
661
|
this._uaEvents.trigger(
|
|
657
|
-
|
|
662
|
+
Ee,
|
|
658
663
|
t
|
|
659
664
|
);
|
|
660
665
|
});
|
|
@@ -662,27 +667,27 @@ class _s {
|
|
|
662
667
|
const t = {
|
|
663
668
|
conference: e
|
|
664
669
|
};
|
|
665
|
-
this._uaEvents.trigger(
|
|
670
|
+
this._uaEvents.trigger(_e, t);
|
|
666
671
|
});
|
|
667
672
|
i(this, "_triggerWebcastStartedNotify", ({ body: { conference: e, type: t } }) => {
|
|
668
673
|
const n = {
|
|
669
674
|
conference: e,
|
|
670
675
|
type: t
|
|
671
676
|
};
|
|
672
|
-
this._uaEvents.trigger(
|
|
677
|
+
this._uaEvents.trigger(Se, n);
|
|
673
678
|
});
|
|
674
679
|
i(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
|
|
675
680
|
const n = {
|
|
676
681
|
conference: e,
|
|
677
682
|
type: t
|
|
678
683
|
};
|
|
679
|
-
this._uaEvents.trigger(
|
|
684
|
+
this._uaEvents.trigger(ue, n);
|
|
680
685
|
});
|
|
681
686
|
i(this, "_triggerAccountChangedNotify", () => {
|
|
682
|
-
this._uaEvents.trigger(
|
|
687
|
+
this._uaEvents.trigger(Ce, void 0);
|
|
683
688
|
});
|
|
684
689
|
i(this, "_triggerAccountDeletedNotify", () => {
|
|
685
|
-
this._uaEvents.trigger(
|
|
690
|
+
this._uaEvents.trigger(Ne, void 0);
|
|
686
691
|
});
|
|
687
692
|
i(this, "_triggerConferenceParticipantTokenIssued", ({
|
|
688
693
|
body: { conference: e, participant: t, jwt: n }
|
|
@@ -693,7 +698,7 @@ class _s {
|
|
|
693
698
|
jwt: n
|
|
694
699
|
};
|
|
695
700
|
this._uaEvents.trigger(
|
|
696
|
-
|
|
701
|
+
ge,
|
|
697
702
|
s
|
|
698
703
|
);
|
|
699
704
|
});
|
|
@@ -702,7 +707,7 @@ class _s {
|
|
|
702
707
|
inputChannels: t,
|
|
703
708
|
outputChannels: n
|
|
704
709
|
};
|
|
705
|
-
this._uaEvents.trigger(
|
|
710
|
+
this._uaEvents.trigger(ne, s);
|
|
706
711
|
});
|
|
707
712
|
i(this, "_triggerParticipationAcceptingWordRequest", ({
|
|
708
713
|
body: { conference: e }
|
|
@@ -718,7 +723,7 @@ class _s {
|
|
|
718
723
|
const t = {
|
|
719
724
|
conference: e
|
|
720
725
|
};
|
|
721
|
-
this._uaEvents.trigger(
|
|
726
|
+
this._uaEvents.trigger(Te, t);
|
|
722
727
|
});
|
|
723
728
|
i(this, "_triggerParticipantMoveRequestToStream", ({
|
|
724
729
|
body: { conference: e }
|
|
@@ -726,56 +731,56 @@ class _s {
|
|
|
726
731
|
const t = {
|
|
727
732
|
conference: e
|
|
728
733
|
};
|
|
729
|
-
this._uaEvents.trigger(
|
|
734
|
+
this._uaEvents.trigger(he, t);
|
|
730
735
|
});
|
|
731
736
|
i(this, "_triggerEnterRoom", (e) => {
|
|
732
|
-
const t = e.getHeader(
|
|
733
|
-
this._sessionEvents.trigger(
|
|
737
|
+
const t = e.getHeader(xt), n = e.getHeader(Kt);
|
|
738
|
+
this._sessionEvents.trigger(K, { room: t, participantName: n });
|
|
734
739
|
});
|
|
735
740
|
i(this, "_triggerShareState", (e) => {
|
|
736
741
|
const t = e.getHeader(R);
|
|
737
742
|
this._sessionEvents.trigger(v, t);
|
|
738
743
|
});
|
|
739
744
|
i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
740
|
-
e.getHeader(
|
|
745
|
+
e.getHeader(cn) === at && this._sessionEvents.trigger(le, void 0);
|
|
741
746
|
});
|
|
742
747
|
i(this, "_triggerMainCamControl", (e) => {
|
|
743
|
-
const t = e.getHeader(
|
|
748
|
+
const t = e.getHeader(Zt), n = e.getHeader(be), s = n === B.ADMIN_SYNC_FORCED;
|
|
744
749
|
if (t === I.ADMIN_START_MAIN_CAM) {
|
|
745
|
-
this._sessionEvents.trigger(
|
|
750
|
+
this._sessionEvents.trigger(oe, { isSyncForced: s });
|
|
746
751
|
return;
|
|
747
752
|
}
|
|
748
753
|
if (t === I.ADMIN_STOP_MAIN_CAM) {
|
|
749
|
-
this._sessionEvents.trigger(
|
|
754
|
+
this._sessionEvents.trigger(re, { isSyncForced: s });
|
|
750
755
|
return;
|
|
751
756
|
}
|
|
752
757
|
(t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(b, { isSyncForced: s });
|
|
753
|
-
const o = e.getHeader(
|
|
754
|
-
this._sessionEvents.trigger(
|
|
758
|
+
const o = e.getHeader(tn);
|
|
759
|
+
this._sessionEvents.trigger(ie, {
|
|
755
760
|
mainCam: t,
|
|
756
761
|
resolutionMainCam: o
|
|
757
762
|
});
|
|
758
763
|
});
|
|
759
764
|
i(this, "_triggerMicControl", (e) => {
|
|
760
|
-
const t = e.getHeader(
|
|
761
|
-
t ===
|
|
765
|
+
const t = e.getHeader(en), s = e.getHeader(be) === B.ADMIN_SYNC_FORCED;
|
|
766
|
+
t === q.ADMIN_START_MIC ? this._sessionEvents.trigger(ce, { isSyncForced: s }) : t === q.ADMIN_STOP_MIC && this._sessionEvents.trigger(ae, { isSyncForced: s });
|
|
762
767
|
});
|
|
763
768
|
i(this, "_triggerUseLicense", (e) => {
|
|
764
|
-
const t = e.getHeader(
|
|
765
|
-
this._sessionEvents.trigger(
|
|
769
|
+
const t = e.getHeader(jt);
|
|
770
|
+
this._sessionEvents.trigger(Z, t);
|
|
766
771
|
});
|
|
767
772
|
i(this, "_handleNewInfo", (e) => {
|
|
768
773
|
const { originator: t } = e;
|
|
769
774
|
if (t !== "remote")
|
|
770
775
|
return;
|
|
771
|
-
const { request: n } = e, s = n.getHeader(
|
|
776
|
+
const { request: n } = e, s = n.getHeader(Yt);
|
|
772
777
|
if (s)
|
|
773
778
|
switch (s) {
|
|
774
|
-
case
|
|
779
|
+
case Gt: {
|
|
775
780
|
this._triggerEnterRoom(n), this._maybeTriggerChannels(n);
|
|
776
781
|
break;
|
|
777
782
|
}
|
|
778
|
-
case
|
|
783
|
+
case _n: {
|
|
779
784
|
this._maybeHandleNotify(n);
|
|
780
785
|
break;
|
|
781
786
|
}
|
|
@@ -787,15 +792,15 @@ class _s {
|
|
|
787
792
|
this._triggerMainCamControl(n);
|
|
788
793
|
break;
|
|
789
794
|
}
|
|
790
|
-
case
|
|
795
|
+
case zt: {
|
|
791
796
|
this._triggerMicControl(n);
|
|
792
797
|
break;
|
|
793
798
|
}
|
|
794
|
-
case
|
|
799
|
+
case Qt: {
|
|
795
800
|
this._triggerUseLicense(n);
|
|
796
801
|
break;
|
|
797
802
|
}
|
|
798
|
-
case
|
|
803
|
+
case an: {
|
|
799
804
|
this._maybeTriggerParticipantMoveRequestToSpectators(n);
|
|
800
805
|
break;
|
|
801
806
|
}
|
|
@@ -805,7 +810,7 @@ class _s {
|
|
|
805
810
|
this._maybeHandleNotify(e);
|
|
806
811
|
});
|
|
807
812
|
i(this, "_maybeHandleNotify", (e) => {
|
|
808
|
-
const t = e.getHeader(
|
|
813
|
+
const t = e.getHeader(En);
|
|
809
814
|
if (t) {
|
|
810
815
|
const n = JSON.parse(t);
|
|
811
816
|
this._handleNotify(n);
|
|
@@ -813,9 +818,9 @@ class _s {
|
|
|
813
818
|
});
|
|
814
819
|
i(this, "_handleEnded", (e) => {
|
|
815
820
|
const { originator: t } = e;
|
|
816
|
-
t === Ue && this._sessionEvents.trigger(
|
|
821
|
+
t === Ue && this._sessionEvents.trigger(se, e), this._restoreSession();
|
|
817
822
|
});
|
|
818
|
-
this.JsSIP = e, this._sessionEvents = new Oe(
|
|
823
|
+
this.JsSIP = e, this._sessionEvents = new Oe(lt), this._uaEvents = new Oe(ht), this._cancelableConnect = new N(
|
|
819
824
|
this._connect,
|
|
820
825
|
{
|
|
821
826
|
moduleName: g,
|
|
@@ -834,7 +839,7 @@ class _s {
|
|
|
834
839
|
}), this._cancelableCall = new N(
|
|
835
840
|
this._call,
|
|
836
841
|
{ moduleName: g }
|
|
837
|
-
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(v, this._handleShareState), this.onSession(
|
|
842
|
+
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(v, this._handleShareState), this.onSession(Re, this._handleNewInfo), this.on(J, this._handleSipEvent), this.onSession(A, this._handleEnded), this.onSession(P, this._handleEnded);
|
|
838
843
|
}
|
|
839
844
|
async register() {
|
|
840
845
|
return new Promise((e, t) => {
|
|
@@ -843,7 +848,7 @@ class _s {
|
|
|
843
848
|
}
|
|
844
849
|
async unregister() {
|
|
845
850
|
return new Promise((e, t) => {
|
|
846
|
-
this.isRegistered && this.ua ? (this.ua.on(
|
|
851
|
+
this.isRegistered && this.ua ? (this.ua.on(X, e), this.ua.unregister()) : t(new Error("ua is not registered"));
|
|
847
852
|
});
|
|
848
853
|
}
|
|
849
854
|
async sendOptions(e, t, n) {
|
|
@@ -876,23 +881,25 @@ class _s {
|
|
|
876
881
|
userAgent: e,
|
|
877
882
|
displayName: t,
|
|
878
883
|
sipServerUrl: n,
|
|
879
|
-
sipWebSocketServerURL: s
|
|
884
|
+
sipWebSocketServerURL: s,
|
|
885
|
+
remoteAddress: o,
|
|
886
|
+
extraHeaders: a
|
|
880
887
|
}) {
|
|
881
|
-
return new Promise((
|
|
882
|
-
const { configuration:
|
|
888
|
+
return new Promise((c, _) => {
|
|
889
|
+
const { configuration: E } = this.createUaConfiguration({
|
|
883
890
|
sipWebSocketServerURL: s,
|
|
884
891
|
displayName: t,
|
|
885
892
|
userAgent: e,
|
|
886
893
|
sipServerUrl: n
|
|
887
|
-
}),
|
|
888
|
-
const
|
|
889
|
-
|
|
894
|
+
}), h = this._createUa({ ...E, remoteAddress: o, extraHeaders: a }), l = () => {
|
|
895
|
+
const T = new Error("Telephony is not available");
|
|
896
|
+
_(T);
|
|
890
897
|
};
|
|
891
|
-
|
|
898
|
+
h.once(u, l);
|
|
892
899
|
const d = () => {
|
|
893
|
-
|
|
900
|
+
h.removeAllListeners(), h.once(u, c), h.stop();
|
|
894
901
|
};
|
|
895
|
-
|
|
902
|
+
h.once(m, d), h.start();
|
|
896
903
|
});
|
|
897
904
|
}
|
|
898
905
|
async replaceMediaStream(e, t) {
|
|
@@ -904,13 +911,13 @@ class _s {
|
|
|
904
911
|
async askPermissionToEnableCam(e = {}) {
|
|
905
912
|
if (!this.session)
|
|
906
913
|
throw new Error("No session established");
|
|
907
|
-
const t = [
|
|
914
|
+
const t = [Cn];
|
|
908
915
|
return this.session.sendInfo(Me, void 0, {
|
|
909
916
|
noTerminateWhenError: !0,
|
|
910
917
|
...e,
|
|
911
918
|
extraHeaders: t
|
|
912
919
|
}).catch((n) => {
|
|
913
|
-
if (
|
|
920
|
+
if (On(n))
|
|
914
921
|
throw n;
|
|
915
922
|
});
|
|
916
923
|
}
|
|
@@ -922,7 +929,7 @@ class _s {
|
|
|
922
929
|
stream: t,
|
|
923
930
|
presentationOptions: n,
|
|
924
931
|
options: s = {
|
|
925
|
-
callLimit:
|
|
932
|
+
callLimit: kn
|
|
926
933
|
}
|
|
927
934
|
}) {
|
|
928
935
|
const o = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
@@ -949,25 +956,25 @@ class _s {
|
|
|
949
956
|
registerExpires: _ = 60 * 5,
|
|
950
957
|
// 5 minutes in sec
|
|
951
958
|
connectionRecoveryMinInterval: E = 2,
|
|
952
|
-
connectionRecoveryMaxInterval:
|
|
953
|
-
userAgent:
|
|
959
|
+
connectionRecoveryMaxInterval: h = 6,
|
|
960
|
+
userAgent: l
|
|
954
961
|
}) {
|
|
955
962
|
if (a && !t)
|
|
956
963
|
throw new Error("password is required for authorized connection");
|
|
957
|
-
const
|
|
964
|
+
const d = a && e ? e.trim() : `${In()}`, T = An(o), C = T(d), S = new this.JsSIP.WebSocketInterface(n);
|
|
958
965
|
return {
|
|
959
966
|
configuration: {
|
|
960
967
|
password: t,
|
|
961
968
|
register: a,
|
|
962
969
|
uri: C,
|
|
963
970
|
display_name: we(s),
|
|
964
|
-
user_agent:
|
|
971
|
+
user_agent: l,
|
|
965
972
|
sdp_semantics: "unified-plan",
|
|
966
973
|
sockets: [S],
|
|
967
974
|
session_timers: c,
|
|
968
975
|
register_expires: _,
|
|
969
976
|
connection_recovery_min_interval: E,
|
|
970
|
-
connection_recovery_max_interval:
|
|
977
|
+
connection_recovery_max_interval: h
|
|
971
978
|
},
|
|
972
979
|
helpers: {
|
|
973
980
|
socket: S,
|
|
@@ -984,22 +991,22 @@ class _s {
|
|
|
984
991
|
}) {
|
|
985
992
|
const _ = D(t, { contentHint: c });
|
|
986
993
|
this._streamPresentationCurrent = _;
|
|
987
|
-
const E = a ? [
|
|
994
|
+
const E = a ? [Tn] : [hn], h = e.sendInfo(O, void 0, {
|
|
988
995
|
extraHeaders: E
|
|
989
996
|
}).then(async () => e.startPresentation(
|
|
990
997
|
_,
|
|
991
998
|
o,
|
|
992
999
|
s
|
|
993
1000
|
)).then(async () => {
|
|
994
|
-
const { connection:
|
|
995
|
-
if (!
|
|
1001
|
+
const { connection: l } = this;
|
|
1002
|
+
if (!l || n === void 0)
|
|
996
1003
|
return;
|
|
997
|
-
const
|
|
998
|
-
await
|
|
999
|
-
}).then(() => t).catch((
|
|
1000
|
-
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(L,
|
|
1004
|
+
const d = l.getSenders();
|
|
1005
|
+
await Un(d, t, n);
|
|
1006
|
+
}).then(() => t).catch((l) => {
|
|
1007
|
+
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(L, l), l;
|
|
1001
1008
|
});
|
|
1002
|
-
return this.promisePendingStartPresentation =
|
|
1009
|
+
return this.promisePendingStartPresentation = h, h.finally(() => {
|
|
1003
1010
|
this.promisePendingStartPresentation = void 0;
|
|
1004
1011
|
});
|
|
1005
1012
|
}
|
|
@@ -1030,7 +1037,7 @@ class _s {
|
|
|
1030
1037
|
}
|
|
1031
1038
|
async sendMustStopPresentation(e) {
|
|
1032
1039
|
await e.sendInfo(O, void 0, {
|
|
1033
|
-
extraHeaders: [
|
|
1040
|
+
extraHeaders: [dn]
|
|
1034
1041
|
});
|
|
1035
1042
|
}
|
|
1036
1043
|
async stopPresentation({
|
|
@@ -1039,12 +1046,12 @@ class _s {
|
|
|
1039
1046
|
this._cancelSendPresentationWithRepeatedCalls();
|
|
1040
1047
|
const t = this._streamPresentationCurrent;
|
|
1041
1048
|
let n = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
1042
|
-
const s = e ? [
|
|
1049
|
+
const s = e ? [Sn] : [ln], o = this.establishedSession;
|
|
1043
1050
|
return o && t && (n = n.then(async () => o.sendInfo(O, void 0, {
|
|
1044
1051
|
extraHeaders: s
|
|
1045
1052
|
})).then(async () => o.stopPresentation(t)).catch((a) => {
|
|
1046
1053
|
throw this._sessionEvents.trigger(L, a), a;
|
|
1047
|
-
})), !o && t && this._sessionEvents.trigger(
|
|
1054
|
+
})), !o && t && this._sessionEvents.trigger(Ie, t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
1048
1055
|
this._resetPresentation();
|
|
1049
1056
|
});
|
|
1050
1057
|
}
|
|
@@ -1116,7 +1123,7 @@ class _s {
|
|
|
1116
1123
|
if (!this.connection)
|
|
1117
1124
|
return;
|
|
1118
1125
|
const t = this.connection.getReceivers().map(({ track: n }) => n);
|
|
1119
|
-
return
|
|
1126
|
+
return mn(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1120
1127
|
}
|
|
1121
1128
|
get connection() {
|
|
1122
1129
|
var t;
|
|
@@ -1203,17 +1210,17 @@ class _s {
|
|
|
1203
1210
|
n,
|
|
1204
1211
|
s
|
|
1205
1212
|
];
|
|
1206
|
-
return this.session.sendInfo(
|
|
1213
|
+
return this.session.sendInfo($t, void 0, { extraHeaders: o });
|
|
1207
1214
|
}
|
|
1208
1215
|
async sendMediaState({ cam: e, mic: t }, n = {}) {
|
|
1209
1216
|
if (!this.session)
|
|
1210
1217
|
throw new Error("No session established");
|
|
1211
|
-
const s = `${
|
|
1218
|
+
const s = `${nn}: currentstate`, o = `${rn}: ${Number(e)}`, a = `${on}: ${Number(t)}`, c = [
|
|
1212
1219
|
s,
|
|
1213
1220
|
o,
|
|
1214
1221
|
a
|
|
1215
1222
|
];
|
|
1216
|
-
return this.session.sendInfo(
|
|
1223
|
+
return this.session.sendInfo(Xt, void 0, {
|
|
1217
1224
|
noTerminateWhenError: !0,
|
|
1218
1225
|
...n,
|
|
1219
1226
|
extraHeaders: c
|
|
@@ -1222,8 +1229,8 @@ class _s {
|
|
|
1222
1229
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1223
1230
|
if (!this.session)
|
|
1224
1231
|
throw new Error("No session established");
|
|
1225
|
-
const c = [`${
|
|
1226
|
-
return this.session.sendInfo(
|
|
1232
|
+
const c = [`${sn}: ${e === "mic" ? 0 : 1}`];
|
|
1233
|
+
return this.session.sendInfo(Jt, void 0, {
|
|
1227
1234
|
noTerminateWhenError: !0,
|
|
1228
1235
|
...t,
|
|
1229
1236
|
extraHeaders: c
|
|
@@ -1241,22 +1248,22 @@ class _s {
|
|
|
1241
1248
|
}
|
|
1242
1249
|
}
|
|
1243
1250
|
export {
|
|
1244
|
-
|
|
1251
|
+
Bt as B,
|
|
1245
1252
|
I as E,
|
|
1246
|
-
|
|
1253
|
+
Mt as N,
|
|
1247
1254
|
He as R,
|
|
1248
|
-
|
|
1255
|
+
as as S,
|
|
1249
1256
|
ht as U,
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1257
|
+
ns as a,
|
|
1258
|
+
is as b,
|
|
1259
|
+
ts as c,
|
|
1260
|
+
rs as d,
|
|
1261
|
+
ss as e,
|
|
1262
|
+
q as f,
|
|
1263
|
+
B as g,
|
|
1264
|
+
os as h,
|
|
1265
|
+
gn as i,
|
|
1266
|
+
lt as j,
|
|
1267
|
+
k as l,
|
|
1268
|
+
wn as s
|
|
1262
1269
|
};
|