sip-connector 11.1.0 → 11.2.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-zEWljwQJ.js → SipConnector-BqK7EICM.js} +223 -217
- package/dist/SipConnector-_gw-GKlW.cjs +1 -0
- package/dist/SipConnector.d.ts +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/eventNames.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +161 -160
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/resolveOnMoveToParticipants.d.ts +3 -0
- package/package.json +5 -5
- package/dist/SipConnector-5B3QzrjB.cjs +0 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (s, e, t) =>
|
|
4
|
-
import { CancelableRequest as g, isCanceledError as
|
|
5
|
-
import
|
|
6
|
-
import { repeatedCallsAsync as
|
|
1
|
+
var It = Object.defineProperty;
|
|
2
|
+
var ft = (s, e, t) => e in s ? It(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var o = (s, e, t) => ft(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CancelableRequest as g, isCanceledError as mt } from "@krivega/cancelable-promise";
|
|
5
|
+
import Me from "events-constructor";
|
|
6
|
+
import { repeatedCallsAsync as ve } from "repeated-calls";
|
|
7
7
|
import V from "debug";
|
|
8
|
-
const
|
|
8
|
+
const Pt = "Connection Error", We = "Request Timeout", Ot = "SIP Failure Code", Dt = "Internal Error", pt = "Busy", ke = "Rejected", Mt = "Redirected", vt = "Unavailable", yt = "Not Found", wt = "Address Incomplete", bt = "Incompatible SDP", Ut = "Missing SDP", Lt = "Authentication Error", Be = "Terminated", Ht = "WebRTC Error", qe = "Canceled", Wt = "No Answer", kt = "Expires", Bt = "No ACK", qt = "Dialog Error", Ft = "User Denied Media Access", xt = "Bad Media Description", Vt = "RTP Timeout", Es = /* @__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" })), Y = "incomingCall", G = "declinedIncomingCall", $ = "failedIncomingCall", J = "terminatedIncomingCall", W = "connecting", m = "connected", N = "disconnected", v = "newRTCSession", P = "registered", X = "unregistered", O = "registrationFailed",
|
|
10
|
+
ADDRESS_INCOMPLETE: wt,
|
|
11
|
+
AUTHENTICATION_ERROR: Lt,
|
|
12
|
+
BAD_MEDIA_DESCRIPTION: xt,
|
|
13
|
+
BUSY: pt,
|
|
14
|
+
BYE: Be,
|
|
15
|
+
CANCELED: qe,
|
|
16
|
+
CONNECTION_ERROR: Pt,
|
|
17
|
+
DIALOG_ERROR: qt,
|
|
18
|
+
EXPIRES: kt,
|
|
19
|
+
INCOMPATIBLE_SDP: bt,
|
|
20
|
+
INTERNAL_ERROR: Dt,
|
|
21
|
+
MISSING_SDP: Ut,
|
|
22
|
+
NOT_FOUND: yt,
|
|
23
|
+
NO_ACK: Bt,
|
|
24
|
+
NO_ANSWER: Wt,
|
|
25
|
+
REDIRECTED: Mt,
|
|
26
|
+
REJECTED: ke,
|
|
27
|
+
REQUEST_TIMEOUT: We,
|
|
28
|
+
RTP_TIMEOUT: Vt,
|
|
29
|
+
SIP_FAILURE_CODE: Ot,
|
|
30
|
+
UNAVAILABLE: vt,
|
|
31
|
+
USER_DENIED_MEDIA_ACCESS: Ft,
|
|
32
|
+
WEBRTC_ERROR: Ht
|
|
33
|
+
}, Symbol.toStringTag, { value: "Module" })), Y = "incomingCall", G = "declinedIncomingCall", $ = "failedIncomingCall", J = "terminatedIncomingCall", W = "connecting", m = "connected", N = "disconnected", v = "newRTCSession", P = "registered", X = "unregistered", O = "registrationFailed", Fe = "newMessage", z = "sipEvent", Q = "availableSecondRemoteStream", j = "notAvailableSecondRemoteStream", K = "mustStopPresentation", y = "shareState", Z = "enterRoom", ee = "useLicense", te = "peerconnection:confirmed", ne = "peerconnection:ontrack", w = "channels", se = "channels:notify", ie = "ended:fromserver", oe = "main-cam-control", re = "admin-stop-main-cam", ae = "admin-start-main-cam", ce = "admin-stop-mic", _e = "admin-start-mic", b = "admin-force-sync-media-state", Ee = "participant:added-to-list-moderators", de = "participant:removed-from-list-moderators", he = "participant:move-request-to-stream", le = "participant:move-request-to-spectators", Te = "participant:move-request-to-participants", ue = "participation:accepting-word-request", Se = "participation:cancelling-word-request", Ne = "webcast:started", ge = "webcast:stopped", Ce = "account:changed", Ae = "account:deleted", Re = "conference:participant-token-issued", D = "ended", xe = "sending", Ve = "reinvite", Ye = "replaces", Ge = "refer", $e = "progress", Je = "accepted", U = "confirmed", L = "peerconnection", R = "failed", Xe = "muted", ze = "unmuted", Ie = "newDTMF", fe = "newInfo", Qe = "hold", je = "unhold", Ke = "update", Ze = "sdp", et = "icecandidate", tt = "getusermediafailed", nt = "peerconnection:createofferfailed", st = "peerconnection:createanswerfailed", it = "peerconnection:setlocaldescriptionfailed", ot = "peerconnection:setremotedescriptionfailed", rt = "presentation:start", at = "presentation:started", ct = "presentation:end", me = "presentation:ended", H = "presentation:failed", _t = "SPECTATOR", Et = "PARTICIPANT", dt = 1e6, ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
34
34
|
__proto__: null,
|
|
35
|
-
ACCEPTED:
|
|
36
|
-
ACCOUNT_CHANGED:
|
|
37
|
-
ACCOUNT_DELETED:
|
|
35
|
+
ACCEPTED: Je,
|
|
36
|
+
ACCOUNT_CHANGED: Ce,
|
|
37
|
+
ACCOUNT_DELETED: Ae,
|
|
38
38
|
ADMIN_FORCE_SYNC_MEDIA_STATE: b,
|
|
39
39
|
ADMIN_START_MAIN_CAM: ae,
|
|
40
40
|
ADMIN_START_MIC: _e,
|
|
@@ -43,7 +43,7 @@ const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code",
|
|
|
43
43
|
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: Q,
|
|
44
44
|
CHANNELS: w,
|
|
45
45
|
CHANNELS_NOTIFY: se,
|
|
46
|
-
CONFERENCE_PARTICIPANT_TOKEN_ISSUED:
|
|
46
|
+
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Re,
|
|
47
47
|
CONFIRMED: U,
|
|
48
48
|
CONNECTED: m,
|
|
49
49
|
CONNECTING: W,
|
|
@@ -54,73 +54,75 @@ const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code",
|
|
|
54
54
|
ENTER_ROOM: Z,
|
|
55
55
|
FAILED: R,
|
|
56
56
|
FAILED_INCOMING_CALL: $,
|
|
57
|
-
GET_USER_MEDIA_FAILED:
|
|
58
|
-
HOLD:
|
|
59
|
-
ICE_CANDIDATE:
|
|
57
|
+
GET_USER_MEDIA_FAILED: tt,
|
|
58
|
+
HOLD: Qe,
|
|
59
|
+
ICE_CANDIDATE: et,
|
|
60
60
|
INCOMING_CALL: Y,
|
|
61
61
|
MAIN_CAM_CONTROL: oe,
|
|
62
62
|
MUST_STOP_PRESENTATION_EVENT: K,
|
|
63
|
-
MUTED:
|
|
64
|
-
NEW_DTMF:
|
|
65
|
-
NEW_INFO:
|
|
66
|
-
NEW_MESSAGE:
|
|
63
|
+
MUTED: Xe,
|
|
64
|
+
NEW_DTMF: Ie,
|
|
65
|
+
NEW_INFO: fe,
|
|
66
|
+
NEW_MESSAGE: Fe,
|
|
67
67
|
NEW_RTC_SESSION: v,
|
|
68
68
|
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: j,
|
|
69
|
-
ONE_MEGABIT_IN_BITS:
|
|
69
|
+
ONE_MEGABIT_IN_BITS: dt,
|
|
70
|
+
PARTICIPANT: Et,
|
|
70
71
|
PARTICIPANT_ADDED_TO_LIST_MODERATORS: Ee,
|
|
72
|
+
PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS: Te,
|
|
71
73
|
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: le,
|
|
72
74
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM: he,
|
|
73
75
|
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: de,
|
|
74
|
-
PARTICIPATION_ACCEPTING_WORD_REQUEST:
|
|
75
|
-
PARTICIPATION_CANCELLING_WORD_REQUEST:
|
|
76
|
+
PARTICIPATION_ACCEPTING_WORD_REQUEST: ue,
|
|
77
|
+
PARTICIPATION_CANCELLING_WORD_REQUEST: Se,
|
|
76
78
|
PEER_CONNECTION: L,
|
|
77
79
|
PEER_CONNECTION_CONFIRMED: te,
|
|
78
|
-
PEER_CONNECTION_CREATE_ANSWER_FAILED:
|
|
79
|
-
PEER_CONNECTION_CREATE_OFFER_FAILED:
|
|
80
|
+
PEER_CONNECTION_CREATE_ANSWER_FAILED: st,
|
|
81
|
+
PEER_CONNECTION_CREATE_OFFER_FAILED: nt,
|
|
80
82
|
PEER_CONNECTION_ONTRACK: ne,
|
|
81
|
-
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:
|
|
82
|
-
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:
|
|
83
|
-
PRESENTATION_END:
|
|
84
|
-
PRESENTATION_ENDED:
|
|
83
|
+
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: it,
|
|
84
|
+
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: ot,
|
|
85
|
+
PRESENTATION_END: ct,
|
|
86
|
+
PRESENTATION_ENDED: me,
|
|
85
87
|
PRESENTATION_FAILED: H,
|
|
86
|
-
PRESENTATION_START:
|
|
87
|
-
PRESENTATION_STARTED:
|
|
88
|
-
PROGRESS:
|
|
89
|
-
REFER:
|
|
88
|
+
PRESENTATION_START: rt,
|
|
89
|
+
PRESENTATION_STARTED: at,
|
|
90
|
+
PROGRESS: $e,
|
|
91
|
+
REFER: Ge,
|
|
90
92
|
REGISTERED: P,
|
|
91
93
|
REGISTRATION_FAILED: O,
|
|
92
|
-
REINVITE:
|
|
93
|
-
REPLACES:
|
|
94
|
-
SDP:
|
|
95
|
-
SENDING:
|
|
94
|
+
REINVITE: Ve,
|
|
95
|
+
REPLACES: Ye,
|
|
96
|
+
SDP: Ze,
|
|
97
|
+
SENDING: xe,
|
|
96
98
|
SHARE_STATE: y,
|
|
97
99
|
SIP_EVENT: z,
|
|
98
|
-
SPECTATOR:
|
|
100
|
+
SPECTATOR: _t,
|
|
99
101
|
TERMINATED_INCOMING_CALL: J,
|
|
100
|
-
UNHOLD:
|
|
101
|
-
UNMUTED:
|
|
102
|
+
UNHOLD: je,
|
|
103
|
+
UNMUTED: ze,
|
|
102
104
|
UNREGISTERED: X,
|
|
103
|
-
UPDATE:
|
|
105
|
+
UPDATE: Ke,
|
|
104
106
|
USE_LICENSE: ee,
|
|
105
|
-
WEBCAST_STARTED:
|
|
106
|
-
WEBCAST_STOPPED:
|
|
107
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
107
|
+
WEBCAST_STARTED: Ne,
|
|
108
|
+
WEBCAST_STOPPED: ge
|
|
109
|
+
}, Symbol.toStringTag, { value: "Module" })), ht = [
|
|
108
110
|
Y,
|
|
109
111
|
G,
|
|
110
112
|
J,
|
|
111
113
|
$,
|
|
112
|
-
Te,
|
|
113
114
|
ue,
|
|
115
|
+
Se,
|
|
114
116
|
he,
|
|
115
117
|
se,
|
|
116
|
-
|
|
117
|
-
ge,
|
|
118
|
+
Re,
|
|
118
119
|
Ce,
|
|
119
|
-
|
|
120
|
+
Ae,
|
|
120
121
|
Ne,
|
|
122
|
+
ge,
|
|
121
123
|
Ee,
|
|
122
124
|
de
|
|
123
|
-
],
|
|
125
|
+
], Pe = [
|
|
124
126
|
W,
|
|
125
127
|
m,
|
|
126
128
|
N,
|
|
@@ -128,9 +130,9 @@ const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code",
|
|
|
128
130
|
P,
|
|
129
131
|
X,
|
|
130
132
|
O,
|
|
131
|
-
|
|
133
|
+
Fe,
|
|
132
134
|
z
|
|
133
|
-
],
|
|
135
|
+
], lt = [
|
|
134
136
|
Q,
|
|
135
137
|
j,
|
|
136
138
|
K,
|
|
@@ -147,24 +149,24 @@ const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code",
|
|
|
147
149
|
ce,
|
|
148
150
|
_e,
|
|
149
151
|
b,
|
|
150
|
-
le
|
|
151
|
-
|
|
152
|
+
le,
|
|
153
|
+
Te
|
|
154
|
+
], Oe = [
|
|
152
155
|
D,
|
|
153
156
|
W,
|
|
154
|
-
Fe,
|
|
155
157
|
xe,
|
|
156
158
|
Ve,
|
|
157
159
|
Ye,
|
|
158
160
|
Ge,
|
|
159
161
|
$e,
|
|
162
|
+
Je,
|
|
160
163
|
U,
|
|
161
164
|
L,
|
|
162
165
|
R,
|
|
163
|
-
Je,
|
|
164
166
|
Xe,
|
|
165
|
-
Re,
|
|
166
|
-
Ie,
|
|
167
167
|
ze,
|
|
168
|
+
Ie,
|
|
169
|
+
fe,
|
|
168
170
|
Qe,
|
|
169
171
|
je,
|
|
170
172
|
Ke,
|
|
@@ -177,27 +179,28 @@ const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code",
|
|
|
177
179
|
ot,
|
|
178
180
|
rt,
|
|
179
181
|
at,
|
|
180
|
-
|
|
182
|
+
ct,
|
|
183
|
+
me,
|
|
181
184
|
H
|
|
182
|
-
],
|
|
183
|
-
...
|
|
184
|
-
...
|
|
185
|
-
],
|
|
185
|
+
], Tt = [...Pe, ...ht], ut = [
|
|
186
|
+
...Oe,
|
|
187
|
+
...lt
|
|
188
|
+
], hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
186
189
|
__proto__: null,
|
|
187
|
-
SESSION_EVENT_NAMES:
|
|
188
|
-
SESSION_JSSIP_EVENT_NAMES:
|
|
189
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
190
|
-
UA_EVENT_NAMES:
|
|
191
|
-
UA_JSSIP_EVENT_NAMES:
|
|
192
|
-
UA_SYNTHETICS_EVENT_NAMES:
|
|
193
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
190
|
+
SESSION_EVENT_NAMES: ut,
|
|
191
|
+
SESSION_JSSIP_EVENT_NAMES: Oe,
|
|
192
|
+
SESSION_SYNTHETICS_EVENT_NAMES: lt,
|
|
193
|
+
UA_EVENT_NAMES: Tt,
|
|
194
|
+
UA_JSSIP_EVENT_NAMES: Pe,
|
|
195
|
+
UA_SYNTHETICS_EVENT_NAMES: ht
|
|
196
|
+
}, Symbol.toStringTag, { value: "Module" })), Yt = (s) => {
|
|
194
197
|
const e = [];
|
|
195
198
|
return s && e.push(`X-Vinteo-Remote: ${s}`), e;
|
|
196
|
-
},
|
|
197
|
-
V.enable(
|
|
198
|
-
},
|
|
199
|
-
V.enable(`-${
|
|
200
|
-
},
|
|
199
|
+
}, Gt = "content-type", $t = "x-webrtc-enter-room", p = "application/vinteo.webrtc.sharedesktop", Jt = "application/vinteo.webrtc.roomname", Xt = "application/vinteo.webrtc.channels", zt = "application/vinteo.webrtc.mediastate", Qt = "application/vinteo.webrtc.refusal", ye = "application/vinteo.webrtc.maincam", jt = "application/vinteo.webrtc.mic", Kt = "application/vinteo.webrtc.uselic", Zt = "X-WEBRTC-USE-LICENSE", en = "X-WEBRTC-PARTICIPANT-NAME", we = "X-WEBRTC-INPUT-CHANNELS", be = "X-WEBRTC-OUTPUT-CHANNELS", tn = "X-WEBRTC-MAINCAM", nn = "X-WEBRTC-MIC", Ue = "X-WEBRTC-SYNC", sn = "X-WEBRTC-MAINCAM-RESOLUTION", on = "X-WEBRTC-MEDIA-STATE", rn = "X-Vinteo-Media-Type", an = "X-Vinteo-MainCam-State", cn = "X-Vinteo-Mic-State", _n = "application/vinteo.webrtc.partstate", En = "X-WEBRTC-PARTSTATE", dn = "application/vinteo.webrtc.notify", hn = "X-VINTEO-NOTIFY", I = "x-webrtc-share-state", ln = `${I}: LETMESTARTPRESENTATION`, Tn = `${I}: STOPPRESENTATION`, St = "YOUCANRECEIVECONTENT", Nt = "CONTENTEND", gt = "YOUMUSTSTOPSENDCONTENT", un = `${I}: ${gt}`, Sn = `${I}: ${St}`, Nn = `${I}: ${Nt}`, gn = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Cn = `${gn}: LETMESTARTMAINCAM`, De = "sip-connector", B = V(De), ls = () => {
|
|
200
|
+
V.enable(De);
|
|
201
|
+
}, Ts = () => {
|
|
202
|
+
V.enable(`-${De}`);
|
|
203
|
+
}, An = (s, e) => {
|
|
201
204
|
s.getVideoTracks().forEach((n) => {
|
|
202
205
|
"contentHint" in n && n.contentHint !== e && (n.contentHint = e);
|
|
203
206
|
});
|
|
@@ -209,49 +212,49 @@ const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code",
|
|
|
209
212
|
if (!s || e === "recvonly" && t === "recvonly")
|
|
210
213
|
return;
|
|
211
214
|
const i = t === "recvonly" ? [] : s.getAudioTracks(), r = e === "recvonly" ? [] : s.getVideoTracks(), a = [...i, ...r], c = new MediaStream(a);
|
|
212
|
-
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" &&
|
|
215
|
+
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" && An(c, n), c;
|
|
213
216
|
};
|
|
214
|
-
var f = /* @__PURE__ */ ((s) => (s.PAUSE_MAIN_CAM = "PAUSEMAINCAM", s.RESUME_MAIN_CAM = "RESUMEMAINCAM", s.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", s.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", s.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", s))(f || {}), q = /* @__PURE__ */ ((s) => (s.ADMIN_STOP_MIC = "ADMINSTOPMIC", s.ADMIN_START_MIC = "ADMINSTARTMIC", s))(q || {}), F = /* @__PURE__ */ ((s) => (s.ADMIN_SYNC_FORCED = "1", s.ADMIN_SYNC_NOT_FORCED = "0", s))(F || {}),
|
|
215
|
-
function
|
|
217
|
+
var f = /* @__PURE__ */ ((s) => (s.PAUSE_MAIN_CAM = "PAUSEMAINCAM", s.RESUME_MAIN_CAM = "RESUMEMAINCAM", s.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", s.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", s.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", s))(f || {}), q = /* @__PURE__ */ ((s) => (s.ADMIN_STOP_MIC = "ADMINSTOPMIC", s.ADMIN_START_MIC = "ADMINSTARTMIC", s))(q || {}), F = /* @__PURE__ */ ((s) => (s.ADMIN_SYNC_FORCED = "1", s.ADMIN_SYNC_NOT_FORCED = "0", s))(F || {}), Rn = /* @__PURE__ */ ((s) => (s.AUDIO = "AUDIO", s.VIDEO = "VIDEO", s.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", s))(Rn || {});
|
|
218
|
+
function In(s) {
|
|
216
219
|
return (e) => `sip:${e}@${s}`;
|
|
217
220
|
}
|
|
218
|
-
const
|
|
221
|
+
const fn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, Le = (s) => s.trim().replaceAll(" ", "_"), mn = fn(1e5, 99999999), Pn = (s) => s.some((t) => {
|
|
219
222
|
const { kind: n } = t;
|
|
220
223
|
return n === "video";
|
|
221
|
-
}),
|
|
224
|
+
}), On = "Error decline with 603", Dn = 1006, pn = (s) => typeof s == "object" && s !== null && "code" in s && s.code === Dn, Mn = (s) => s.message === On, vn = (s, e) => s.find((t) => t.track && e.getTracks().includes(t.track)), yn = (s, e) => (s.degradationPreference = e.degradationPreference, s), wn = (s, e) => {
|
|
222
225
|
s.encodings === void 0 && (s.encodings = []);
|
|
223
226
|
for (let t = s.encodings.length; t < e; t += 1)
|
|
224
227
|
s.encodings.push({});
|
|
225
228
|
return s;
|
|
226
|
-
},
|
|
227
|
-
if (
|
|
229
|
+
}, Ct = (s) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== s, bn = Ct(), Un = (s, e) => {
|
|
230
|
+
if (bn(s, e))
|
|
228
231
|
return s;
|
|
229
|
-
},
|
|
230
|
-
const t = s.maxBitrate, n =
|
|
232
|
+
}, Ln = (s, e) => {
|
|
233
|
+
const t = s.maxBitrate, n = Un(e, t);
|
|
231
234
|
return n !== void 0 && (s.maxBitrate = n), s;
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
),
|
|
235
|
-
const t = s === void 0 ? void 0 : Math.max(s,
|
|
236
|
-
if (t !== void 0 &&
|
|
235
|
+
}, At = 1, Hn = Ct(
|
|
236
|
+
At
|
|
237
|
+
), Wn = (s, e) => {
|
|
238
|
+
const t = s === void 0 ? void 0 : Math.max(s, At);
|
|
239
|
+
if (t !== void 0 && Hn(
|
|
237
240
|
t,
|
|
238
241
|
e
|
|
239
242
|
))
|
|
240
243
|
return t;
|
|
241
|
-
},
|
|
242
|
-
const t = s.scaleResolutionDownBy, n =
|
|
244
|
+
}, kn = (s, e) => {
|
|
245
|
+
const t = s.scaleResolutionDownBy, n = Wn(
|
|
243
246
|
e,
|
|
244
247
|
t
|
|
245
248
|
);
|
|
246
249
|
return n !== void 0 && (s.scaleResolutionDownBy = n), s;
|
|
247
|
-
},
|
|
250
|
+
}, Bn = (s, e) => {
|
|
248
251
|
var n;
|
|
249
252
|
const t = ((n = e.encodings) == null ? void 0 : n.length) ?? 0;
|
|
250
|
-
return
|
|
253
|
+
return wn(s, t), s.encodings.forEach((i, r) => {
|
|
251
254
|
const a = ((e == null ? void 0 : e.encodings) ?? [])[r], c = a == null ? void 0 : a.maxBitrate, E = a == null ? void 0 : a.scaleResolutionDownBy;
|
|
252
|
-
|
|
255
|
+
Ln(i, c), kn(i, E);
|
|
253
256
|
}), s;
|
|
254
|
-
},
|
|
257
|
+
}, qn = (s, e) => {
|
|
255
258
|
var t, n, i, r, a, c, E, d;
|
|
256
259
|
if (((t = s.codecs) == null ? void 0 : t.length) !== ((n = e.codecs) == null ? void 0 : n.length))
|
|
257
260
|
return !0;
|
|
@@ -269,13 +272,13 @@ const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, Ue = (s) =>
|
|
|
269
272
|
if (JSON.stringify(s.encodings[_]) !== JSON.stringify(e.encodings[_]))
|
|
270
273
|
return !0;
|
|
271
274
|
return s.rtcp.cname !== e.rtcp.cname || s.rtcp.reducedSize !== e.rtcp.reducedSize || s.degradationPreference !== e.degradationPreference;
|
|
272
|
-
},
|
|
275
|
+
}, Fn = async (s, e) => {
|
|
273
276
|
const t = s.getParameters(), n = JSON.parse(JSON.stringify(t));
|
|
274
|
-
|
|
275
|
-
const i =
|
|
277
|
+
Bn(t, e), yn(t, e);
|
|
278
|
+
const i = qn(n, t);
|
|
276
279
|
return i && await s.setParameters(t), { parameters: t, isChanged: i };
|
|
277
|
-
},
|
|
278
|
-
const { isChanged: n, parameters: i } = await
|
|
280
|
+
}, xn = async (s, e, t) => {
|
|
281
|
+
const { isChanged: n, parameters: i } = await Fn(s, {
|
|
279
282
|
encodings: [
|
|
280
283
|
{
|
|
281
284
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -284,15 +287,15 @@ const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, Ue = (s) =>
|
|
|
284
287
|
]
|
|
285
288
|
});
|
|
286
289
|
return n && t && t(i), { isChanged: n, parameters: i };
|
|
287
|
-
},
|
|
288
|
-
const n =
|
|
290
|
+
}, Vn = async (s, e, t) => {
|
|
291
|
+
const n = vn(s, e);
|
|
289
292
|
if (n)
|
|
290
|
-
return
|
|
291
|
-
},
|
|
293
|
+
return xn(n, { maxBitrate: t });
|
|
294
|
+
}, Yn = 486, Gn = 487, x = "local", He = "remote", $n = 3, Jn = 1, us = (s = new Error()) => {
|
|
292
295
|
const { originator: e, cause: t } = s;
|
|
293
|
-
return
|
|
294
|
-
}, C = "SipConnector",
|
|
295
|
-
class
|
|
296
|
+
return mt(s) ? !0 : typeof t == "string" ? t === We || t === ke || e === x && (t === qe || t === Be) : !1;
|
|
297
|
+
}, C = "SipConnector", Xn = "channels", zn = "WebcastStarted", Qn = "WebcastStopped", jn = "accountChanged", Kn = "accountDeleted", Zn = "addedToListModerators", es = "removedFromListModerators", ts = "ParticipationRequestAccepted", ns = "ParticipationRequestRejected", ss = "ParticipantMovedToWebcast", is = "ConferenceParticipantTokenIssued";
|
|
298
|
+
class Ss {
|
|
296
299
|
constructor({ JsSIP: e }) {
|
|
297
300
|
o(this, "_isRegisterConfig", !1);
|
|
298
301
|
o(this, "_connectionConfiguration", {});
|
|
@@ -336,7 +339,7 @@ class Ts {
|
|
|
336
339
|
}
|
|
337
340
|
return this.register();
|
|
338
341
|
});
|
|
339
|
-
o(this, "declineToIncomingCall", async ({ statusCode: e =
|
|
342
|
+
o(this, "declineToIncomingCall", async ({ statusCode: e = Gn } = {}) => new Promise((t, n) => {
|
|
340
343
|
if (!this.isAvailableIncomingCall) {
|
|
341
344
|
n(new Error("no incomingSession"));
|
|
342
345
|
return;
|
|
@@ -344,17 +347,17 @@ class Ts {
|
|
|
344
347
|
const i = this.incomingSession, r = this.remoteCallerData;
|
|
345
348
|
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(G, r), t(i.terminate({ status_code: e }));
|
|
346
349
|
}));
|
|
347
|
-
o(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode:
|
|
350
|
+
o(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Yn }));
|
|
348
351
|
o(this, "removeIncomingSession", () => {
|
|
349
352
|
delete this.incomingSession;
|
|
350
353
|
});
|
|
351
|
-
o(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t =
|
|
354
|
+
o(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = $n } = {}) => {
|
|
352
355
|
const n = async () => this._cancelableConnect.request(e), i = (r) => {
|
|
353
356
|
var d;
|
|
354
|
-
const c = !!((d = this.ua) != null && d.isConnected()) && this.hasEqualConnectionConfiguration(e), E = !!r && !
|
|
357
|
+
const c = !!((d = this.ua) != null && d.isConnected()) && this.hasEqualConnectionConfiguration(e), E = !!r && !pn(r);
|
|
355
358
|
return c || E;
|
|
356
359
|
};
|
|
357
|
-
return this._cancelableConnectWithRepeatedCalls =
|
|
360
|
+
return this._cancelableConnectWithRepeatedCalls = ve({
|
|
358
361
|
targetFunction: n,
|
|
359
362
|
isComplete: i,
|
|
360
363
|
callLimit: t,
|
|
@@ -370,7 +373,7 @@ class Ts {
|
|
|
370
373
|
});
|
|
371
374
|
});
|
|
372
375
|
o(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
373
|
-
if (e ===
|
|
376
|
+
if (e === He) {
|
|
374
377
|
this.incomingSession = t;
|
|
375
378
|
const n = this.remoteCallerData;
|
|
376
379
|
t.on(R, (i) => {
|
|
@@ -423,8 +426,8 @@ class Ts {
|
|
|
423
426
|
userAgent: _
|
|
424
427
|
});
|
|
425
428
|
return this.getSipServerUrl = S.getSipServerUrl, this.socket = S.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!h, this.ua = this._createUa({ ...u, remoteAddress: r, extraHeaders: T }), this._uaEvents.eachTriggers((A, k) => {
|
|
426
|
-
const
|
|
427
|
-
|
|
429
|
+
const pe = Pe.find((Rt) => Rt === k);
|
|
430
|
+
pe && this.ua && this.ua.on(pe, A);
|
|
428
431
|
}), this.ua;
|
|
429
432
|
});
|
|
430
433
|
o(this, "_createUa", ({
|
|
@@ -432,7 +435,7 @@ class Ts {
|
|
|
432
435
|
extraHeaders: t = [],
|
|
433
436
|
...n
|
|
434
437
|
}) => {
|
|
435
|
-
const i = new this.JsSIP.UA(n), a = [...e ?
|
|
438
|
+
const i = new this.JsSIP.UA(n), a = [...e ? Yt(e) : [], ...t];
|
|
436
439
|
return a.length > 0 && i.registrator().setExtraHeaders(a), i;
|
|
437
440
|
});
|
|
438
441
|
o(this, "_start", async () => new Promise((e, t) => {
|
|
@@ -459,7 +462,7 @@ class Ts {
|
|
|
459
462
|
return;
|
|
460
463
|
}
|
|
461
464
|
let a = !1, c = !1;
|
|
462
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = r.set("display_name",
|
|
465
|
+
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = r.set("display_name", Le(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = r.set("password", t), this._connectionConfiguration.password = t);
|
|
463
466
|
const E = a || c;
|
|
464
467
|
c && this.isRegisterConfig ? this.register().then(() => {
|
|
465
468
|
n(E);
|
|
@@ -541,7 +544,7 @@ class Ts {
|
|
|
541
544
|
return;
|
|
542
545
|
}
|
|
543
546
|
this._sessionEvents.eachTriggers((u, S) => {
|
|
544
|
-
const A =
|
|
547
|
+
const A = Oe.find((k) => k === S);
|
|
545
548
|
A && h.on(A, u);
|
|
546
549
|
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(_).catch((u) => {
|
|
547
550
|
l(u);
|
|
@@ -594,7 +597,7 @@ class Ts {
|
|
|
594
597
|
n(new Error("No session established"));
|
|
595
598
|
return;
|
|
596
599
|
}
|
|
597
|
-
this.onceSession(
|
|
600
|
+
this.onceSession(Ie, ({ originator: r }) => {
|
|
598
601
|
r === x && t();
|
|
599
602
|
}), i.sendDTMF(e, {
|
|
600
603
|
duration: 120,
|
|
@@ -616,22 +619,22 @@ class Ts {
|
|
|
616
619
|
});
|
|
617
620
|
o(this, "_handleShareState", (e) => {
|
|
618
621
|
switch (e) {
|
|
619
|
-
case
|
|
622
|
+
case St: {
|
|
620
623
|
this._sessionEvents.trigger(Q, void 0);
|
|
621
624
|
break;
|
|
622
625
|
}
|
|
623
|
-
case
|
|
626
|
+
case Nt: {
|
|
624
627
|
this._sessionEvents.trigger(j, void 0);
|
|
625
628
|
break;
|
|
626
629
|
}
|
|
627
|
-
case
|
|
630
|
+
case gt: {
|
|
628
631
|
this._sessionEvents.trigger(K, void 0);
|
|
629
632
|
break;
|
|
630
633
|
}
|
|
631
634
|
}
|
|
632
635
|
});
|
|
633
636
|
o(this, "_maybeTriggerChannels", (e) => {
|
|
634
|
-
const t = e.getHeader(
|
|
637
|
+
const t = e.getHeader(we), n = e.getHeader(be);
|
|
635
638
|
if (t && n) {
|
|
636
639
|
const i = {
|
|
637
640
|
inputChannels: t,
|
|
@@ -642,55 +645,55 @@ class Ts {
|
|
|
642
645
|
});
|
|
643
646
|
o(this, "_handleNotify", (e) => {
|
|
644
647
|
switch (e.cmd) {
|
|
645
|
-
case
|
|
648
|
+
case Xn: {
|
|
646
649
|
const t = e;
|
|
647
650
|
this._triggerChannelsNotify(t);
|
|
648
651
|
break;
|
|
649
652
|
}
|
|
650
|
-
case
|
|
653
|
+
case zn: {
|
|
651
654
|
const t = e;
|
|
652
655
|
this._triggerWebcastStartedNotify(t);
|
|
653
656
|
break;
|
|
654
657
|
}
|
|
655
|
-
case
|
|
658
|
+
case Qn: {
|
|
656
659
|
const t = e;
|
|
657
660
|
this._triggerWebcastStoppedNotify(t);
|
|
658
661
|
break;
|
|
659
662
|
}
|
|
660
|
-
case
|
|
663
|
+
case Zn: {
|
|
661
664
|
const t = e;
|
|
662
665
|
this._triggerAddedToListModeratorsNotify(t);
|
|
663
666
|
break;
|
|
664
667
|
}
|
|
665
|
-
case
|
|
668
|
+
case es: {
|
|
666
669
|
const t = e;
|
|
667
670
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
668
671
|
break;
|
|
669
672
|
}
|
|
670
|
-
case
|
|
673
|
+
case ts: {
|
|
671
674
|
const t = e;
|
|
672
675
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
673
676
|
break;
|
|
674
677
|
}
|
|
675
|
-
case
|
|
678
|
+
case ns: {
|
|
676
679
|
const t = e;
|
|
677
680
|
this._triggerParticipationCancellingWordRequest(t);
|
|
678
681
|
break;
|
|
679
682
|
}
|
|
680
|
-
case
|
|
683
|
+
case ss: {
|
|
681
684
|
const t = e;
|
|
682
685
|
this._triggerParticipantMoveRequestToStream(t);
|
|
683
686
|
break;
|
|
684
687
|
}
|
|
685
|
-
case
|
|
688
|
+
case jn: {
|
|
686
689
|
this._triggerAccountChangedNotify();
|
|
687
690
|
break;
|
|
688
691
|
}
|
|
689
|
-
case
|
|
692
|
+
case Kn: {
|
|
690
693
|
this._triggerAccountDeletedNotify();
|
|
691
694
|
break;
|
|
692
695
|
}
|
|
693
|
-
case
|
|
696
|
+
case is: {
|
|
694
697
|
const t = e;
|
|
695
698
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
696
699
|
break;
|
|
@@ -721,20 +724,20 @@ class Ts {
|
|
|
721
724
|
conference: e,
|
|
722
725
|
type: t
|
|
723
726
|
};
|
|
724
|
-
this._uaEvents.trigger(
|
|
727
|
+
this._uaEvents.trigger(Ne, n);
|
|
725
728
|
});
|
|
726
729
|
o(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
|
|
727
730
|
const n = {
|
|
728
731
|
conference: e,
|
|
729
732
|
type: t
|
|
730
733
|
};
|
|
731
|
-
this._uaEvents.trigger(
|
|
734
|
+
this._uaEvents.trigger(ge, n);
|
|
732
735
|
});
|
|
733
736
|
o(this, "_triggerAccountChangedNotify", () => {
|
|
734
|
-
this._uaEvents.trigger(
|
|
737
|
+
this._uaEvents.trigger(Ce, void 0);
|
|
735
738
|
});
|
|
736
739
|
o(this, "_triggerAccountDeletedNotify", () => {
|
|
737
|
-
this._uaEvents.trigger(
|
|
740
|
+
this._uaEvents.trigger(Ae, void 0);
|
|
738
741
|
});
|
|
739
742
|
o(this, "_triggerConferenceParticipantTokenIssued", ({
|
|
740
743
|
body: { conference: e, participant: t, jwt: n }
|
|
@@ -745,7 +748,7 @@ class Ts {
|
|
|
745
748
|
jwt: n
|
|
746
749
|
};
|
|
747
750
|
this._uaEvents.trigger(
|
|
748
|
-
|
|
751
|
+
Re,
|
|
749
752
|
i
|
|
750
753
|
);
|
|
751
754
|
});
|
|
@@ -762,7 +765,7 @@ class Ts {
|
|
|
762
765
|
const t = {
|
|
763
766
|
conference: e
|
|
764
767
|
};
|
|
765
|
-
this._uaEvents.trigger(
|
|
768
|
+
this._uaEvents.trigger(ue, t);
|
|
766
769
|
});
|
|
767
770
|
o(this, "_triggerParticipationCancellingWordRequest", ({
|
|
768
771
|
body: { conference: e }
|
|
@@ -770,7 +773,7 @@ class Ts {
|
|
|
770
773
|
const t = {
|
|
771
774
|
conference: e
|
|
772
775
|
};
|
|
773
|
-
this._uaEvents.trigger(
|
|
776
|
+
this._uaEvents.trigger(Se, t);
|
|
774
777
|
});
|
|
775
778
|
o(this, "_triggerParticipantMoveRequestToStream", ({
|
|
776
779
|
body: { conference: e }
|
|
@@ -781,18 +784,19 @@ class Ts {
|
|
|
781
784
|
this._uaEvents.trigger(he, t);
|
|
782
785
|
});
|
|
783
786
|
o(this, "_triggerEnterRoom", (e) => {
|
|
784
|
-
const t = e.getHeader(
|
|
787
|
+
const t = e.getHeader($t), n = e.getHeader(en);
|
|
785
788
|
this._sessionEvents.trigger(Z, { room: t, participantName: n });
|
|
786
789
|
});
|
|
787
790
|
o(this, "_triggerShareState", (e) => {
|
|
788
791
|
const t = e.getHeader(I);
|
|
789
792
|
this._sessionEvents.trigger(y, t);
|
|
790
793
|
});
|
|
791
|
-
o(this, "
|
|
792
|
-
|
|
794
|
+
o(this, "_maybeTriggerParticipantMoveRequest", (e) => {
|
|
795
|
+
const t = e.getHeader(En);
|
|
796
|
+
t === _t && this._sessionEvents.trigger(le, void 0), t === Et && this._sessionEvents.trigger(Te, void 0);
|
|
793
797
|
});
|
|
794
798
|
o(this, "_triggerMainCamControl", (e) => {
|
|
795
|
-
const t = e.getHeader(
|
|
799
|
+
const t = e.getHeader(tn), n = e.getHeader(Ue), i = n === F.ADMIN_SYNC_FORCED;
|
|
796
800
|
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
797
801
|
this._sessionEvents.trigger(ae, { isSyncForced: i });
|
|
798
802
|
return;
|
|
@@ -802,32 +806,32 @@ class Ts {
|
|
|
802
806
|
return;
|
|
803
807
|
}
|
|
804
808
|
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(b, { isSyncForced: i });
|
|
805
|
-
const r = e.getHeader(
|
|
809
|
+
const r = e.getHeader(sn);
|
|
806
810
|
this._sessionEvents.trigger(oe, {
|
|
807
811
|
mainCam: t,
|
|
808
812
|
resolutionMainCam: r
|
|
809
813
|
});
|
|
810
814
|
});
|
|
811
815
|
o(this, "_triggerMicControl", (e) => {
|
|
812
|
-
const t = e.getHeader(
|
|
816
|
+
const t = e.getHeader(nn), i = e.getHeader(Ue) === F.ADMIN_SYNC_FORCED;
|
|
813
817
|
t === q.ADMIN_START_MIC ? this._sessionEvents.trigger(_e, { isSyncForced: i }) : t === q.ADMIN_STOP_MIC && this._sessionEvents.trigger(ce, { isSyncForced: i });
|
|
814
818
|
});
|
|
815
819
|
o(this, "_triggerUseLicense", (e) => {
|
|
816
|
-
const t = e.getHeader(
|
|
820
|
+
const t = e.getHeader(Zt);
|
|
817
821
|
this._sessionEvents.trigger(ee, t);
|
|
818
822
|
});
|
|
819
823
|
o(this, "_handleNewInfo", (e) => {
|
|
820
824
|
const { originator: t } = e;
|
|
821
825
|
if (t !== "remote")
|
|
822
826
|
return;
|
|
823
|
-
const { request: n } = e, i = n.getHeader(
|
|
827
|
+
const { request: n } = e, i = n.getHeader(Gt);
|
|
824
828
|
if (i)
|
|
825
829
|
switch (i) {
|
|
826
|
-
case
|
|
830
|
+
case Jt: {
|
|
827
831
|
this._triggerEnterRoom(n), this._maybeTriggerChannels(n);
|
|
828
832
|
break;
|
|
829
833
|
}
|
|
830
|
-
case
|
|
834
|
+
case dn: {
|
|
831
835
|
this._maybeHandleNotify(n);
|
|
832
836
|
break;
|
|
833
837
|
}
|
|
@@ -835,20 +839,20 @@ class Ts {
|
|
|
835
839
|
this._triggerShareState(n);
|
|
836
840
|
break;
|
|
837
841
|
}
|
|
838
|
-
case
|
|
842
|
+
case ye: {
|
|
839
843
|
this._triggerMainCamControl(n);
|
|
840
844
|
break;
|
|
841
845
|
}
|
|
842
|
-
case
|
|
846
|
+
case jt: {
|
|
843
847
|
this._triggerMicControl(n);
|
|
844
848
|
break;
|
|
845
849
|
}
|
|
846
|
-
case
|
|
850
|
+
case Kt: {
|
|
847
851
|
this._triggerUseLicense(n);
|
|
848
852
|
break;
|
|
849
853
|
}
|
|
850
|
-
case
|
|
851
|
-
this.
|
|
854
|
+
case _n: {
|
|
855
|
+
this._maybeTriggerParticipantMoveRequest(n);
|
|
852
856
|
break;
|
|
853
857
|
}
|
|
854
858
|
}
|
|
@@ -857,7 +861,7 @@ class Ts {
|
|
|
857
861
|
this._maybeHandleNotify(e);
|
|
858
862
|
});
|
|
859
863
|
o(this, "_maybeHandleNotify", (e) => {
|
|
860
|
-
const t = e.getHeader(
|
|
864
|
+
const t = e.getHeader(hn);
|
|
861
865
|
if (t) {
|
|
862
866
|
const n = JSON.parse(t);
|
|
863
867
|
this._handleNotify(n);
|
|
@@ -865,9 +869,9 @@ class Ts {
|
|
|
865
869
|
});
|
|
866
870
|
o(this, "_handleEnded", (e) => {
|
|
867
871
|
const { originator: t } = e;
|
|
868
|
-
t ===
|
|
872
|
+
t === He && this._sessionEvents.trigger(ie, e), this._restoreSession();
|
|
869
873
|
});
|
|
870
|
-
this.JsSIP = e, this._sessionEvents = new
|
|
874
|
+
this.JsSIP = e, this._sessionEvents = new Me(ut), this._uaEvents = new Me(Tt), this._cancelableConnect = new g(
|
|
871
875
|
this._connect,
|
|
872
876
|
{
|
|
873
877
|
moduleName: C,
|
|
@@ -886,7 +890,7 @@ class Ts {
|
|
|
886
890
|
}), this._cancelableCall = new g(
|
|
887
891
|
this._call,
|
|
888
892
|
{ moduleName: C }
|
|
889
|
-
), this._cancelableAnswer = new g(this._answer, { moduleName: C }), this._cancelableSendDTMF = new g(this._sendDTMF, { moduleName: C }), this.onSession(y, this._handleShareState), this.onSession(
|
|
893
|
+
), this._cancelableAnswer = new g(this._answer, { moduleName: C }), this._cancelableSendDTMF = new g(this._sendDTMF, { moduleName: C }), this.onSession(y, this._handleShareState), this.onSession(fe, this._handleNewInfo), this.on(z, this._handleSipEvent), this.onSession(R, this._handleEnded), this.onSession(D, this._handleEnded);
|
|
890
894
|
}
|
|
891
895
|
async register() {
|
|
892
896
|
return new Promise((e, t) => {
|
|
@@ -958,13 +962,13 @@ class Ts {
|
|
|
958
962
|
async askPermissionToEnableCam(e = {}) {
|
|
959
963
|
if (!this.session)
|
|
960
964
|
throw new Error("No session established");
|
|
961
|
-
const t = [
|
|
962
|
-
return this.session.sendInfo(
|
|
965
|
+
const t = [Cn];
|
|
966
|
+
return this.session.sendInfo(ye, void 0, {
|
|
963
967
|
noTerminateWhenError: !0,
|
|
964
968
|
...e,
|
|
965
969
|
extraHeaders: t
|
|
966
970
|
}).catch((n) => {
|
|
967
|
-
if (
|
|
971
|
+
if (Mn(n))
|
|
968
972
|
throw n;
|
|
969
973
|
});
|
|
970
974
|
}
|
|
@@ -976,11 +980,11 @@ class Ts {
|
|
|
976
980
|
stream: t,
|
|
977
981
|
presentationOptions: n,
|
|
978
982
|
options: i = {
|
|
979
|
-
callLimit:
|
|
983
|
+
callLimit: Jn
|
|
980
984
|
}
|
|
981
985
|
}) {
|
|
982
986
|
const r = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
983
|
-
return this._cancelableSendPresentationWithRepeatedCalls =
|
|
987
|
+
return this._cancelableSendPresentationWithRepeatedCalls = ve({
|
|
984
988
|
targetFunction: r,
|
|
985
989
|
isComplete: a,
|
|
986
990
|
isRejectAsValid: !0,
|
|
@@ -1008,13 +1012,13 @@ class Ts {
|
|
|
1008
1012
|
}) {
|
|
1009
1013
|
if (a && !t)
|
|
1010
1014
|
throw new Error("password is required for authorized connection");
|
|
1011
|
-
const h = a && e ? e.trim() : `${
|
|
1015
|
+
const h = a && e ? e.trim() : `${mn()}`, T = In(r), u = T(h), S = new this.JsSIP.WebSocketInterface(n);
|
|
1012
1016
|
return {
|
|
1013
1017
|
configuration: {
|
|
1014
1018
|
password: t,
|
|
1015
1019
|
register: a,
|
|
1016
1020
|
uri: u,
|
|
1017
|
-
display_name:
|
|
1021
|
+
display_name: Le(i),
|
|
1018
1022
|
user_agent: l,
|
|
1019
1023
|
sdp_semantics: "unified-plan",
|
|
1020
1024
|
sockets: [S],
|
|
@@ -1030,7 +1034,7 @@ class Ts {
|
|
|
1030
1034
|
};
|
|
1031
1035
|
}
|
|
1032
1036
|
async _sendPresentation(e, t, {
|
|
1033
|
-
maxBitrate: n =
|
|
1037
|
+
maxBitrate: n = dt,
|
|
1034
1038
|
isNeedReinvite: i = !0,
|
|
1035
1039
|
isP2P: r = !1,
|
|
1036
1040
|
contentHint: a = "detail",
|
|
@@ -1039,7 +1043,7 @@ class Ts {
|
|
|
1039
1043
|
}) {
|
|
1040
1044
|
const d = M(t, { contentHint: a });
|
|
1041
1045
|
this._streamPresentationCurrent = d;
|
|
1042
|
-
const _ = r ? [
|
|
1046
|
+
const _ = r ? [Sn] : [ln], l = e.sendInfo(p, void 0, {
|
|
1043
1047
|
extraHeaders: _
|
|
1044
1048
|
}).then(async () => e.startPresentation(d, i, {
|
|
1045
1049
|
sendEncodings: c,
|
|
@@ -1049,7 +1053,7 @@ class Ts {
|
|
|
1049
1053
|
if (!h || n === void 0)
|
|
1050
1054
|
return;
|
|
1051
1055
|
const T = h.getSenders();
|
|
1052
|
-
await
|
|
1056
|
+
await Vn(T, t, n);
|
|
1053
1057
|
}).then(() => t).catch((h) => {
|
|
1054
1058
|
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(H, h), h;
|
|
1055
1059
|
});
|
|
@@ -1086,7 +1090,7 @@ class Ts {
|
|
|
1086
1090
|
}
|
|
1087
1091
|
async sendMustStopPresentation(e) {
|
|
1088
1092
|
await e.sendInfo(p, void 0, {
|
|
1089
|
-
extraHeaders: [
|
|
1093
|
+
extraHeaders: [un]
|
|
1090
1094
|
});
|
|
1091
1095
|
}
|
|
1092
1096
|
async stopPresentation({
|
|
@@ -1095,12 +1099,12 @@ class Ts {
|
|
|
1095
1099
|
this._cancelSendPresentationWithRepeatedCalls();
|
|
1096
1100
|
const t = this._streamPresentationCurrent;
|
|
1097
1101
|
let n = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
1098
|
-
const i = e ? [
|
|
1102
|
+
const i = e ? [Nn] : [Tn], r = this.establishedSession;
|
|
1099
1103
|
return r && t && (n = n.then(async () => r.sendInfo(p, void 0, {
|
|
1100
1104
|
extraHeaders: i
|
|
1101
1105
|
})).then(async () => r.stopPresentation(t)).catch((a) => {
|
|
1102
1106
|
throw this._sessionEvents.trigger(H, a), a;
|
|
1103
|
-
})), !r && t && this._sessionEvents.trigger(
|
|
1107
|
+
})), !r && t && this._sessionEvents.trigger(me, t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
1104
1108
|
this._resetPresentation();
|
|
1105
1109
|
});
|
|
1106
1110
|
}
|
|
@@ -1174,7 +1178,7 @@ class Ts {
|
|
|
1174
1178
|
if (!this.connection)
|
|
1175
1179
|
return;
|
|
1176
1180
|
const t = this.connection.getReceivers().map(({ track: n }) => n);
|
|
1177
|
-
return
|
|
1181
|
+
return Pn(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1178
1182
|
}
|
|
1179
1183
|
get connection() {
|
|
1180
1184
|
var t;
|
|
@@ -1257,21 +1261,21 @@ class Ts {
|
|
|
1257
1261
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1258
1262
|
if (!this.session)
|
|
1259
1263
|
throw new Error("No session established");
|
|
1260
|
-
const n = `${
|
|
1264
|
+
const n = `${we}: ${e}`, i = `${be}: ${t}`, r = [
|
|
1261
1265
|
n,
|
|
1262
1266
|
i
|
|
1263
1267
|
];
|
|
1264
|
-
return this.session.sendInfo(
|
|
1268
|
+
return this.session.sendInfo(Xt, void 0, { extraHeaders: r });
|
|
1265
1269
|
}
|
|
1266
1270
|
async sendMediaState({ cam: e, mic: t }, n = {}) {
|
|
1267
1271
|
if (!this.session)
|
|
1268
1272
|
throw new Error("No session established");
|
|
1269
|
-
const i = `${
|
|
1273
|
+
const i = `${on}: currentstate`, r = `${an}: ${Number(e)}`, a = `${cn}: ${Number(t)}`, c = [
|
|
1270
1274
|
i,
|
|
1271
1275
|
r,
|
|
1272
1276
|
a
|
|
1273
1277
|
];
|
|
1274
|
-
return this.session.sendInfo(
|
|
1278
|
+
return this.session.sendInfo(zt, void 0, {
|
|
1275
1279
|
noTerminateWhenError: !0,
|
|
1276
1280
|
...n,
|
|
1277
1281
|
extraHeaders: c
|
|
@@ -1280,8 +1284,8 @@ class Ts {
|
|
|
1280
1284
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1281
1285
|
if (!this.session)
|
|
1282
1286
|
throw new Error("No session established");
|
|
1283
|
-
const c = [`${
|
|
1284
|
-
return this.session.sendInfo(
|
|
1287
|
+
const c = [`${rn}: ${e === "mic" ? 0 : 1}`];
|
|
1288
|
+
return this.session.sendInfo(Qt, void 0, {
|
|
1285
1289
|
noTerminateWhenError: !0,
|
|
1286
1290
|
...t,
|
|
1287
1291
|
extraHeaders: c
|
|
@@ -1299,23 +1303,25 @@ class Ts {
|
|
|
1299
1303
|
}
|
|
1300
1304
|
}
|
|
1301
1305
|
export {
|
|
1302
|
-
|
|
1306
|
+
xt as B,
|
|
1303
1307
|
f as E,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1308
|
+
yt as N,
|
|
1309
|
+
le as P,
|
|
1310
|
+
ke as R,
|
|
1311
|
+
Ss as S,
|
|
1312
|
+
Tt as U,
|
|
1313
|
+
Te as a,
|
|
1309
1314
|
ds as b,
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1315
|
+
Es as c,
|
|
1316
|
+
Ts as d,
|
|
1317
|
+
hs as e,
|
|
1318
|
+
ls as f,
|
|
1319
|
+
Fn as g,
|
|
1320
|
+
us as h,
|
|
1321
|
+
q as i,
|
|
1322
|
+
F as j,
|
|
1323
|
+
Rn as k,
|
|
1319
1324
|
B as l,
|
|
1320
|
-
|
|
1325
|
+
ut as m,
|
|
1326
|
+
xn as s
|
|
1321
1327
|
};
|