sip-connector 8.3.0 → 9.1.0
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-DagL4rCl.js → SipConnector-Eb3K8Ixo.js} +263 -258
- package/dist/SipConnector-Qzp-_Vxz.cjs +1 -0
- package/dist/SipConnector.d.ts +5 -3
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +200 -194
- package/dist/tools/answerIncomingCall.d.ts +2 -0
- package/dist/tools/callToServer.d.ts +2 -0
- package/dist/tools/resolveStartPresentation.d.ts +6 -6
- package/dist/tools/resolveStopShareSipConnector.d.ts +1 -3
- package/dist/tools/resolveUpdatePresentation.d.ts +5 -4
- package/dist/types.d.ts +1 -0
- package/package.json +10 -10
- package/dist/SipConnector-BCc5pokv.cjs +0 -1
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
import { CancelableRequest as N, isCanceledError as
|
|
5
|
-
import
|
|
6
|
-
import { repeatedCallsAsync as
|
|
1
|
+
var It = Object.defineProperty;
|
|
2
|
+
var mt = (r, e, t) => e in r ? It(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => mt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CancelableRequest as N, isCanceledError as pt } from "@krivega/cancelable-promise";
|
|
5
|
+
import Oe from "events-constructor";
|
|
6
|
+
import { repeatedCallsAsync as De } from "repeated-calls";
|
|
7
7
|
import B from "debug";
|
|
8
|
-
const
|
|
8
|
+
const ft = "Connection Error", Le = "Request Timeout", Pt = "SIP Failure Code", Ot = "Internal Error", Dt = "Busy", He = "Rejected", Mt = "Redirected", vt = "Unavailable", yt = "Not Found", bt = "Address Incomplete", wt = "Incompatible SDP", Ut = "Missing SDP", Lt = "Authentication Error", We = "Terminated", Ht = "WebRTC Error", ke = "Canceled", Wt = "No Answer", kt = "Expires", qt = "No ACK", Ft = "Dialog Error", Bt = "User Denied Media Access", Vt = "Bad Media Description", Yt = "RTP Timeout", ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
9
|
__proto__: null,
|
|
10
|
-
ADDRESS_INCOMPLETE:
|
|
11
|
-
AUTHENTICATION_ERROR:
|
|
12
|
-
BAD_MEDIA_DESCRIPTION:
|
|
13
|
-
BUSY:
|
|
14
|
-
BYE:
|
|
15
|
-
CANCELED:
|
|
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:
|
|
26
|
-
REJECTED:
|
|
27
|
-
REQUEST_TIMEOUT:
|
|
28
|
-
RTP_TIMEOUT:
|
|
29
|
-
SIP_FAILURE_CODE:
|
|
30
|
-
UNAVAILABLE:
|
|
31
|
-
USER_DENIED_MEDIA_ACCESS:
|
|
32
|
-
WEBRTC_ERROR:
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" })), V = "incomingCall", Y = "declinedIncomingCall", x = "failedIncomingCall", G = "terminatedIncomingCall",
|
|
10
|
+
ADDRESS_INCOMPLETE: bt,
|
|
11
|
+
AUTHENTICATION_ERROR: Lt,
|
|
12
|
+
BAD_MEDIA_DESCRIPTION: Vt,
|
|
13
|
+
BUSY: Dt,
|
|
14
|
+
BYE: We,
|
|
15
|
+
CANCELED: ke,
|
|
16
|
+
CONNECTION_ERROR: ft,
|
|
17
|
+
DIALOG_ERROR: Ft,
|
|
18
|
+
EXPIRES: kt,
|
|
19
|
+
INCOMPATIBLE_SDP: wt,
|
|
20
|
+
INTERNAL_ERROR: Ot,
|
|
21
|
+
MISSING_SDP: Ut,
|
|
22
|
+
NOT_FOUND: yt,
|
|
23
|
+
NO_ACK: qt,
|
|
24
|
+
NO_ANSWER: Wt,
|
|
25
|
+
REDIRECTED: Mt,
|
|
26
|
+
REJECTED: He,
|
|
27
|
+
REQUEST_TIMEOUT: Le,
|
|
28
|
+
RTP_TIMEOUT: Yt,
|
|
29
|
+
SIP_FAILURE_CODE: Pt,
|
|
30
|
+
UNAVAILABLE: vt,
|
|
31
|
+
USER_DENIED_MEDIA_ACCESS: Bt,
|
|
32
|
+
WEBRTC_ERROR: Ht
|
|
33
|
+
}, Symbol.toStringTag, { value: "Module" })), V = "incomingCall", Y = "declinedIncomingCall", x = "failedIncomingCall", G = "terminatedIncomingCall", H = "connecting", m = "connected", u = "disconnected", M = "newRTCSession", p = "registered", $ = "unregistered", f = "registrationFailed", qe = "newMessage", X = "sipEvent", J = "availableSecondRemoteStream", z = "notAvailableSecondRemoteStream", Q = "mustStopPresentation", v = "shareState", j = "enterRoom", K = "useLicense", Z = "peerconnection:confirmed", ee = "peerconnection:ontrack", y = "channels", te = "channels:notify", ne = "ended:fromserver", se = "main-cam-control", ie = "admin-stop-main-cam", re = "admin-start-main-cam", oe = "admin-stop-mic", ae = "admin-start-mic", b = "admin-force-sync-media-state", ce = "participant:added-to-list-moderators", _e = "participant:removed-from-list-moderators", Ee = "participant:move-request-to-stream", he = "participant:move-request-to-spectators", de = "participation:accepting-word-request", le = "participation:cancelling-word-request", Te = "webcast:started", Se = "webcast:stopped", ue = "account:changed", Ce = "account:deleted", Ne = "conference:participant-token-issued", P = "ended", Fe = "sending", Be = "reinvite", Ve = "replaces", Ye = "refer", xe = "progress", Ge = "accepted", w = "confirmed", U = "peerconnection", A = "failed", $e = "muted", Xe = "unmuted", ge = "newDTMF", Ae = "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", Re = "presentation:ended", L = "presentation:failed", at = "SPECTATOR", ct = 1e6, is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
34
34
|
__proto__: null,
|
|
35
|
-
ACCEPTED:
|
|
35
|
+
ACCEPTED: Ge,
|
|
36
36
|
ACCOUNT_CHANGED: ue,
|
|
37
37
|
ACCOUNT_DELETED: Ce,
|
|
38
|
-
ADMIN_FORCE_SYNC_MEDIA_STATE:
|
|
38
|
+
ADMIN_FORCE_SYNC_MEDIA_STATE: b,
|
|
39
39
|
ADMIN_START_MAIN_CAM: re,
|
|
40
40
|
ADMIN_START_MIC: ae,
|
|
41
41
|
ADMIN_STOP_MAIN_CAM: ie,
|
|
42
42
|
ADMIN_STOP_MIC: oe,
|
|
43
43
|
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: J,
|
|
44
|
-
CHANNELS:
|
|
44
|
+
CHANNELS: y,
|
|
45
45
|
CHANNELS_NOTIFY: te,
|
|
46
46
|
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ne,
|
|
47
|
-
CONFIRMED:
|
|
47
|
+
CONFIRMED: w,
|
|
48
48
|
CONNECTED: m,
|
|
49
|
-
CONNECTING:
|
|
49
|
+
CONNECTING: H,
|
|
50
50
|
DECLINED_INCOMING_CALL: Y,
|
|
51
|
-
DISCONNECTED:
|
|
51
|
+
DISCONNECTED: u,
|
|
52
52
|
ENDED: P,
|
|
53
53
|
ENDED_FROM_SERVER: ne,
|
|
54
54
|
ENTER_ROOM: j,
|
|
55
55
|
FAILED: A,
|
|
56
56
|
FAILED_INCOMING_CALL: x,
|
|
57
|
-
GET_USER_MEDIA_FAILED:
|
|
58
|
-
HOLD:
|
|
59
|
-
ICE_CANDIDATE:
|
|
57
|
+
GET_USER_MEDIA_FAILED: Ze,
|
|
58
|
+
HOLD: Je,
|
|
59
|
+
ICE_CANDIDATE: Ke,
|
|
60
60
|
INCOMING_CALL: V,
|
|
61
61
|
MAIN_CAM_CONTROL: se,
|
|
62
62
|
MUST_STOP_PRESENTATION_EVENT: Q,
|
|
63
|
-
MUTED:
|
|
63
|
+
MUTED: $e,
|
|
64
64
|
NEW_DTMF: ge,
|
|
65
65
|
NEW_INFO: Ae,
|
|
66
|
-
NEW_MESSAGE:
|
|
67
|
-
NEW_RTC_SESSION:
|
|
66
|
+
NEW_MESSAGE: qe,
|
|
67
|
+
NEW_RTC_SESSION: M,
|
|
68
68
|
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: z,
|
|
69
|
-
ONE_MEGABIT_IN_BITS:
|
|
69
|
+
ONE_MEGABIT_IN_BITS: ct,
|
|
70
70
|
PARTICIPANT_ADDED_TO_LIST_MODERATORS: ce,
|
|
71
71
|
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: he,
|
|
72
72
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
|
|
73
73
|
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: _e,
|
|
74
74
|
PARTICIPATION_ACCEPTING_WORD_REQUEST: de,
|
|
75
75
|
PARTICIPATION_CANCELLING_WORD_REQUEST: le,
|
|
76
|
-
PEER_CONNECTION:
|
|
76
|
+
PEER_CONNECTION: U,
|
|
77
77
|
PEER_CONNECTION_CONFIRMED: Z,
|
|
78
|
-
PEER_CONNECTION_CREATE_ANSWER_FAILED:
|
|
79
|
-
PEER_CONNECTION_CREATE_OFFER_FAILED:
|
|
78
|
+
PEER_CONNECTION_CREATE_ANSWER_FAILED: tt,
|
|
79
|
+
PEER_CONNECTION_CREATE_OFFER_FAILED: et,
|
|
80
80
|
PEER_CONNECTION_ONTRACK: ee,
|
|
81
|
-
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:
|
|
82
|
-
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:
|
|
83
|
-
PRESENTATION_END:
|
|
81
|
+
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: nt,
|
|
82
|
+
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: st,
|
|
83
|
+
PRESENTATION_END: ot,
|
|
84
84
|
PRESENTATION_ENDED: Re,
|
|
85
|
-
PRESENTATION_FAILED:
|
|
86
|
-
PRESENTATION_START:
|
|
87
|
-
PRESENTATION_STARTED:
|
|
88
|
-
PROGRESS:
|
|
89
|
-
REFER:
|
|
85
|
+
PRESENTATION_FAILED: L,
|
|
86
|
+
PRESENTATION_START: it,
|
|
87
|
+
PRESENTATION_STARTED: rt,
|
|
88
|
+
PROGRESS: xe,
|
|
89
|
+
REFER: Ye,
|
|
90
90
|
REGISTERED: p,
|
|
91
91
|
REGISTRATION_FAILED: f,
|
|
92
|
-
REINVITE:
|
|
93
|
-
REPLACES:
|
|
94
|
-
SDP:
|
|
95
|
-
SENDING:
|
|
96
|
-
SHARE_STATE:
|
|
92
|
+
REINVITE: Be,
|
|
93
|
+
REPLACES: Ve,
|
|
94
|
+
SDP: je,
|
|
95
|
+
SENDING: Fe,
|
|
96
|
+
SHARE_STATE: v,
|
|
97
97
|
SIP_EVENT: X,
|
|
98
|
-
SPECTATOR:
|
|
98
|
+
SPECTATOR: at,
|
|
99
99
|
TERMINATED_INCOMING_CALL: G,
|
|
100
|
-
UNHOLD:
|
|
101
|
-
UNMUTED:
|
|
100
|
+
UNHOLD: ze,
|
|
101
|
+
UNMUTED: Xe,
|
|
102
102
|
UNREGISTERED: $,
|
|
103
|
-
UPDATE:
|
|
103
|
+
UPDATE: Qe,
|
|
104
104
|
USE_LICENSE: K,
|
|
105
105
|
WEBCAST_STARTED: Te,
|
|
106
106
|
WEBCAST_STOPPED: Se
|
|
107
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
107
|
+
}, Symbol.toStringTag, { value: "Module" })), _t = [
|
|
108
108
|
V,
|
|
109
109
|
Y,
|
|
110
110
|
G,
|
|
@@ -121,50 +121,49 @@ const pt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
|
|
|
121
121
|
ce,
|
|
122
122
|
_e
|
|
123
123
|
], Ie = [
|
|
124
|
-
|
|
124
|
+
H,
|
|
125
125
|
m,
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
u,
|
|
127
|
+
M,
|
|
128
128
|
p,
|
|
129
129
|
$,
|
|
130
130
|
f,
|
|
131
|
-
|
|
131
|
+
qe,
|
|
132
132
|
X
|
|
133
|
-
],
|
|
133
|
+
], Et = [
|
|
134
134
|
J,
|
|
135
135
|
z,
|
|
136
136
|
Q,
|
|
137
|
-
|
|
137
|
+
v,
|
|
138
138
|
j,
|
|
139
139
|
K,
|
|
140
140
|
Z,
|
|
141
141
|
ee,
|
|
142
|
-
|
|
142
|
+
y,
|
|
143
143
|
ne,
|
|
144
144
|
se,
|
|
145
145
|
re,
|
|
146
146
|
ie,
|
|
147
147
|
oe,
|
|
148
148
|
ae,
|
|
149
|
-
|
|
149
|
+
b,
|
|
150
150
|
he
|
|
151
151
|
], me = [
|
|
152
152
|
P,
|
|
153
|
-
|
|
154
|
-
qe,
|
|
153
|
+
H,
|
|
155
154
|
Fe,
|
|
156
155
|
Be,
|
|
157
156
|
Ve,
|
|
158
157
|
Ye,
|
|
159
158
|
xe,
|
|
160
|
-
|
|
159
|
+
Ge,
|
|
161
160
|
w,
|
|
161
|
+
U,
|
|
162
162
|
A,
|
|
163
|
-
Ge,
|
|
164
163
|
$e,
|
|
164
|
+
Xe,
|
|
165
165
|
ge,
|
|
166
166
|
Ae,
|
|
167
|
-
Xe,
|
|
168
167
|
Je,
|
|
169
168
|
ze,
|
|
170
169
|
Qe,
|
|
@@ -177,31 +176,32 @@ const pt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
|
|
|
177
176
|
st,
|
|
178
177
|
it,
|
|
179
178
|
rt,
|
|
179
|
+
ot,
|
|
180
180
|
Re,
|
|
181
|
-
|
|
182
|
-
],
|
|
181
|
+
L
|
|
182
|
+
], ht = [...Ie, ..._t], dt = [
|
|
183
183
|
...me,
|
|
184
|
-
...
|
|
184
|
+
...Et
|
|
185
185
|
], rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
186
186
|
__proto__: null,
|
|
187
|
-
SESSION_EVENT_NAMES:
|
|
187
|
+
SESSION_EVENT_NAMES: dt,
|
|
188
188
|
SESSION_JSSIP_EVENT_NAMES: me,
|
|
189
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
190
|
-
UA_EVENT_NAMES:
|
|
189
|
+
SESSION_SYNTHETICS_EVENT_NAMES: Et,
|
|
190
|
+
UA_EVENT_NAMES: ht,
|
|
191
191
|
UA_JSSIP_EVENT_NAMES: Ie,
|
|
192
|
-
UA_SYNTHETICS_EVENT_NAMES:
|
|
193
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
192
|
+
UA_SYNTHETICS_EVENT_NAMES: _t
|
|
193
|
+
}, Symbol.toStringTag, { value: "Module" })), xt = (r) => {
|
|
194
194
|
const e = [];
|
|
195
195
|
return r && e.push(`X-Vinteo-Remote: ${r}`), e;
|
|
196
|
-
},
|
|
196
|
+
}, Gt = "content-type", $t = "x-webrtc-enter-room", O = "application/vinteo.webrtc.sharedesktop", Xt = "application/vinteo.webrtc.roomname", Jt = "application/vinteo.webrtc.channels", zt = "application/vinteo.webrtc.mediastate", Qt = "application/vinteo.webrtc.refusal", Me = "application/vinteo.webrtc.maincam", jt = "application/vinteo.webrtc.mic", Kt = "application/vinteo.webrtc.uselic", Zt = "X-WEBRTC-USE-LICENSE", en = "X-WEBRTC-PARTICIPANT-NAME", ve = "X-WEBRTC-INPUT-CHANNELS", ye = "X-WEBRTC-OUTPUT-CHANNELS", tn = "X-WEBRTC-MAINCAM", nn = "X-WEBRTC-MIC", be = "X-WEBRTC-SYNC", sn = "X-WEBRTC-MAINCAM-RESOLUTION", rn = "X-WEBRTC-MEDIA-STATE", on = "X-Vinteo-Media-Type", an = "X-Vinteo-MainCam-State", cn = "X-Vinteo-Mic-State", _n = "application/vinteo.webrtc.partstate", En = "X-WEBRTC-PARTSTATE", hn = "application/vinteo.webrtc.notify", dn = "X-VINTEO-NOTIFY", R = "x-webrtc-share-state", ln = `${R}: LETMESTARTPRESENTATION`, Tn = `${R}: STOPPRESENTATION`, lt = "YOUCANRECEIVECONTENT", Tt = "CONTENTEND", St = "YOUMUSTSTOPSENDCONTENT", Sn = `${R}: ${St}`, un = `${R}: ${lt}`, Cn = `${R}: ${Tt}`, Nn = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", gn = `${Nn}: LETMESTARTMAINCAM`, pe = "sip-connector", W = B(pe), os = () => {
|
|
197
197
|
B.enable(pe);
|
|
198
198
|
}, as = () => {
|
|
199
199
|
B.enable(`-${pe}`);
|
|
200
|
-
},
|
|
200
|
+
}, An = (r, e) => {
|
|
201
201
|
r.getVideoTracks().forEach((n) => {
|
|
202
202
|
"contentHint" in n && n.contentHint !== e && (n.contentHint = e);
|
|
203
203
|
});
|
|
204
|
-
},
|
|
204
|
+
}, D = (r, {
|
|
205
205
|
videoMode: e,
|
|
206
206
|
audioMode: t,
|
|
207
207
|
contentHint: n
|
|
@@ -209,46 +209,46 @@ const pt = "Connection Error", Ue = "Request Timeout", ft = "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" && An(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 || {}), k = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(k || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(q || {}),
|
|
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 || {}), k = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(k || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(q || {}), Rn = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(Rn || {});
|
|
215
|
+
function In(r) {
|
|
216
216
|
return (e) => `sip:${e}@${r}`;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
const mn = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (r) => r.trim().replaceAll(" ", "_"), pn = mn(1e5, 99999999), fn = (r) => r.some((t) => {
|
|
219
219
|
const { kind: n } = t;
|
|
220
220
|
return n === "video";
|
|
221
|
-
}),
|
|
222
|
-
|
|
223
|
-
),
|
|
224
|
-
const t = r === void 0 ? void 0 : Math.max(r,
|
|
225
|
-
if (t !== void 0 &&
|
|
221
|
+
}), Pn = "Error decline with 603", On = 1006, Dn = (r) => typeof r == "object" && r !== null && "code" in r && r.code === On, Mn = (r) => r.message === Pn, vn = (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, yn = Ct(
|
|
222
|
+
ut
|
|
223
|
+
), bn = (r, e) => {
|
|
224
|
+
const t = r === void 0 ? void 0 : Math.max(r, ut);
|
|
225
|
+
if (t !== void 0 && yn(
|
|
226
226
|
t,
|
|
227
227
|
e
|
|
228
228
|
))
|
|
229
229
|
return t;
|
|
230
|
-
},
|
|
231
|
-
if (
|
|
230
|
+
}, wn = Ct(), Un = (r, e) => {
|
|
231
|
+
if (wn(r, e))
|
|
232
232
|
return r;
|
|
233
|
-
},
|
|
233
|
+
}, Ln = 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 = bn(
|
|
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 = Un(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
|
+
}, Hn = async (r, e, t) => {
|
|
245
|
+
const n = vn(r, e);
|
|
246
246
|
if (n)
|
|
247
|
-
return
|
|
248
|
-
},
|
|
247
|
+
return Ln(n, { maxBitrate: t });
|
|
248
|
+
}, Wn = 486, kn = 487, F = "local", Ue = "remote", qn = 3, Fn = 1, cs = (r = new Error()) => {
|
|
249
249
|
const { originator: e, cause: t } = r;
|
|
250
|
-
return
|
|
251
|
-
}, g = "SipConnector",
|
|
250
|
+
return pt(r) ? !0 : typeof t == "string" ? t === Le || t === He || e === F && (t === ke || t === We) : !1;
|
|
251
|
+
}, g = "SipConnector", Bn = "channels", Vn = "WebcastStarted", Yn = "WebcastStopped", xn = "accountChanged", Gn = "accountDeleted", $n = "addedToListModerators", Xn = "removedFromListModerators", Jn = "ParticipationRequestAccepted", zn = "ParticipationRequestRejected", Qn = "ParticipantMovedToWebcast", jn = "ConferenceParticipantTokenIssued";
|
|
252
252
|
class _s {
|
|
253
253
|
constructor({ JsSIP: e }) {
|
|
254
254
|
i(this, "_isRegisterConfig", !1);
|
|
@@ -285,15 +285,15 @@ class _s {
|
|
|
285
285
|
i(this, "tryRegister", async () => {
|
|
286
286
|
if (!this.isRegisterConfig)
|
|
287
287
|
throw new Error("Config is not registered");
|
|
288
|
-
this._uaEvents.trigger(
|
|
288
|
+
this._uaEvents.trigger(H, void 0);
|
|
289
289
|
try {
|
|
290
290
|
await this.unregister();
|
|
291
291
|
} catch (e) {
|
|
292
|
-
|
|
292
|
+
W("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 = kn } = {}) => new Promise((t, n) => {
|
|
297
297
|
if (!this.isAvailableIncomingCall) {
|
|
298
298
|
n(new Error("no incomingSession"));
|
|
299
299
|
return;
|
|
@@ -301,18 +301,18 @@ class _s {
|
|
|
301
301
|
const s = this.incomingSession, o = this.remoteCallerData;
|
|
302
302
|
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(Y, 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: Wn }));
|
|
305
305
|
i(this, "removeIncomingSession", () => {
|
|
306
306
|
delete this.incomingSession;
|
|
307
307
|
});
|
|
308
|
-
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t =
|
|
308
|
+
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = qn } = {}) => {
|
|
309
309
|
let n = !0;
|
|
310
310
|
const s = async () => (n = !1, this._cancelableConnect.request(e)), o = (a) => {
|
|
311
|
-
var
|
|
312
|
-
const c = !!((
|
|
311
|
+
var d;
|
|
312
|
+
const c = !!((d = this.ua) != null && d.isConnected()), _ = !n && c && this.hasEqualConnectionConfiguration(e), E = !!a && !Dn(a);
|
|
313
313
|
return _ || E;
|
|
314
314
|
};
|
|
315
|
-
return this._cancelableConnectWithRepeatedCalls =
|
|
315
|
+
return this._cancelableConnectWithRepeatedCalls = De({
|
|
316
316
|
targetFunction: s,
|
|
317
317
|
isComplete: o,
|
|
318
318
|
callLimit: t,
|
|
@@ -327,7 +327,7 @@ class _s {
|
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
329
|
i(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
330
|
-
if (e ===
|
|
330
|
+
if (e === Ue) {
|
|
331
331
|
this.incomingSession = t;
|
|
332
332
|
const n = this.remoteCallerData;
|
|
333
333
|
t.on(A, (s) => {
|
|
@@ -346,45 +346,45 @@ class _s {
|
|
|
346
346
|
registerExpires: c,
|
|
347
347
|
connectionRecoveryMinInterval: _,
|
|
348
348
|
connectionRecoveryMaxInterval: E,
|
|
349
|
-
userAgent:
|
|
350
|
-
displayName:
|
|
351
|
-
register:
|
|
349
|
+
userAgent: d,
|
|
350
|
+
displayName: h = "",
|
|
351
|
+
register: l = !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 (l && !e)
|
|
359
359
|
throw new Error("user is required for authorized connection");
|
|
360
|
-
if (
|
|
360
|
+
if (l && !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: h,
|
|
365
|
+
register: l,
|
|
366
366
|
user: e,
|
|
367
367
|
password: t
|
|
368
368
|
};
|
|
369
|
-
const { configuration:
|
|
369
|
+
const { configuration: C, helpers: S } = this.createUaConfiguration({
|
|
370
370
|
user: e,
|
|
371
371
|
sipServerUrl: n,
|
|
372
372
|
sipWebSocketServerURL: s,
|
|
373
373
|
password: t,
|
|
374
|
-
displayName:
|
|
375
|
-
register:
|
|
374
|
+
displayName: h,
|
|
375
|
+
register: l,
|
|
376
376
|
sessionTimers: a,
|
|
377
377
|
registerExpires: c,
|
|
378
378
|
connectionRecoveryMinInterval: _,
|
|
379
379
|
connectionRecoveryMaxInterval: E,
|
|
380
|
-
userAgent:
|
|
380
|
+
userAgent: d
|
|
381
381
|
});
|
|
382
|
-
this.getSipServerUrl =
|
|
383
|
-
const
|
|
384
|
-
|
|
382
|
+
this.getSipServerUrl = S.getSipServerUrl, this.socket = S.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l, this.ua = this._createUa(C), this._uaEvents.eachTriggers((gt, At) => {
|
|
383
|
+
const Pe = Ie.find((Rt) => Rt === At);
|
|
384
|
+
Pe && this.ua && this.ua.on(Pe, gt);
|
|
385
385
|
});
|
|
386
|
-
const
|
|
387
|
-
return this.ua.registrator().setExtraHeaders(
|
|
386
|
+
const Nt = [...xt(o), ...T];
|
|
387
|
+
return this.ua.registrator().setExtraHeaders(Nt), this.ua;
|
|
388
388
|
});
|
|
389
389
|
i(this, "_createUa", (e) => new this.JsSIP.UA(e));
|
|
390
390
|
i(this, "_start", async () => new Promise((e, t) => {
|
|
@@ -398,11 +398,11 @@ class _s {
|
|
|
398
398
|
}, o = (_) => {
|
|
399
399
|
c(), t(_);
|
|
400
400
|
}, a = () => {
|
|
401
|
-
this.isRegisterConfig ? (this.on(p, s), this.on(f, o)) : this.on(m, s), this.on(
|
|
401
|
+
this.isRegisterConfig ? (this.on(p, s), this.on(f, o)) : this.on(m, s), this.on(u, o);
|
|
402
402
|
}, c = () => {
|
|
403
|
-
this.off(p, s), this.off(f, o), this.off(m, s), this.off(
|
|
403
|
+
this.off(p, s), this.off(f, o), this.off(m, s), this.off(u, o);
|
|
404
404
|
};
|
|
405
|
-
a(), this.on(
|
|
405
|
+
a(), this.on(M, this.handleNewRTCSession), n.start();
|
|
406
406
|
}));
|
|
407
407
|
i(this, "_set", async ({ displayName: e, password: t }) => new Promise((n, s) => {
|
|
408
408
|
const { ua: o } = this;
|
|
@@ -411,7 +411,7 @@ class _s {
|
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
413
|
let a = !1, c = !1;
|
|
414
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name",
|
|
414
|
+
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name", we(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = o.set("password", t), this._connectionConfiguration.password = t);
|
|
415
415
|
const _ = a || c;
|
|
416
416
|
c && this.isRegisterConfig ? this.register().then(() => {
|
|
417
417
|
n(_);
|
|
@@ -421,13 +421,13 @@ class _s {
|
|
|
421
421
|
}));
|
|
422
422
|
i(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
|
|
423
423
|
i(this, "_disconnect", async () => {
|
|
424
|
-
this.off(
|
|
424
|
+
this.off(M, this.handleNewRTCSession);
|
|
425
425
|
const e = new Promise((t) => {
|
|
426
|
-
this.once(
|
|
426
|
+
this.once(u, () => {
|
|
427
427
|
delete this.ua, t();
|
|
428
428
|
});
|
|
429
429
|
});
|
|
430
|
-
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(
|
|
430
|
+
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(u, void 0)) : this._uaEvents.trigger(u, void 0), e;
|
|
431
431
|
});
|
|
432
432
|
i(this, "_call", async ({
|
|
433
433
|
number: e,
|
|
@@ -438,21 +438,23 @@ class _s {
|
|
|
438
438
|
videoMode: a,
|
|
439
439
|
audioMode: c,
|
|
440
440
|
degradationPreference: _,
|
|
441
|
-
|
|
441
|
+
contentHint: E,
|
|
442
|
+
offerToReceiveAudio: d = !0,
|
|
442
443
|
offerToReceiveVideo: h = !0
|
|
443
|
-
}) => new Promise((l,
|
|
444
|
-
const { ua:
|
|
445
|
-
if (!
|
|
446
|
-
|
|
444
|
+
}) => new Promise((l, T) => {
|
|
445
|
+
const { ua: C } = this;
|
|
446
|
+
if (!C) {
|
|
447
|
+
T(new Error("this.ua is not initialized"));
|
|
447
448
|
return;
|
|
448
449
|
}
|
|
449
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(l).catch((
|
|
450
|
-
|
|
451
|
-
}), this.session =
|
|
450
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(l).catch((S) => {
|
|
451
|
+
T(S);
|
|
452
|
+
}), this.session = C.call(this.getSipServerUrl(e), {
|
|
452
453
|
extraHeaders: n,
|
|
453
|
-
mediaStream:
|
|
454
|
+
mediaStream: D(t, {
|
|
454
455
|
videoMode: a,
|
|
455
|
-
audioMode: c
|
|
456
|
+
audioMode: c,
|
|
457
|
+
contentHint: E
|
|
456
458
|
}),
|
|
457
459
|
eventHandlers: this._sessionEvents.triggers,
|
|
458
460
|
videoMode: a,
|
|
@@ -462,7 +464,7 @@ class _s {
|
|
|
462
464
|
iceServers: o
|
|
463
465
|
},
|
|
464
466
|
rtcOfferConstraints: {
|
|
465
|
-
offerToReceiveAudio:
|
|
467
|
+
offerToReceiveAudio: d,
|
|
466
468
|
offerToReceiveVideo: h
|
|
467
469
|
}
|
|
468
470
|
});
|
|
@@ -474,27 +476,29 @@ class _s {
|
|
|
474
476
|
iceServers: s,
|
|
475
477
|
videoMode: o,
|
|
476
478
|
audioMode: a,
|
|
477
|
-
degradationPreference: c
|
|
478
|
-
|
|
479
|
+
degradationPreference: c,
|
|
480
|
+
contentHint: _
|
|
481
|
+
}) => new Promise((E, d) => {
|
|
479
482
|
if (!this.isAvailableIncomingCall) {
|
|
480
|
-
|
|
483
|
+
d(new Error("no incomingSession"));
|
|
481
484
|
return;
|
|
482
485
|
}
|
|
483
486
|
this.session = this.incomingSession, this.removeIncomingSession();
|
|
484
487
|
const { session: h } = this;
|
|
485
488
|
if (!h) {
|
|
486
|
-
|
|
489
|
+
d(new Error("No session established"));
|
|
487
490
|
return;
|
|
488
491
|
}
|
|
489
|
-
this._sessionEvents.eachTriggers((
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(
|
|
493
|
-
|
|
492
|
+
this._sessionEvents.eachTriggers((T, C) => {
|
|
493
|
+
const S = me.find((fe) => fe === C);
|
|
494
|
+
S && h.on(S, T);
|
|
495
|
+
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch((T) => {
|
|
496
|
+
d(T);
|
|
494
497
|
});
|
|
495
|
-
const l =
|
|
498
|
+
const l = D(e, {
|
|
496
499
|
videoMode: o,
|
|
497
|
-
audioMode: a
|
|
500
|
+
audioMode: a,
|
|
501
|
+
contentHint: _
|
|
498
502
|
});
|
|
499
503
|
h.answer({
|
|
500
504
|
extraHeaders: n,
|
|
@@ -509,22 +513,22 @@ class _s {
|
|
|
509
513
|
}));
|
|
510
514
|
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
|
|
511
515
|
const s = () => {
|
|
512
|
-
this.onSession(
|
|
516
|
+
this.onSession(U, d), this.onSession(w, h);
|
|
513
517
|
}, o = () => {
|
|
514
|
-
this.offSession(
|
|
518
|
+
this.offSession(U, d), this.offSession(w, h);
|
|
515
519
|
}, a = () => {
|
|
516
520
|
this.onSession(A, _), this.onSession(P, _);
|
|
517
521
|
}, c = () => {
|
|
518
522
|
this.offSession(A, _), this.offSession(P, _);
|
|
519
|
-
}, _ = (
|
|
520
|
-
o(), c(), n(
|
|
523
|
+
}, _ = (l) => {
|
|
524
|
+
o(), c(), n(l);
|
|
521
525
|
};
|
|
522
526
|
let E;
|
|
523
|
-
const
|
|
524
|
-
E =
|
|
527
|
+
const d = ({ peerconnection: l }) => {
|
|
528
|
+
E = l, E.ontrack = (T) => {
|
|
525
529
|
this._sessionEvents.trigger(ee, E), e && e(T);
|
|
526
530
|
};
|
|
527
|
-
},
|
|
531
|
+
}, h = () => {
|
|
528
532
|
E && this._sessionEvents.trigger(Z, E), o(), c(), t(E);
|
|
529
533
|
};
|
|
530
534
|
s(), a();
|
|
@@ -552,7 +556,7 @@ class _s {
|
|
|
552
556
|
try {
|
|
553
557
|
await this.stopPresentation();
|
|
554
558
|
} catch (t) {
|
|
555
|
-
|
|
559
|
+
W("error stop presentation: ", t);
|
|
556
560
|
}
|
|
557
561
|
if (this._restoreSession(), !e.isEnded())
|
|
558
562
|
return e.terminateAsync();
|
|
@@ -560,87 +564,87 @@ class _s {
|
|
|
560
564
|
});
|
|
561
565
|
i(this, "_handleShareState", (e) => {
|
|
562
566
|
switch (e) {
|
|
563
|
-
case
|
|
567
|
+
case lt: {
|
|
564
568
|
this._sessionEvents.trigger(J, void 0);
|
|
565
569
|
break;
|
|
566
570
|
}
|
|
567
|
-
case
|
|
571
|
+
case Tt: {
|
|
568
572
|
this._sessionEvents.trigger(z, void 0);
|
|
569
573
|
break;
|
|
570
574
|
}
|
|
571
|
-
case
|
|
575
|
+
case St: {
|
|
572
576
|
this._sessionEvents.trigger(Q, void 0);
|
|
573
577
|
break;
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
580
|
});
|
|
577
581
|
i(this, "_maybeTriggerChannels", (e) => {
|
|
578
|
-
const t = e.getHeader(
|
|
582
|
+
const t = e.getHeader(ve), n = e.getHeader(ye);
|
|
579
583
|
if (t && n) {
|
|
580
584
|
const s = {
|
|
581
585
|
inputChannels: t,
|
|
582
586
|
outputChannels: n
|
|
583
587
|
};
|
|
584
|
-
this._sessionEvents.trigger(
|
|
588
|
+
this._sessionEvents.trigger(y, s);
|
|
585
589
|
}
|
|
586
590
|
});
|
|
587
591
|
i(this, "_handleNotify", (e) => {
|
|
588
592
|
switch (e.cmd) {
|
|
589
|
-
case
|
|
593
|
+
case Bn: {
|
|
590
594
|
const t = e;
|
|
591
595
|
this._triggerChannelsNotify(t);
|
|
592
596
|
break;
|
|
593
597
|
}
|
|
594
|
-
case
|
|
598
|
+
case Vn: {
|
|
595
599
|
const t = e;
|
|
596
600
|
this._triggerWebcastStartedNotify(t);
|
|
597
601
|
break;
|
|
598
602
|
}
|
|
599
|
-
case
|
|
603
|
+
case Yn: {
|
|
600
604
|
const t = e;
|
|
601
605
|
this._triggerWebcastStoppedNotify(t);
|
|
602
606
|
break;
|
|
603
607
|
}
|
|
604
|
-
case
|
|
608
|
+
case $n: {
|
|
605
609
|
const t = e;
|
|
606
610
|
this._triggerAddedToListModeratorsNotify(t);
|
|
607
611
|
break;
|
|
608
612
|
}
|
|
609
|
-
case
|
|
613
|
+
case Xn: {
|
|
610
614
|
const t = e;
|
|
611
615
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
612
616
|
break;
|
|
613
617
|
}
|
|
614
|
-
case
|
|
618
|
+
case Jn: {
|
|
615
619
|
const t = e;
|
|
616
620
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
617
621
|
break;
|
|
618
622
|
}
|
|
619
|
-
case
|
|
623
|
+
case zn: {
|
|
620
624
|
const t = e;
|
|
621
625
|
this._triggerParticipationCancellingWordRequest(t);
|
|
622
626
|
break;
|
|
623
627
|
}
|
|
624
|
-
case
|
|
628
|
+
case Qn: {
|
|
625
629
|
const t = e;
|
|
626
630
|
this._triggerParticipantMoveRequestToStream(t);
|
|
627
631
|
break;
|
|
628
632
|
}
|
|
629
|
-
case
|
|
633
|
+
case xn: {
|
|
630
634
|
this._triggerAccountChangedNotify();
|
|
631
635
|
break;
|
|
632
636
|
}
|
|
633
|
-
case
|
|
637
|
+
case Gn: {
|
|
634
638
|
this._triggerAccountDeletedNotify();
|
|
635
639
|
break;
|
|
636
640
|
}
|
|
637
|
-
case
|
|
641
|
+
case jn: {
|
|
638
642
|
const t = e;
|
|
639
643
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
640
644
|
break;
|
|
641
645
|
}
|
|
642
646
|
default:
|
|
643
|
-
|
|
647
|
+
W("unknown cmd", e.cmd);
|
|
644
648
|
}
|
|
645
649
|
});
|
|
646
650
|
i(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
@@ -725,18 +729,18 @@ class _s {
|
|
|
725
729
|
this._uaEvents.trigger(Ee, t);
|
|
726
730
|
});
|
|
727
731
|
i(this, "_triggerEnterRoom", (e) => {
|
|
728
|
-
const t = e.getHeader(
|
|
732
|
+
const t = e.getHeader($t), n = e.getHeader(en);
|
|
729
733
|
this._sessionEvents.trigger(j, { room: t, participantName: n });
|
|
730
734
|
});
|
|
731
735
|
i(this, "_triggerShareState", (e) => {
|
|
732
736
|
const t = e.getHeader(R);
|
|
733
|
-
this._sessionEvents.trigger(
|
|
737
|
+
this._sessionEvents.trigger(v, t);
|
|
734
738
|
});
|
|
735
739
|
i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
736
|
-
e.getHeader(
|
|
740
|
+
e.getHeader(En) === at && this._sessionEvents.trigger(he, void 0);
|
|
737
741
|
});
|
|
738
742
|
i(this, "_triggerMainCamControl", (e) => {
|
|
739
|
-
const t = e.getHeader(
|
|
743
|
+
const t = e.getHeader(tn), n = e.getHeader(be), s = n === q.ADMIN_SYNC_FORCED;
|
|
740
744
|
if (t === I.ADMIN_START_MAIN_CAM) {
|
|
741
745
|
this._sessionEvents.trigger(re, { isSyncForced: s });
|
|
742
746
|
return;
|
|
@@ -745,33 +749,33 @@ class _s {
|
|
|
745
749
|
this._sessionEvents.trigger(ie, { isSyncForced: s });
|
|
746
750
|
return;
|
|
747
751
|
}
|
|
748
|
-
(t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(
|
|
749
|
-
const o = e.getHeader(
|
|
752
|
+
(t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(b, { isSyncForced: s });
|
|
753
|
+
const o = e.getHeader(sn);
|
|
750
754
|
this._sessionEvents.trigger(se, {
|
|
751
755
|
mainCam: t,
|
|
752
756
|
resolutionMainCam: o
|
|
753
757
|
});
|
|
754
758
|
});
|
|
755
759
|
i(this, "_triggerMicControl", (e) => {
|
|
756
|
-
const t = e.getHeader(
|
|
760
|
+
const t = e.getHeader(nn), s = e.getHeader(be) === q.ADMIN_SYNC_FORCED;
|
|
757
761
|
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(ae, { isSyncForced: s }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(oe, { isSyncForced: s });
|
|
758
762
|
});
|
|
759
763
|
i(this, "_triggerUseLicense", (e) => {
|
|
760
|
-
const t = e.getHeader(
|
|
764
|
+
const t = e.getHeader(Zt);
|
|
761
765
|
this._sessionEvents.trigger(K, t);
|
|
762
766
|
});
|
|
763
767
|
i(this, "_handleNewInfo", (e) => {
|
|
764
768
|
const { originator: t } = e;
|
|
765
769
|
if (t !== "remote")
|
|
766
770
|
return;
|
|
767
|
-
const { request: n } = e, s = n.getHeader(
|
|
771
|
+
const { request: n } = e, s = n.getHeader(Gt);
|
|
768
772
|
if (s)
|
|
769
773
|
switch (s) {
|
|
770
|
-
case
|
|
774
|
+
case Xt: {
|
|
771
775
|
this._triggerEnterRoom(n), this._maybeTriggerChannels(n);
|
|
772
776
|
break;
|
|
773
777
|
}
|
|
774
|
-
case
|
|
778
|
+
case hn: {
|
|
775
779
|
this._maybeHandleNotify(n);
|
|
776
780
|
break;
|
|
777
781
|
}
|
|
@@ -779,19 +783,19 @@ class _s {
|
|
|
779
783
|
this._triggerShareState(n);
|
|
780
784
|
break;
|
|
781
785
|
}
|
|
782
|
-
case
|
|
786
|
+
case Me: {
|
|
783
787
|
this._triggerMainCamControl(n);
|
|
784
788
|
break;
|
|
785
789
|
}
|
|
786
|
-
case
|
|
790
|
+
case jt: {
|
|
787
791
|
this._triggerMicControl(n);
|
|
788
792
|
break;
|
|
789
793
|
}
|
|
790
|
-
case
|
|
794
|
+
case Kt: {
|
|
791
795
|
this._triggerUseLicense(n);
|
|
792
796
|
break;
|
|
793
797
|
}
|
|
794
|
-
case
|
|
798
|
+
case _n: {
|
|
795
799
|
this._maybeTriggerParticipantMoveRequestToSpectators(n);
|
|
796
800
|
break;
|
|
797
801
|
}
|
|
@@ -801,7 +805,7 @@ class _s {
|
|
|
801
805
|
this._maybeHandleNotify(e);
|
|
802
806
|
});
|
|
803
807
|
i(this, "_maybeHandleNotify", (e) => {
|
|
804
|
-
const t = e.getHeader(
|
|
808
|
+
const t = e.getHeader(dn);
|
|
805
809
|
if (t) {
|
|
806
810
|
const n = JSON.parse(t);
|
|
807
811
|
this._handleNotify(n);
|
|
@@ -809,9 +813,9 @@ class _s {
|
|
|
809
813
|
});
|
|
810
814
|
i(this, "_handleEnded", (e) => {
|
|
811
815
|
const { originator: t } = e;
|
|
812
|
-
t ===
|
|
816
|
+
t === Ue && this._sessionEvents.trigger(ne, e), this._restoreSession();
|
|
813
817
|
});
|
|
814
|
-
this.JsSIP = e, this._sessionEvents = new
|
|
818
|
+
this.JsSIP = e, this._sessionEvents = new Oe(dt), this._uaEvents = new Oe(ht), this._cancelableConnect = new N(
|
|
815
819
|
this._connect,
|
|
816
820
|
{
|
|
817
821
|
moduleName: g,
|
|
@@ -830,7 +834,7 @@ class _s {
|
|
|
830
834
|
}), this._cancelableCall = new N(
|
|
831
835
|
this._call,
|
|
832
836
|
{ moduleName: g }
|
|
833
|
-
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(
|
|
837
|
+
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(v, this._handleShareState), this.onSession(Ae, this._handleNewInfo), this.on(X, this._handleSipEvent), this.onSession(A, this._handleEnded), this.onSession(P, this._handleEnded);
|
|
834
838
|
}
|
|
835
839
|
async register() {
|
|
836
840
|
return new Promise((e, t) => {
|
|
@@ -881,31 +885,32 @@ class _s {
|
|
|
881
885
|
userAgent: e,
|
|
882
886
|
sipServerUrl: n
|
|
883
887
|
}), _ = this._createUa(c), E = () => {
|
|
884
|
-
const
|
|
885
|
-
a(
|
|
888
|
+
const h = new Error("Telephony is not available");
|
|
889
|
+
a(h);
|
|
886
890
|
};
|
|
887
|
-
_.once(
|
|
888
|
-
const
|
|
889
|
-
_.removeAllListeners(), _.once(
|
|
891
|
+
_.once(u, E);
|
|
892
|
+
const d = () => {
|
|
893
|
+
_.removeAllListeners(), _.once(u, o), _.stop();
|
|
890
894
|
};
|
|
891
|
-
_.once(m,
|
|
895
|
+
_.once(m, d), _.start();
|
|
892
896
|
});
|
|
893
897
|
}
|
|
894
898
|
async replaceMediaStream(e, t) {
|
|
895
899
|
if (!this.session)
|
|
896
900
|
throw new Error("No session established");
|
|
897
|
-
|
|
901
|
+
const { contentHint: n } = t || {}, s = D(e, { contentHint: n });
|
|
902
|
+
return this.session.replaceMediaStream(s, t);
|
|
898
903
|
}
|
|
899
904
|
async askPermissionToEnableCam(e = {}) {
|
|
900
905
|
if (!this.session)
|
|
901
906
|
throw new Error("No session established");
|
|
902
|
-
const t = [
|
|
903
|
-
return this.session.sendInfo(
|
|
907
|
+
const t = [gn];
|
|
908
|
+
return this.session.sendInfo(Me, void 0, {
|
|
904
909
|
noTerminateWhenError: !0,
|
|
905
910
|
...e,
|
|
906
911
|
extraHeaders: t
|
|
907
912
|
}).catch((n) => {
|
|
908
|
-
if (
|
|
913
|
+
if (Mn(n))
|
|
909
914
|
throw n;
|
|
910
915
|
});
|
|
911
916
|
}
|
|
@@ -917,11 +922,11 @@ class _s {
|
|
|
917
922
|
stream: t,
|
|
918
923
|
presentationOptions: n,
|
|
919
924
|
options: s = {
|
|
920
|
-
callLimit:
|
|
925
|
+
callLimit: Fn
|
|
921
926
|
}
|
|
922
927
|
}) {
|
|
923
928
|
const o = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
924
|
-
return this._cancelableSendPresentationWithRepeatedCalls =
|
|
929
|
+
return this._cancelableSendPresentationWithRepeatedCalls = De({
|
|
925
930
|
targetFunction: o,
|
|
926
931
|
isComplete: a,
|
|
927
932
|
isRejectAsValid: !0,
|
|
@@ -944,57 +949,57 @@ class _s {
|
|
|
944
949
|
registerExpires: _ = 60 * 5,
|
|
945
950
|
// 5 minutes in sec
|
|
946
951
|
connectionRecoveryMinInterval: E = 2,
|
|
947
|
-
connectionRecoveryMaxInterval:
|
|
948
|
-
userAgent:
|
|
952
|
+
connectionRecoveryMaxInterval: d = 6,
|
|
953
|
+
userAgent: h
|
|
949
954
|
}) {
|
|
950
955
|
if (a && !t)
|
|
951
956
|
throw new Error("password is required for authorized connection");
|
|
952
|
-
const
|
|
957
|
+
const l = a && e ? e.trim() : `${pn()}`, T = In(o), C = T(l), S = new this.JsSIP.WebSocketInterface(n);
|
|
953
958
|
return {
|
|
954
959
|
configuration: {
|
|
955
960
|
password: t,
|
|
956
961
|
register: a,
|
|
957
|
-
uri:
|
|
958
|
-
display_name:
|
|
959
|
-
user_agent:
|
|
962
|
+
uri: C,
|
|
963
|
+
display_name: we(s),
|
|
964
|
+
user_agent: h,
|
|
960
965
|
sdp_semantics: "unified-plan",
|
|
961
|
-
sockets: [
|
|
966
|
+
sockets: [S],
|
|
962
967
|
session_timers: c,
|
|
963
968
|
register_expires: _,
|
|
964
969
|
connection_recovery_min_interval: E,
|
|
965
|
-
connection_recovery_max_interval:
|
|
970
|
+
connection_recovery_max_interval: d
|
|
966
971
|
},
|
|
967
972
|
helpers: {
|
|
968
|
-
socket:
|
|
973
|
+
socket: S,
|
|
969
974
|
getSipServerUrl: T
|
|
970
975
|
}
|
|
971
976
|
};
|
|
972
977
|
}
|
|
973
978
|
async _sendPresentation(e, t, {
|
|
974
|
-
maxBitrate: n =
|
|
979
|
+
maxBitrate: n = ct,
|
|
975
980
|
degradationPreference: s = "maintain-resolution",
|
|
976
981
|
isNeedReinvite: o = !0,
|
|
977
982
|
isP2P: a = !1,
|
|
978
983
|
contentHint: c = "detail"
|
|
979
984
|
}) {
|
|
980
|
-
const _ =
|
|
985
|
+
const _ = D(t, { contentHint: c });
|
|
981
986
|
this._streamPresentationCurrent = _;
|
|
982
|
-
const E = a ? [
|
|
987
|
+
const E = a ? [un] : [ln], d = e.sendInfo(O, void 0, {
|
|
983
988
|
extraHeaders: E
|
|
984
989
|
}).then(async () => e.startPresentation(
|
|
985
990
|
_,
|
|
986
991
|
o,
|
|
987
992
|
s
|
|
988
993
|
)).then(async () => {
|
|
989
|
-
const { connection:
|
|
990
|
-
if (!
|
|
994
|
+
const { connection: h } = this;
|
|
995
|
+
if (!h || n === void 0)
|
|
991
996
|
return;
|
|
992
|
-
const
|
|
993
|
-
await
|
|
994
|
-
}).then(() => t).catch((
|
|
995
|
-
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(
|
|
997
|
+
const l = h.getSenders();
|
|
998
|
+
await Hn(l, t, n);
|
|
999
|
+
}).then(() => t).catch((h) => {
|
|
1000
|
+
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(L, h), h;
|
|
996
1001
|
});
|
|
997
|
-
return this.promisePendingStartPresentation =
|
|
1002
|
+
return this.promisePendingStartPresentation = d, d.finally(() => {
|
|
998
1003
|
this.promisePendingStartPresentation = void 0;
|
|
999
1004
|
});
|
|
1000
1005
|
}
|
|
@@ -1025,7 +1030,7 @@ class _s {
|
|
|
1025
1030
|
}
|
|
1026
1031
|
async sendMustStopPresentation(e) {
|
|
1027
1032
|
await e.sendInfo(O, void 0, {
|
|
1028
|
-
extraHeaders: [
|
|
1033
|
+
extraHeaders: [Sn]
|
|
1029
1034
|
});
|
|
1030
1035
|
}
|
|
1031
1036
|
async stopPresentation({
|
|
@@ -1034,11 +1039,11 @@ class _s {
|
|
|
1034
1039
|
this._cancelSendPresentationWithRepeatedCalls();
|
|
1035
1040
|
const t = this._streamPresentationCurrent;
|
|
1036
1041
|
let n = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
1037
|
-
const s = e ? [
|
|
1042
|
+
const s = e ? [Cn] : [Tn], o = this.establishedSession;
|
|
1038
1043
|
return o && t && (n = n.then(async () => o.sendInfo(O, void 0, {
|
|
1039
1044
|
extraHeaders: s
|
|
1040
1045
|
})).then(async () => o.stopPresentation(t)).catch((a) => {
|
|
1041
|
-
throw this._sessionEvents.trigger(
|
|
1046
|
+
throw this._sessionEvents.trigger(L, a), a;
|
|
1042
1047
|
})), !o && t && this._sessionEvents.trigger(Re, t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
1043
1048
|
this._resetPresentation();
|
|
1044
1049
|
});
|
|
@@ -1111,7 +1116,7 @@ class _s {
|
|
|
1111
1116
|
if (!this.connection)
|
|
1112
1117
|
return;
|
|
1113
1118
|
const t = this.connection.getReceivers().map(({ track: n }) => n);
|
|
1114
|
-
return
|
|
1119
|
+
return fn(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1115
1120
|
}
|
|
1116
1121
|
get connection() {
|
|
1117
1122
|
var t;
|
|
@@ -1186,29 +1191,29 @@ class _s {
|
|
|
1186
1191
|
this._cancelableAnswer.cancelRequest(), this._cancelableSendDTMF.cancelRequest();
|
|
1187
1192
|
}
|
|
1188
1193
|
async waitChannels() {
|
|
1189
|
-
return this.waitSession(
|
|
1194
|
+
return this.waitSession(y);
|
|
1190
1195
|
}
|
|
1191
1196
|
async waitSyncMediaState() {
|
|
1192
|
-
return this.waitSession(
|
|
1197
|
+
return this.waitSession(b);
|
|
1193
1198
|
}
|
|
1194
1199
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1195
1200
|
if (!this.session)
|
|
1196
1201
|
throw new Error("No session established");
|
|
1197
|
-
const n = `${
|
|
1202
|
+
const n = `${ve}: ${e}`, s = `${ye}: ${t}`, o = [
|
|
1198
1203
|
n,
|
|
1199
1204
|
s
|
|
1200
1205
|
];
|
|
1201
|
-
return this.session.sendInfo(
|
|
1206
|
+
return this.session.sendInfo(Jt, void 0, { extraHeaders: o });
|
|
1202
1207
|
}
|
|
1203
1208
|
async sendMediaState({ cam: e, mic: t }, n = {}) {
|
|
1204
1209
|
if (!this.session)
|
|
1205
1210
|
throw new Error("No session established");
|
|
1206
|
-
const s = `${
|
|
1211
|
+
const s = `${rn}: currentstate`, o = `${an}: ${Number(e)}`, a = `${cn}: ${Number(t)}`, c = [
|
|
1207
1212
|
s,
|
|
1208
1213
|
o,
|
|
1209
1214
|
a
|
|
1210
1215
|
];
|
|
1211
|
-
return this.session.sendInfo(
|
|
1216
|
+
return this.session.sendInfo(zt, void 0, {
|
|
1212
1217
|
noTerminateWhenError: !0,
|
|
1213
1218
|
...n,
|
|
1214
1219
|
extraHeaders: c
|
|
@@ -1217,8 +1222,8 @@ class _s {
|
|
|
1217
1222
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1218
1223
|
if (!this.session)
|
|
1219
1224
|
throw new Error("No session established");
|
|
1220
|
-
const c = [`${
|
|
1221
|
-
return this.session.sendInfo(
|
|
1225
|
+
const c = [`${on}: ${e === "mic" ? 0 : 1}`];
|
|
1226
|
+
return this.session.sendInfo(Qt, void 0, {
|
|
1222
1227
|
noTerminateWhenError: !0,
|
|
1223
1228
|
...t,
|
|
1224
1229
|
extraHeaders: c
|
|
@@ -1236,12 +1241,12 @@ class _s {
|
|
|
1236
1241
|
}
|
|
1237
1242
|
}
|
|
1238
1243
|
export {
|
|
1239
|
-
|
|
1244
|
+
Vt as B,
|
|
1240
1245
|
I as E,
|
|
1241
|
-
|
|
1242
|
-
|
|
1246
|
+
yt as N,
|
|
1247
|
+
He as R,
|
|
1243
1248
|
_s as S,
|
|
1244
|
-
|
|
1249
|
+
ht as U,
|
|
1245
1250
|
is as a,
|
|
1246
1251
|
os as b,
|
|
1247
1252
|
ss as c,
|
|
@@ -1250,8 +1255,8 @@ export {
|
|
|
1250
1255
|
k as f,
|
|
1251
1256
|
q as g,
|
|
1252
1257
|
cs as h,
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1258
|
+
Rn as i,
|
|
1259
|
+
dt as j,
|
|
1260
|
+
W as l,
|
|
1261
|
+
Ln as s
|
|
1257
1262
|
};
|