sip-connector 8.0.0 → 8.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-BA8w-WR5.cjs +1 -0
- package/dist/{SipConnector-4t573yj1.js → SipConnector-C5s0hhzA.js} +479 -436
- package/dist/SipConnector.d.ts +7 -0
- package/dist/__fixtures__/Session.mock.d.ts +9 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +113 -101
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/SipConnector-zjYmhYTk.cjs +0 -1
|
@@ -1,169 +1,168 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
import { CancelableRequest as
|
|
5
|
-
import
|
|
6
|
-
import { repeatedCallsAsync as
|
|
7
|
-
import
|
|
8
|
-
const mt = "Connection Error",
|
|
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
|
+
import Pe from "events-constructor";
|
|
6
|
+
import { repeatedCallsAsync as Oe } from "repeated-calls";
|
|
7
|
+
import B from "debug";
|
|
8
|
+
const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code", pt = "Internal Error", Pt = "Busy", Le = "Rejected", Ot = "Redirected", Dt = "Unavailable", Mt = "Not Found", vt = "Address Incomplete", yt = "Incompatible SDP", bt = "Missing SDP", wt = "Authentication Error", He = "Terminated", Ut = "WebRTC Error", We = "Canceled", Lt = "No Answer", Ht = "Expires", Wt = "No ACK", kt = "Dialog Error", qt = "User Denied Media Access", Ft = "Bad Media Description", Bt = "RTP Timeout", ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
9
|
__proto__: null,
|
|
10
10
|
ADDRESS_INCOMPLETE: vt,
|
|
11
|
-
AUTHENTICATION_ERROR:
|
|
11
|
+
AUTHENTICATION_ERROR: wt,
|
|
12
12
|
BAD_MEDIA_DESCRIPTION: Ft,
|
|
13
|
-
BUSY:
|
|
14
|
-
BYE:
|
|
15
|
-
CANCELED:
|
|
13
|
+
BUSY: Pt,
|
|
14
|
+
BYE: He,
|
|
15
|
+
CANCELED: We,
|
|
16
16
|
CONNECTION_ERROR: mt,
|
|
17
17
|
DIALOG_ERROR: kt,
|
|
18
18
|
EXPIRES: Ht,
|
|
19
19
|
INCOMPATIBLE_SDP: yt,
|
|
20
|
-
INTERNAL_ERROR:
|
|
21
|
-
MISSING_SDP:
|
|
20
|
+
INTERNAL_ERROR: pt,
|
|
21
|
+
MISSING_SDP: bt,
|
|
22
22
|
NOT_FOUND: Mt,
|
|
23
23
|
NO_ACK: Wt,
|
|
24
24
|
NO_ANSWER: Lt,
|
|
25
|
-
REDIRECTED:
|
|
26
|
-
REJECTED:
|
|
27
|
-
REQUEST_TIMEOUT:
|
|
25
|
+
REDIRECTED: Ot,
|
|
26
|
+
REJECTED: Le,
|
|
27
|
+
REQUEST_TIMEOUT: Ue,
|
|
28
28
|
RTP_TIMEOUT: Bt,
|
|
29
29
|
SIP_FAILURE_CODE: ft,
|
|
30
30
|
UNAVAILABLE: Dt,
|
|
31
31
|
USER_DENIED_MEDIA_ACCESS: qt,
|
|
32
32
|
WEBRTC_ERROR: Ut
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
33
|
+
}, Symbol.toStringTag, { value: "Module" })), V = "incomingCall", Y = "declinedIncomingCall", x = "failedIncomingCall", G = "terminatedIncomingCall", L = "connecting", m = "connected", S = "disconnected", D = "newRTCSession", f = "registered", $ = "unregistered", p = "registrationFailed", ke = "newMessage", X = "sipEvent", J = "availableSecondRemoteStream", z = "notAvailableSecondRemoteStream", Q = "mustStopPresentation", M = "shareState", j = "enterRoom", K = "useLicense", Z = "peerconnection:confirmed", ee = "peerconnection:ontrack", v = "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", y = "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", le = "participation:accepting-word-request", de = "participation:cancelling-word-request", Te = "webcast:started", Se = "webcast:stopped", ue = "account:changed", Ce = "account:deleted", Ne = "conference:participant-token-issued", P = "ended", qe = "sending", Fe = "reinvite", Be = "replaces", Ve = "refer", Ye = "progress", xe = "accepted", b = "confirmed", w = "peerconnection", A = "failed", Ge = "muted", $e = "unmuted", ge = "newDTMF", Ae = "newInfo", Xe = "hold", Je = "unhold", ze = "update", Qe = "sdp", je = "icecandidate", Ke = "getusermediafailed", Ze = "peerconnection:createofferfailed", et = "peerconnection:createanswerfailed", tt = "peerconnection:setlocaldescriptionfailed", nt = "peerconnection:setremotedescriptionfailed", st = "presentation:start", it = "presentation:started", rt = "presentation:end", Re = "presentation:ended", U = "presentation:failed", ot = "SPECTATOR", ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
34
34
|
__proto__: null,
|
|
35
|
-
ACCEPTED:
|
|
36
|
-
ACCOUNT_CHANGED:
|
|
37
|
-
ACCOUNT_DELETED:
|
|
35
|
+
ACCEPTED: xe,
|
|
36
|
+
ACCOUNT_CHANGED: ue,
|
|
37
|
+
ACCOUNT_DELETED: Ce,
|
|
38
38
|
ADMIN_FORCE_SYNC_MEDIA_STATE: y,
|
|
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: re,
|
|
40
|
+
ADMIN_START_MIC: ae,
|
|
41
|
+
ADMIN_STOP_MAIN_CAM: ie,
|
|
42
|
+
ADMIN_STOP_MIC: oe,
|
|
43
|
+
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: J,
|
|
44
44
|
CHANNELS: v,
|
|
45
|
-
CHANNELS_NOTIFY:
|
|
45
|
+
CHANNELS_NOTIFY: te,
|
|
46
46
|
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ne,
|
|
47
|
-
CONFIRMED:
|
|
47
|
+
CONFIRMED: b,
|
|
48
48
|
CONNECTED: m,
|
|
49
49
|
CONNECTING: L,
|
|
50
|
-
DECLINED_INCOMING_CALL:
|
|
50
|
+
DECLINED_INCOMING_CALL: Y,
|
|
51
51
|
DISCONNECTED: S,
|
|
52
|
-
ENDED:
|
|
53
|
-
ENDED_FROM_SERVER:
|
|
54
|
-
ENTER_ROOM:
|
|
52
|
+
ENDED: P,
|
|
53
|
+
ENDED_FROM_SERVER: ne,
|
|
54
|
+
ENTER_ROOM: j,
|
|
55
55
|
FAILED: A,
|
|
56
|
-
FAILED_INCOMING_CALL:
|
|
57
|
-
GET_USER_MEDIA_FAILED:
|
|
58
|
-
HOLD:
|
|
59
|
-
ICE_CANDIDATE:
|
|
60
|
-
INCOMING_CALL:
|
|
56
|
+
FAILED_INCOMING_CALL: x,
|
|
57
|
+
GET_USER_MEDIA_FAILED: Ke,
|
|
58
|
+
HOLD: Xe,
|
|
59
|
+
ICE_CANDIDATE: je,
|
|
60
|
+
INCOMING_CALL: V,
|
|
61
61
|
MAIN_CAM_CONTROL: se,
|
|
62
|
-
MUST_STOP_PRESENTATION_EVENT:
|
|
63
|
-
MUTED:
|
|
64
|
-
NEW_DTMF:
|
|
65
|
-
NEW_INFO:
|
|
66
|
-
NEW_MESSAGE:
|
|
62
|
+
MUST_STOP_PRESENTATION_EVENT: Q,
|
|
63
|
+
MUTED: Ge,
|
|
64
|
+
NEW_DTMF: ge,
|
|
65
|
+
NEW_INFO: Ae,
|
|
66
|
+
NEW_MESSAGE: ke,
|
|
67
67
|
NEW_RTC_SESSION: D,
|
|
68
|
-
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:
|
|
69
|
-
PARTICIPANT_ADDED_TO_LIST_MODERATORS:
|
|
70
|
-
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:
|
|
68
|
+
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: z,
|
|
69
|
+
PARTICIPANT_ADDED_TO_LIST_MODERATORS: ce,
|
|
70
|
+
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: he,
|
|
71
71
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
|
|
72
|
-
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:
|
|
73
|
-
PARTICIPATION_ACCEPTING_WORD_REQUEST:
|
|
72
|
+
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: _e,
|
|
73
|
+
PARTICIPATION_ACCEPTING_WORD_REQUEST: le,
|
|
74
74
|
PARTICIPATION_CANCELLING_WORD_REQUEST: de,
|
|
75
|
-
PEER_CONNECTION:
|
|
76
|
-
PEER_CONNECTION_CONFIRMED:
|
|
77
|
-
PEER_CONNECTION_CREATE_ANSWER_FAILED:
|
|
78
|
-
PEER_CONNECTION_CREATE_OFFER_FAILED:
|
|
79
|
-
PEER_CONNECTION_ONTRACK:
|
|
80
|
-
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:
|
|
81
|
-
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:
|
|
82
|
-
PRESENTATION_END:
|
|
83
|
-
PRESENTATION_ENDED:
|
|
75
|
+
PEER_CONNECTION: w,
|
|
76
|
+
PEER_CONNECTION_CONFIRMED: Z,
|
|
77
|
+
PEER_CONNECTION_CREATE_ANSWER_FAILED: et,
|
|
78
|
+
PEER_CONNECTION_CREATE_OFFER_FAILED: Ze,
|
|
79
|
+
PEER_CONNECTION_ONTRACK: ee,
|
|
80
|
+
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: tt,
|
|
81
|
+
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: nt,
|
|
82
|
+
PRESENTATION_END: rt,
|
|
83
|
+
PRESENTATION_ENDED: Re,
|
|
84
84
|
PRESENTATION_FAILED: U,
|
|
85
85
|
PRESENTATION_START: st,
|
|
86
|
-
PRESENTATION_STARTED:
|
|
87
|
-
PROGRESS:
|
|
88
|
-
REFER:
|
|
86
|
+
PRESENTATION_STARTED: it,
|
|
87
|
+
PROGRESS: Ye,
|
|
88
|
+
REFER: Ve,
|
|
89
89
|
REGISTERED: f,
|
|
90
|
-
REGISTRATION_FAILED:
|
|
91
|
-
REINVITE:
|
|
92
|
-
REPLACES:
|
|
93
|
-
SDP:
|
|
94
|
-
SENDING:
|
|
90
|
+
REGISTRATION_FAILED: p,
|
|
91
|
+
REINVITE: Fe,
|
|
92
|
+
REPLACES: Be,
|
|
93
|
+
SDP: Qe,
|
|
94
|
+
SENDING: qe,
|
|
95
95
|
SHARE_STATE: M,
|
|
96
|
-
SIP_EVENT:
|
|
97
|
-
SPECTATOR:
|
|
98
|
-
TERMINATED_INCOMING_CALL:
|
|
99
|
-
UNHOLD:
|
|
100
|
-
UNMUTED:
|
|
101
|
-
UNREGISTERED:
|
|
102
|
-
UPDATE:
|
|
103
|
-
USE_LICENSE:
|
|
104
|
-
WEBCAST_STARTED:
|
|
105
|
-
WEBCAST_STOPPED:
|
|
106
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
107
|
-
B,
|
|
96
|
+
SIP_EVENT: X,
|
|
97
|
+
SPECTATOR: ot,
|
|
98
|
+
TERMINATED_INCOMING_CALL: G,
|
|
99
|
+
UNHOLD: Je,
|
|
100
|
+
UNMUTED: $e,
|
|
101
|
+
UNREGISTERED: $,
|
|
102
|
+
UPDATE: ze,
|
|
103
|
+
USE_LICENSE: K,
|
|
104
|
+
WEBCAST_STARTED: Te,
|
|
105
|
+
WEBCAST_STOPPED: Se
|
|
106
|
+
}, Symbol.toStringTag, { value: "Module" })), at = [
|
|
108
107
|
V,
|
|
109
|
-
x,
|
|
110
108
|
Y,
|
|
111
|
-
|
|
109
|
+
G,
|
|
110
|
+
x,
|
|
111
|
+
le,
|
|
112
112
|
de,
|
|
113
113
|
Ee,
|
|
114
|
-
|
|
114
|
+
te,
|
|
115
115
|
Ne,
|
|
116
|
-
Se,
|
|
117
116
|
ue,
|
|
118
|
-
|
|
117
|
+
Ce,
|
|
119
118
|
Te,
|
|
120
|
-
|
|
121
|
-
ce
|
|
122
|
-
|
|
119
|
+
Se,
|
|
120
|
+
ce,
|
|
121
|
+
_e
|
|
122
|
+
], Ie = [
|
|
123
123
|
L,
|
|
124
124
|
m,
|
|
125
125
|
S,
|
|
126
126
|
D,
|
|
127
127
|
f,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
],
|
|
133
|
-
X,
|
|
128
|
+
$,
|
|
129
|
+
p,
|
|
130
|
+
ke,
|
|
131
|
+
X
|
|
132
|
+
], ct = [
|
|
134
133
|
J,
|
|
135
134
|
z,
|
|
136
|
-
M,
|
|
137
135
|
Q,
|
|
136
|
+
M,
|
|
138
137
|
j,
|
|
139
138
|
K,
|
|
140
139
|
Z,
|
|
140
|
+
ee,
|
|
141
141
|
v,
|
|
142
|
-
te,
|
|
143
|
-
se,
|
|
144
|
-
ie,
|
|
145
142
|
ne,
|
|
143
|
+
se,
|
|
146
144
|
re,
|
|
145
|
+
ie,
|
|
147
146
|
oe,
|
|
147
|
+
ae,
|
|
148
148
|
y,
|
|
149
|
-
|
|
150
|
-
],
|
|
151
|
-
|
|
149
|
+
he
|
|
150
|
+
], me = [
|
|
151
|
+
P,
|
|
152
152
|
L,
|
|
153
|
-
ke,
|
|
154
153
|
qe,
|
|
155
154
|
Fe,
|
|
156
155
|
Be,
|
|
157
156
|
Ve,
|
|
158
157
|
Ye,
|
|
159
|
-
|
|
158
|
+
xe,
|
|
160
159
|
b,
|
|
160
|
+
w,
|
|
161
161
|
A,
|
|
162
|
-
xe,
|
|
163
162
|
Ge,
|
|
164
|
-
Ce,
|
|
165
|
-
ge,
|
|
166
163
|
$e,
|
|
164
|
+
ge,
|
|
165
|
+
Ae,
|
|
167
166
|
Xe,
|
|
168
167
|
Je,
|
|
169
168
|
ze,
|
|
@@ -173,77 +172,78 @@ const mt = "Connection Error", be = "Request Timeout", ft = "SIP Failure Code",
|
|
|
173
172
|
Ze,
|
|
174
173
|
et,
|
|
175
174
|
tt,
|
|
176
|
-
st,
|
|
177
175
|
nt,
|
|
176
|
+
st,
|
|
178
177
|
it,
|
|
179
|
-
|
|
178
|
+
rt,
|
|
179
|
+
Re,
|
|
180
180
|
U
|
|
181
|
-
],
|
|
182
|
-
...
|
|
183
|
-
...
|
|
184
|
-
],
|
|
181
|
+
], _t = [...Ie, ...at], Et = [
|
|
182
|
+
...me,
|
|
183
|
+
...ct
|
|
184
|
+
], ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
185
185
|
__proto__: null,
|
|
186
186
|
SESSION_EVENT_NAMES: Et,
|
|
187
|
-
SESSION_JSSIP_EVENT_NAMES:
|
|
188
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
189
|
-
UA_EVENT_NAMES:
|
|
190
|
-
UA_JSSIP_EVENT_NAMES:
|
|
191
|
-
UA_SYNTHETICS_EVENT_NAMES:
|
|
187
|
+
SESSION_JSSIP_EVENT_NAMES: me,
|
|
188
|
+
SESSION_SYNTHETICS_EVENT_NAMES: ct,
|
|
189
|
+
UA_EVENT_NAMES: _t,
|
|
190
|
+
UA_JSSIP_EVENT_NAMES: Ie,
|
|
191
|
+
UA_SYNTHETICS_EVENT_NAMES: at
|
|
192
192
|
}, Symbol.toStringTag, { value: "Module" })), Vt = (r) => {
|
|
193
193
|
const e = [];
|
|
194
194
|
return r && e.push(`X-Vinteo-Remote: ${r}`), e;
|
|
195
|
-
}, Yt = "content-type", xt = "x-webrtc-enter-room",
|
|
196
|
-
|
|
197
|
-
},
|
|
198
|
-
|
|
195
|
+
}, 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", De = "application/vinteo.webrtc.maincam", zt = "application/vinteo.webrtc.mic", Qt = "application/vinteo.webrtc.uselic", jt = "X-WEBRTC-USE-LICENSE", Kt = "X-WEBRTC-PARTICIPANT-NAME", Me = "X-WEBRTC-INPUT-CHANNELS", ve = "X-WEBRTC-OUTPUT-CHANNELS", Zt = "X-WEBRTC-MAINCAM", en = "X-WEBRTC-MIC", ye = "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`, ht = "YOUCANRECEIVECONTENT", lt = "CONTENTEND", dt = "YOUMUSTSTOPSENDCONTENT", dn = `${R}: ${dt}`, Tn = `${R}: ${ht}`, Sn = `${R}: ${lt}`, un = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Cn = `${un}: LETMESTARTMAINCAM`, fe = "sip-connector", H = B(fe), is = () => {
|
|
196
|
+
B.enable(fe);
|
|
197
|
+
}, rs = () => {
|
|
198
|
+
B.enable(`-${fe}`);
|
|
199
199
|
};
|
|
200
|
-
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 || {}),
|
|
201
|
-
function
|
|
200
|
+
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 || {}), Nn = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(Nn || {});
|
|
201
|
+
function gn(r) {
|
|
202
202
|
return (e) => `sip:${e}@${r}`;
|
|
203
203
|
}
|
|
204
|
-
const
|
|
204
|
+
const An = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, be = (r) => r.trim().replaceAll(" ", "_"), Rn = An(1e5, 99999999), W = (r, {
|
|
205
205
|
videoMode: e,
|
|
206
206
|
audioMode: t
|
|
207
207
|
} = {}) => {
|
|
208
208
|
if (!r || e === "recvonly" && t === "recvonly")
|
|
209
209
|
return;
|
|
210
|
-
const
|
|
210
|
+
const n = t === "recvonly" ? [] : r.getAudioTracks(), s = e === "recvonly" ? [] : r.getVideoTracks(), o = [...n, ...s], a = new MediaStream(o);
|
|
211
211
|
return a.getTracks = () => [...a.getAudioTracks(), ...a.getVideoTracks()], a;
|
|
212
|
-
},
|
|
213
|
-
const { kind:
|
|
214
|
-
return
|
|
215
|
-
}),
|
|
216
|
-
|
|
217
|
-
),
|
|
218
|
-
const t = r === void 0 ? void 0 : Math.max(r,
|
|
219
|
-
if (t !== void 0 &&
|
|
212
|
+
}, In = (r) => r.some((t) => {
|
|
213
|
+
const { kind: n } = t;
|
|
214
|
+
return n === "video";
|
|
215
|
+
}), mn = "Error decline with 603", fn = 1006, pn = (r) => typeof r == "object" && r !== null && "code" in r && r.code === fn, Pn = (r) => r.message === mn, On = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), Tt = 1, St = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, Dn = St(
|
|
216
|
+
Tt
|
|
217
|
+
), Mn = (r, e) => {
|
|
218
|
+
const t = r === void 0 ? void 0 : Math.max(r, Tt);
|
|
219
|
+
if (t !== void 0 && Dn(
|
|
220
220
|
t,
|
|
221
221
|
e
|
|
222
222
|
))
|
|
223
223
|
return t;
|
|
224
|
-
},
|
|
225
|
-
if (
|
|
224
|
+
}, vn = St(), yn = (r, e) => {
|
|
225
|
+
if (vn(r, e))
|
|
226
226
|
return r;
|
|
227
|
-
},
|
|
228
|
-
const
|
|
229
|
-
(
|
|
230
|
-
const [
|
|
227
|
+
}, bn = async (r, e, t) => {
|
|
228
|
+
const n = r.getParameters();
|
|
229
|
+
(n.encodings === void 0 || n.encodings.length === 0) && (n.encodings = [{}]);
|
|
230
|
+
const [s] = n.encodings, o = s.scaleResolutionDownBy, a = Mn(
|
|
231
231
|
e.scaleResolutionDownBy,
|
|
232
232
|
o
|
|
233
233
|
);
|
|
234
234
|
let c = !1;
|
|
235
|
-
a !== void 0 && (
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
},
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
return
|
|
242
|
-
},
|
|
235
|
+
a !== void 0 && (n.encodings[0].scaleResolutionDownBy = a, c = !0);
|
|
236
|
+
const _ = s.maxBitrate, E = yn(e.maxBitrate, _);
|
|
237
|
+
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 };
|
|
238
|
+
}, wn = async (r, e, t) => {
|
|
239
|
+
const n = On(r, e);
|
|
240
|
+
if (n)
|
|
241
|
+
return bn(n, { maxBitrate: t });
|
|
242
|
+
}, Un = 486, Ln = 487, F = "local", we = "remote", Hn = 3, Wn = 1, os = (r = new Error()) => {
|
|
243
243
|
const { originator: e, cause: t } = r;
|
|
244
|
-
return
|
|
245
|
-
}, g = "SipConnector",
|
|
246
|
-
class
|
|
244
|
+
return It(r) ? !0 : typeof t == "string" ? t === Ue || t === Le || e === F && (t === We || t === He) : !1;
|
|
245
|
+
}, g = "SipConnector", kn = "channels", qn = "WebcastStarted", Fn = "WebcastStopped", Bn = "accountChanged", Vn = "accountDeleted", Yn = "addedToListModerators", xn = "removedFromListModerators", Gn = "ParticipationRequestAccepted", $n = "ParticipationRequestRejected", Xn = "ParticipantMovedToWebcast", Jn = "ConferenceParticipantTokenIssued";
|
|
246
|
+
class as {
|
|
247
247
|
constructor({ JsSIP: e }) {
|
|
248
248
|
i(this, "_isRegisterConfig", !1);
|
|
249
249
|
i(this, "_connectionConfiguration", {});
|
|
@@ -253,6 +253,7 @@ class on {
|
|
|
253
253
|
i(this, "_uaEvents");
|
|
254
254
|
i(this, "_cancelableConnect");
|
|
255
255
|
i(this, "_cancelableConnectWithRepeatedCalls");
|
|
256
|
+
i(this, "_cancelableSendPresentationWithRepeatedCalls");
|
|
256
257
|
i(this, "_cancelableInitUa");
|
|
257
258
|
i(this, "_cancelableDisconnect");
|
|
258
259
|
i(this, "_cancelableSet");
|
|
@@ -282,31 +283,31 @@ class on {
|
|
|
282
283
|
try {
|
|
283
284
|
await this.unregister();
|
|
284
285
|
} catch (e) {
|
|
285
|
-
|
|
286
|
+
H("tryRegister", e);
|
|
286
287
|
}
|
|
287
288
|
return this.register();
|
|
288
289
|
});
|
|
289
|
-
i(this, "declineToIncomingCall", async ({ statusCode: e =
|
|
290
|
+
i(this, "declineToIncomingCall", async ({ statusCode: e = Ln } = {}) => new Promise((t, n) => {
|
|
290
291
|
if (!this.isAvailableIncomingCall) {
|
|
291
|
-
|
|
292
|
+
n(new Error("no incomingSession"));
|
|
292
293
|
return;
|
|
293
294
|
}
|
|
294
|
-
const
|
|
295
|
-
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(
|
|
295
|
+
const s = this.incomingSession, o = this.remoteCallerData;
|
|
296
|
+
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(Y, o), t(s.terminate({ status_code: e }));
|
|
296
297
|
}));
|
|
297
|
-
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode:
|
|
298
|
+
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Un }));
|
|
298
299
|
i(this, "removeIncomingSession", () => {
|
|
299
300
|
delete this.incomingSession;
|
|
300
301
|
});
|
|
301
|
-
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t =
|
|
302
|
-
let
|
|
303
|
-
const
|
|
302
|
+
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = Hn } = {}) => {
|
|
303
|
+
let n = !0;
|
|
304
|
+
const s = async () => (n = !1, this._cancelableConnect.request(e)), o = (a) => {
|
|
304
305
|
var h;
|
|
305
|
-
const c = !!((h = this.ua) != null && h.isConnected()),
|
|
306
|
-
return
|
|
306
|
+
const c = !!((h = this.ua) != null && h.isConnected()), _ = !n && c && this.hasEqualConnectionConfiguration(e), E = !!a && !pn(a);
|
|
307
|
+
return _ || E;
|
|
307
308
|
};
|
|
308
|
-
return this._cancelableConnectWithRepeatedCalls =
|
|
309
|
-
targetFunction:
|
|
309
|
+
return this._cancelableConnectWithRepeatedCalls = Oe({
|
|
310
|
+
targetFunction: s,
|
|
310
311
|
isComplete: o,
|
|
311
312
|
callLimit: t,
|
|
312
313
|
isRejectAsValid: !0,
|
|
@@ -322,95 +323,95 @@ class on {
|
|
|
322
323
|
i(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
323
324
|
if (e === we) {
|
|
324
325
|
this.incomingSession = t;
|
|
325
|
-
const
|
|
326
|
-
t.on(A, (
|
|
327
|
-
this.removeIncomingSession(),
|
|
328
|
-
}), this._uaEvents.trigger(
|
|
326
|
+
const n = this.remoteCallerData;
|
|
327
|
+
t.on(A, (s) => {
|
|
328
|
+
this.removeIncomingSession(), s.originator === F ? this._uaEvents.trigger(G, n) : this._uaEvents.trigger(x, n);
|
|
329
|
+
}), this._uaEvents.trigger(V, n);
|
|
329
330
|
}
|
|
330
331
|
});
|
|
331
332
|
i(this, "_connect", async (e) => this.initUa(e).then(async () => this._start()));
|
|
332
333
|
i(this, "_initUa", async ({
|
|
333
334
|
user: e,
|
|
334
335
|
password: t,
|
|
335
|
-
sipServerUrl:
|
|
336
|
-
sipWebSocketServerURL:
|
|
336
|
+
sipServerUrl: n,
|
|
337
|
+
sipWebSocketServerURL: s,
|
|
337
338
|
remoteAddress: o,
|
|
338
339
|
sessionTimers: a,
|
|
339
340
|
registerExpires: c,
|
|
340
|
-
connectionRecoveryMinInterval:
|
|
341
|
-
connectionRecoveryMaxInterval:
|
|
341
|
+
connectionRecoveryMinInterval: _,
|
|
342
|
+
connectionRecoveryMaxInterval: E,
|
|
342
343
|
userAgent: h,
|
|
343
|
-
displayName:
|
|
344
|
-
register:
|
|
344
|
+
displayName: d = "",
|
|
345
|
+
register: l = !1,
|
|
345
346
|
extraHeaders: T = []
|
|
346
347
|
}) => {
|
|
347
|
-
if (!s)
|
|
348
|
-
throw new Error("sipServerUrl is required");
|
|
349
348
|
if (!n)
|
|
349
|
+
throw new Error("sipServerUrl is required");
|
|
350
|
+
if (!s)
|
|
350
351
|
throw new Error("sipWebSocketServerURL is required");
|
|
351
|
-
if (
|
|
352
|
+
if (l && !e)
|
|
352
353
|
throw new Error("user is required for authorized connection");
|
|
353
|
-
if (
|
|
354
|
+
if (l && !t)
|
|
354
355
|
throw new Error("password is required for authorized connection");
|
|
355
356
|
this._connectionConfiguration = {
|
|
356
|
-
sipServerUrl:
|
|
357
|
-
displayName:
|
|
358
|
-
register:
|
|
357
|
+
sipServerUrl: n,
|
|
358
|
+
displayName: d,
|
|
359
|
+
register: l,
|
|
359
360
|
user: e,
|
|
360
361
|
password: t
|
|
361
362
|
};
|
|
362
|
-
const { configuration: u, helpers:
|
|
363
|
+
const { configuration: u, helpers: C } = this.createUaConfiguration({
|
|
363
364
|
user: e,
|
|
364
|
-
sipServerUrl:
|
|
365
|
-
sipWebSocketServerURL:
|
|
365
|
+
sipServerUrl: n,
|
|
366
|
+
sipWebSocketServerURL: s,
|
|
366
367
|
password: t,
|
|
367
|
-
displayName:
|
|
368
|
-
register:
|
|
368
|
+
displayName: d,
|
|
369
|
+
register: l,
|
|
369
370
|
sessionTimers: a,
|
|
370
371
|
registerExpires: c,
|
|
371
|
-
connectionRecoveryMinInterval:
|
|
372
|
-
connectionRecoveryMaxInterval:
|
|
372
|
+
connectionRecoveryMinInterval: _,
|
|
373
|
+
connectionRecoveryMaxInterval: E,
|
|
373
374
|
userAgent: h
|
|
374
375
|
});
|
|
375
|
-
this.getSipServerUrl =
|
|
376
|
-
const
|
|
377
|
-
|
|
376
|
+
this.getSipServerUrl = C.getSipServerUrl, this.socket = C.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l, this.ua = this._createUa(u), this._uaEvents.eachTriggers((Ct, Nt) => {
|
|
377
|
+
const pe = Ie.find((gt) => gt === Nt);
|
|
378
|
+
pe && this.ua && this.ua.on(pe, Ct);
|
|
378
379
|
});
|
|
379
|
-
const
|
|
380
|
-
return this.ua.registrator().setExtraHeaders(
|
|
380
|
+
const ut = [...Vt(o), ...T];
|
|
381
|
+
return this.ua.registrator().setExtraHeaders(ut), this.ua;
|
|
381
382
|
});
|
|
382
383
|
i(this, "_createUa", (e) => new this.JsSIP.UA(e));
|
|
383
384
|
i(this, "_start", async () => new Promise((e, t) => {
|
|
384
|
-
const { ua:
|
|
385
|
-
if (!
|
|
385
|
+
const { ua: n } = this;
|
|
386
|
+
if (!n) {
|
|
386
387
|
t(new Error("this.ua is not initialized"));
|
|
387
388
|
return;
|
|
388
389
|
}
|
|
389
|
-
const
|
|
390
|
-
c(), e(
|
|
391
|
-
}, o = (
|
|
392
|
-
c(), t(
|
|
390
|
+
const s = () => {
|
|
391
|
+
c(), e(n);
|
|
392
|
+
}, o = (_) => {
|
|
393
|
+
c(), t(_);
|
|
393
394
|
}, a = () => {
|
|
394
|
-
this.isRegisterConfig ? (this.on(f,
|
|
395
|
+
this.isRegisterConfig ? (this.on(f, s), this.on(p, o)) : this.on(m, s), this.on(S, o);
|
|
395
396
|
}, c = () => {
|
|
396
|
-
this.off(f,
|
|
397
|
+
this.off(f, s), this.off(p, o), this.off(m, s), this.off(S, o);
|
|
397
398
|
};
|
|
398
|
-
a(), this.on(D, this.handleNewRTCSession),
|
|
399
|
+
a(), this.on(D, this.handleNewRTCSession), n.start();
|
|
399
400
|
}));
|
|
400
|
-
i(this, "_set", async ({ displayName: e, password: t }) => new Promise((
|
|
401
|
+
i(this, "_set", async ({ displayName: e, password: t }) => new Promise((n, s) => {
|
|
401
402
|
const { ua: o } = this;
|
|
402
403
|
if (!o) {
|
|
403
|
-
|
|
404
|
+
s(new Error("this.ua is not initialized"));
|
|
404
405
|
return;
|
|
405
406
|
}
|
|
406
407
|
let a = !1, c = !1;
|
|
407
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name",
|
|
408
|
-
const
|
|
408
|
+
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name", be(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = o.set("password", t), this._connectionConfiguration.password = t);
|
|
409
|
+
const _ = a || c;
|
|
409
410
|
c && this.isRegisterConfig ? this.register().then(() => {
|
|
410
|
-
s(E);
|
|
411
|
-
}).catch((_) => {
|
|
412
411
|
n(_);
|
|
413
|
-
})
|
|
412
|
+
}).catch((E) => {
|
|
413
|
+
s(E);
|
|
414
|
+
}) : _ ? n(_) : s(new Error("nothing changed"));
|
|
414
415
|
}));
|
|
415
416
|
i(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
|
|
416
417
|
i(this, "_disconnect", async () => {
|
|
@@ -425,37 +426,37 @@ class on {
|
|
|
425
426
|
i(this, "_call", async ({
|
|
426
427
|
number: e,
|
|
427
428
|
mediaStream: t,
|
|
428
|
-
extraHeaders:
|
|
429
|
-
ontrack:
|
|
429
|
+
extraHeaders: n = [],
|
|
430
|
+
ontrack: s,
|
|
430
431
|
iceServers: o,
|
|
431
432
|
videoMode: a,
|
|
432
433
|
audioMode: c,
|
|
433
|
-
degradationPreference:
|
|
434
|
-
offerToReceiveAudio:
|
|
434
|
+
degradationPreference: _,
|
|
435
|
+
offerToReceiveAudio: E = !0,
|
|
435
436
|
offerToReceiveVideo: h = !0
|
|
436
|
-
}) => new Promise((
|
|
437
|
+
}) => new Promise((d, l) => {
|
|
437
438
|
const { ua: T } = this;
|
|
438
439
|
if (!T) {
|
|
439
|
-
|
|
440
|
+
l(new Error("this.ua is not initialized"));
|
|
440
441
|
return;
|
|
441
442
|
}
|
|
442
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack:
|
|
443
|
-
|
|
443
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(d).catch((u) => {
|
|
444
|
+
l(u);
|
|
444
445
|
}), this.session = T.call(this.getSipServerUrl(e), {
|
|
445
|
-
extraHeaders:
|
|
446
|
-
mediaStream:
|
|
446
|
+
extraHeaders: n,
|
|
447
|
+
mediaStream: W(t, {
|
|
447
448
|
videoMode: a,
|
|
448
449
|
audioMode: c
|
|
449
450
|
}),
|
|
450
451
|
eventHandlers: this._sessionEvents.triggers,
|
|
451
452
|
videoMode: a,
|
|
452
453
|
audioMode: c,
|
|
453
|
-
degradationPreference:
|
|
454
|
+
degradationPreference: _,
|
|
454
455
|
pcConfig: {
|
|
455
456
|
iceServers: o
|
|
456
457
|
},
|
|
457
458
|
rtcOfferConstraints: {
|
|
458
|
-
offerToReceiveAudio:
|
|
459
|
+
offerToReceiveAudio: E,
|
|
459
460
|
offerToReceiveVideo: h
|
|
460
461
|
}
|
|
461
462
|
});
|
|
@@ -463,77 +464,77 @@ class on {
|
|
|
463
464
|
i(this, "_answer", async ({
|
|
464
465
|
mediaStream: e,
|
|
465
466
|
ontrack: t,
|
|
466
|
-
extraHeaders:
|
|
467
|
-
iceServers:
|
|
467
|
+
extraHeaders: n = [],
|
|
468
|
+
iceServers: s,
|
|
468
469
|
videoMode: o,
|
|
469
470
|
audioMode: a,
|
|
470
471
|
degradationPreference: c
|
|
471
|
-
}) => new Promise((
|
|
472
|
+
}) => new Promise((_, E) => {
|
|
472
473
|
if (!this.isAvailableIncomingCall) {
|
|
473
|
-
|
|
474
|
+
E(new Error("no incomingSession"));
|
|
474
475
|
return;
|
|
475
476
|
}
|
|
476
477
|
this.session = this.incomingSession, this.removeIncomingSession();
|
|
477
478
|
const { session: h } = this;
|
|
478
479
|
if (!h) {
|
|
479
|
-
|
|
480
|
+
E(new Error("No session established"));
|
|
480
481
|
return;
|
|
481
482
|
}
|
|
482
|
-
this._sessionEvents.eachTriggers((
|
|
483
|
-
const u =
|
|
484
|
-
u && h.on(u,
|
|
485
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(
|
|
486
|
-
|
|
483
|
+
this._sessionEvents.eachTriggers((l, T) => {
|
|
484
|
+
const u = me.find((C) => C === T);
|
|
485
|
+
u && h.on(u, l);
|
|
486
|
+
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(_).catch((l) => {
|
|
487
|
+
E(l);
|
|
487
488
|
});
|
|
488
|
-
const
|
|
489
|
+
const d = W(e, {
|
|
489
490
|
videoMode: o,
|
|
490
491
|
audioMode: a
|
|
491
492
|
});
|
|
492
493
|
h.answer({
|
|
493
|
-
extraHeaders:
|
|
494
|
+
extraHeaders: n,
|
|
494
495
|
videoMode: o,
|
|
495
496
|
audioMode: a,
|
|
496
497
|
degradationPreference: c,
|
|
497
|
-
mediaStream:
|
|
498
|
+
mediaStream: d,
|
|
498
499
|
pcConfig: {
|
|
499
|
-
iceServers:
|
|
500
|
+
iceServers: s
|
|
500
501
|
}
|
|
501
502
|
});
|
|
502
503
|
}));
|
|
503
|
-
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t,
|
|
504
|
-
const
|
|
505
|
-
this.onSession(
|
|
504
|
+
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
|
|
505
|
+
const s = () => {
|
|
506
|
+
this.onSession(w, h), this.onSession(b, d);
|
|
506
507
|
}, o = () => {
|
|
507
|
-
this.offSession(
|
|
508
|
+
this.offSession(w, h), this.offSession(b, d);
|
|
508
509
|
}, a = () => {
|
|
509
|
-
this.onSession(A,
|
|
510
|
+
this.onSession(A, _), this.onSession(P, _);
|
|
510
511
|
}, c = () => {
|
|
511
|
-
this.offSession(A,
|
|
512
|
-
},
|
|
513
|
-
o(), c(),
|
|
512
|
+
this.offSession(A, _), this.offSession(P, _);
|
|
513
|
+
}, _ = (l) => {
|
|
514
|
+
o(), c(), n(l);
|
|
514
515
|
};
|
|
515
|
-
let
|
|
516
|
-
const h = ({ peerconnection:
|
|
517
|
-
|
|
518
|
-
this._sessionEvents.trigger(
|
|
516
|
+
let E;
|
|
517
|
+
const h = ({ peerconnection: l }) => {
|
|
518
|
+
E = l, E.ontrack = (T) => {
|
|
519
|
+
this._sessionEvents.trigger(ee, E), e && e(T);
|
|
519
520
|
};
|
|
520
|
-
},
|
|
521
|
-
|
|
521
|
+
}, d = () => {
|
|
522
|
+
E && this._sessionEvents.trigger(Z, E), o(), c(), t(E);
|
|
522
523
|
};
|
|
523
|
-
|
|
524
|
+
s(), a();
|
|
524
525
|
}));
|
|
525
526
|
i(this, "_restoreSession", () => {
|
|
526
|
-
this.
|
|
527
|
+
this._cancelRequestsAndResetPresentation(), delete this._connectionConfiguration.number, delete this.session, this._remoteStreams = {};
|
|
527
528
|
});
|
|
528
|
-
i(this, "_sendDTMF", async (e) => new Promise((t,
|
|
529
|
-
const { session:
|
|
530
|
-
if (!
|
|
531
|
-
|
|
529
|
+
i(this, "_sendDTMF", async (e) => new Promise((t, n) => {
|
|
530
|
+
const { session: s } = this;
|
|
531
|
+
if (!s) {
|
|
532
|
+
n(new Error("No session established"));
|
|
532
533
|
return;
|
|
533
534
|
}
|
|
534
|
-
this.onceSession(
|
|
535
|
-
o ===
|
|
536
|
-
}),
|
|
535
|
+
this.onceSession(ge, ({ originator: o }) => {
|
|
536
|
+
o === F && t();
|
|
537
|
+
}), s.sendDTMF(e, {
|
|
537
538
|
duration: 120,
|
|
538
539
|
interToneGap: 600
|
|
539
540
|
});
|
|
@@ -541,93 +542,99 @@ class on {
|
|
|
541
542
|
i(this, "_hangUpWithoutCancelRequests", async () => {
|
|
542
543
|
if (this.ua && this.session) {
|
|
543
544
|
const { session: e } = this;
|
|
544
|
-
if (this._streamPresentationCurrent
|
|
545
|
+
if (this._streamPresentationCurrent)
|
|
546
|
+
try {
|
|
547
|
+
await this.stopPresentation();
|
|
548
|
+
} catch (t) {
|
|
549
|
+
H("error stop presentation: ", t);
|
|
550
|
+
}
|
|
551
|
+
if (this._restoreSession(), !e.isEnded())
|
|
545
552
|
return e.terminateAsync();
|
|
546
553
|
}
|
|
547
554
|
});
|
|
548
555
|
i(this, "_handleShareState", (e) => {
|
|
549
556
|
switch (e) {
|
|
550
|
-
case _t: {
|
|
551
|
-
this._sessionEvents.trigger(X, void 0);
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
557
|
case ht: {
|
|
555
558
|
this._sessionEvents.trigger(J, void 0);
|
|
556
559
|
break;
|
|
557
560
|
}
|
|
558
|
-
case
|
|
561
|
+
case lt: {
|
|
559
562
|
this._sessionEvents.trigger(z, void 0);
|
|
560
563
|
break;
|
|
561
564
|
}
|
|
565
|
+
case dt: {
|
|
566
|
+
this._sessionEvents.trigger(Q, void 0);
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
562
569
|
}
|
|
563
570
|
});
|
|
564
571
|
i(this, "_maybeTriggerChannels", (e) => {
|
|
565
|
-
const t = e.getHeader(
|
|
566
|
-
if (t &&
|
|
567
|
-
const
|
|
572
|
+
const t = e.getHeader(Me), n = e.getHeader(ve);
|
|
573
|
+
if (t && n) {
|
|
574
|
+
const s = {
|
|
568
575
|
inputChannels: t,
|
|
569
|
-
outputChannels:
|
|
576
|
+
outputChannels: n
|
|
570
577
|
};
|
|
571
|
-
this._sessionEvents.trigger(v,
|
|
578
|
+
this._sessionEvents.trigger(v, s);
|
|
572
579
|
}
|
|
573
580
|
});
|
|
574
581
|
i(this, "_handleNotify", (e) => {
|
|
575
582
|
switch (e.cmd) {
|
|
576
|
-
case
|
|
583
|
+
case kn: {
|
|
577
584
|
const t = e;
|
|
578
585
|
this._triggerChannelsNotify(t);
|
|
579
586
|
break;
|
|
580
587
|
}
|
|
581
|
-
case
|
|
588
|
+
case qn: {
|
|
582
589
|
const t = e;
|
|
583
590
|
this._triggerWebcastStartedNotify(t);
|
|
584
591
|
break;
|
|
585
592
|
}
|
|
586
|
-
case
|
|
593
|
+
case Fn: {
|
|
587
594
|
const t = e;
|
|
588
595
|
this._triggerWebcastStoppedNotify(t);
|
|
589
596
|
break;
|
|
590
597
|
}
|
|
591
|
-
case
|
|
598
|
+
case Yn: {
|
|
592
599
|
const t = e;
|
|
593
600
|
this._triggerAddedToListModeratorsNotify(t);
|
|
594
601
|
break;
|
|
595
602
|
}
|
|
596
|
-
case
|
|
603
|
+
case xn: {
|
|
597
604
|
const t = e;
|
|
598
605
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
599
606
|
break;
|
|
600
607
|
}
|
|
601
|
-
case
|
|
608
|
+
case Gn: {
|
|
602
609
|
const t = e;
|
|
603
610
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
604
611
|
break;
|
|
605
612
|
}
|
|
606
|
-
case
|
|
613
|
+
case $n: {
|
|
607
614
|
const t = e;
|
|
608
615
|
this._triggerParticipationCancellingWordRequest(t);
|
|
609
616
|
break;
|
|
610
617
|
}
|
|
611
|
-
case
|
|
618
|
+
case Xn: {
|
|
612
619
|
const t = e;
|
|
613
620
|
this._triggerParticipantMoveRequestToStream(t);
|
|
614
621
|
break;
|
|
615
622
|
}
|
|
616
|
-
case
|
|
623
|
+
case Bn: {
|
|
617
624
|
this._triggerAccountChangedNotify();
|
|
618
625
|
break;
|
|
619
626
|
}
|
|
620
|
-
case
|
|
627
|
+
case Vn: {
|
|
621
628
|
this._triggerAccountDeletedNotify();
|
|
622
629
|
break;
|
|
623
630
|
}
|
|
624
|
-
case
|
|
631
|
+
case Jn: {
|
|
625
632
|
const t = e;
|
|
626
633
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
627
634
|
break;
|
|
628
635
|
}
|
|
629
636
|
default:
|
|
630
|
-
|
|
637
|
+
H("unknown cmd", e.cmd);
|
|
631
638
|
}
|
|
632
639
|
});
|
|
633
640
|
i(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
@@ -637,7 +644,7 @@ class on {
|
|
|
637
644
|
conference: e
|
|
638
645
|
};
|
|
639
646
|
this._uaEvents.trigger(
|
|
640
|
-
|
|
647
|
+
_e,
|
|
641
648
|
t
|
|
642
649
|
);
|
|
643
650
|
});
|
|
@@ -645,47 +652,47 @@ class on {
|
|
|
645
652
|
const t = {
|
|
646
653
|
conference: e
|
|
647
654
|
};
|
|
648
|
-
this._uaEvents.trigger(
|
|
655
|
+
this._uaEvents.trigger(ce, t);
|
|
649
656
|
});
|
|
650
657
|
i(this, "_triggerWebcastStartedNotify", ({ body: { conference: e, type: t } }) => {
|
|
651
|
-
const
|
|
658
|
+
const n = {
|
|
652
659
|
conference: e,
|
|
653
660
|
type: t
|
|
654
661
|
};
|
|
655
|
-
this._uaEvents.trigger(
|
|
662
|
+
this._uaEvents.trigger(Te, n);
|
|
656
663
|
});
|
|
657
664
|
i(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
|
|
658
|
-
const
|
|
665
|
+
const n = {
|
|
659
666
|
conference: e,
|
|
660
667
|
type: t
|
|
661
668
|
};
|
|
662
|
-
this._uaEvents.trigger(
|
|
669
|
+
this._uaEvents.trigger(Se, n);
|
|
663
670
|
});
|
|
664
671
|
i(this, "_triggerAccountChangedNotify", () => {
|
|
665
|
-
this._uaEvents.trigger(
|
|
672
|
+
this._uaEvents.trigger(ue, void 0);
|
|
666
673
|
});
|
|
667
674
|
i(this, "_triggerAccountDeletedNotify", () => {
|
|
668
|
-
this._uaEvents.trigger(
|
|
675
|
+
this._uaEvents.trigger(Ce, void 0);
|
|
669
676
|
});
|
|
670
677
|
i(this, "_triggerConferenceParticipantTokenIssued", ({
|
|
671
|
-
body: { conference: e, participant: t, jwt:
|
|
678
|
+
body: { conference: e, participant: t, jwt: n }
|
|
672
679
|
}) => {
|
|
673
|
-
const
|
|
680
|
+
const s = {
|
|
674
681
|
conference: e,
|
|
675
682
|
participant: t,
|
|
676
|
-
jwt:
|
|
683
|
+
jwt: n
|
|
677
684
|
};
|
|
678
685
|
this._uaEvents.trigger(
|
|
679
686
|
Ne,
|
|
680
|
-
|
|
687
|
+
s
|
|
681
688
|
);
|
|
682
689
|
});
|
|
683
690
|
i(this, "_triggerChannelsNotify", (e) => {
|
|
684
|
-
const t = e.input,
|
|
691
|
+
const t = e.input, n = e.output, s = {
|
|
685
692
|
inputChannels: t,
|
|
686
|
-
outputChannels:
|
|
693
|
+
outputChannels: n
|
|
687
694
|
};
|
|
688
|
-
this._uaEvents.trigger(
|
|
695
|
+
this._uaEvents.trigger(te, s);
|
|
689
696
|
});
|
|
690
697
|
i(this, "_triggerParticipationAcceptingWordRequest", ({
|
|
691
698
|
body: { conference: e }
|
|
@@ -693,7 +700,7 @@ class on {
|
|
|
693
700
|
const t = {
|
|
694
701
|
conference: e
|
|
695
702
|
};
|
|
696
|
-
this._uaEvents.trigger(
|
|
703
|
+
this._uaEvents.trigger(le, t);
|
|
697
704
|
});
|
|
698
705
|
i(this, "_triggerParticipationCancellingWordRequest", ({
|
|
699
706
|
body: { conference: e }
|
|
@@ -712,74 +719,74 @@ class on {
|
|
|
712
719
|
this._uaEvents.trigger(Ee, t);
|
|
713
720
|
});
|
|
714
721
|
i(this, "_triggerEnterRoom", (e) => {
|
|
715
|
-
const t = e.getHeader(xt),
|
|
716
|
-
this._sessionEvents.trigger(
|
|
722
|
+
const t = e.getHeader(xt), n = e.getHeader(Kt);
|
|
723
|
+
this._sessionEvents.trigger(j, { room: t, participantName: n });
|
|
717
724
|
});
|
|
718
725
|
i(this, "_triggerShareState", (e) => {
|
|
719
726
|
const t = e.getHeader(R);
|
|
720
727
|
this._sessionEvents.trigger(M, t);
|
|
721
728
|
});
|
|
722
729
|
i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
723
|
-
e.getHeader(
|
|
730
|
+
e.getHeader(cn) === ot && this._sessionEvents.trigger(he, void 0);
|
|
724
731
|
});
|
|
725
732
|
i(this, "_triggerMainCamControl", (e) => {
|
|
726
|
-
const t = e.getHeader(Zt),
|
|
733
|
+
const t = e.getHeader(Zt), n = e.getHeader(ye), s = n === q.ADMIN_SYNC_FORCED;
|
|
727
734
|
if (t === I.ADMIN_START_MAIN_CAM) {
|
|
728
|
-
this._sessionEvents.trigger(
|
|
735
|
+
this._sessionEvents.trigger(re, { isSyncForced: s });
|
|
729
736
|
return;
|
|
730
737
|
}
|
|
731
738
|
if (t === I.ADMIN_STOP_MAIN_CAM) {
|
|
732
|
-
this._sessionEvents.trigger(
|
|
739
|
+
this._sessionEvents.trigger(ie, { isSyncForced: s });
|
|
733
740
|
return;
|
|
734
741
|
}
|
|
735
|
-
(t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) &&
|
|
736
|
-
const o = e.getHeader(
|
|
742
|
+
(t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(y, { isSyncForced: s });
|
|
743
|
+
const o = e.getHeader(tn);
|
|
737
744
|
this._sessionEvents.trigger(se, {
|
|
738
745
|
mainCam: t,
|
|
739
746
|
resolutionMainCam: o
|
|
740
747
|
});
|
|
741
748
|
});
|
|
742
749
|
i(this, "_triggerMicControl", (e) => {
|
|
743
|
-
const t = e.getHeader(
|
|
744
|
-
t ===
|
|
750
|
+
const t = e.getHeader(en), s = e.getHeader(ye) === q.ADMIN_SYNC_FORCED;
|
|
751
|
+
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(ae, { isSyncForced: s }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(oe, { isSyncForced: s });
|
|
745
752
|
});
|
|
746
753
|
i(this, "_triggerUseLicense", (e) => {
|
|
747
754
|
const t = e.getHeader(jt);
|
|
748
|
-
this._sessionEvents.trigger(
|
|
755
|
+
this._sessionEvents.trigger(K, t);
|
|
749
756
|
});
|
|
750
757
|
i(this, "_handleNewInfo", (e) => {
|
|
751
758
|
const { originator: t } = e;
|
|
752
759
|
if (t !== "remote")
|
|
753
760
|
return;
|
|
754
|
-
const { request:
|
|
755
|
-
if (
|
|
756
|
-
switch (
|
|
761
|
+
const { request: n } = e, s = n.getHeader(Yt);
|
|
762
|
+
if (s)
|
|
763
|
+
switch (s) {
|
|
757
764
|
case Gt: {
|
|
758
|
-
this._triggerEnterRoom(
|
|
765
|
+
this._triggerEnterRoom(n), this._maybeTriggerChannels(n);
|
|
759
766
|
break;
|
|
760
767
|
}
|
|
761
|
-
case
|
|
762
|
-
this._maybeHandleNotify(
|
|
768
|
+
case _n: {
|
|
769
|
+
this._maybeHandleNotify(n);
|
|
763
770
|
break;
|
|
764
771
|
}
|
|
765
|
-
case
|
|
766
|
-
this._triggerShareState(
|
|
772
|
+
case O: {
|
|
773
|
+
this._triggerShareState(n);
|
|
767
774
|
break;
|
|
768
775
|
}
|
|
769
|
-
case
|
|
770
|
-
this._triggerMainCamControl(
|
|
776
|
+
case De: {
|
|
777
|
+
this._triggerMainCamControl(n);
|
|
771
778
|
break;
|
|
772
779
|
}
|
|
773
780
|
case zt: {
|
|
774
|
-
this._triggerMicControl(
|
|
781
|
+
this._triggerMicControl(n);
|
|
775
782
|
break;
|
|
776
783
|
}
|
|
777
784
|
case Qt: {
|
|
778
|
-
this._triggerUseLicense(
|
|
785
|
+
this._triggerUseLicense(n);
|
|
779
786
|
break;
|
|
780
787
|
}
|
|
781
|
-
case
|
|
782
|
-
this._maybeTriggerParticipantMoveRequestToSpectators(
|
|
788
|
+
case an: {
|
|
789
|
+
this._maybeTriggerParticipantMoveRequestToSpectators(n);
|
|
783
790
|
break;
|
|
784
791
|
}
|
|
785
792
|
}
|
|
@@ -788,17 +795,17 @@ class on {
|
|
|
788
795
|
this._maybeHandleNotify(e);
|
|
789
796
|
});
|
|
790
797
|
i(this, "_maybeHandleNotify", (e) => {
|
|
791
|
-
const t = e.getHeader(
|
|
798
|
+
const t = e.getHeader(En);
|
|
792
799
|
if (t) {
|
|
793
|
-
const
|
|
794
|
-
this._handleNotify(
|
|
800
|
+
const n = JSON.parse(t);
|
|
801
|
+
this._handleNotify(n);
|
|
795
802
|
}
|
|
796
803
|
});
|
|
797
804
|
i(this, "_handleEnded", (e) => {
|
|
798
805
|
const { originator: t } = e;
|
|
799
|
-
t === we && this._sessionEvents.trigger(
|
|
806
|
+
t === we && this._sessionEvents.trigger(ne, e), this._restoreSession();
|
|
800
807
|
});
|
|
801
|
-
this.JsSIP = e, this._sessionEvents = new
|
|
808
|
+
this.JsSIP = e, this._sessionEvents = new Pe(Et), this._uaEvents = new Pe(_t), this._cancelableConnect = new N(
|
|
802
809
|
this._connect,
|
|
803
810
|
{
|
|
804
811
|
moduleName: g,
|
|
@@ -806,39 +813,39 @@ class on {
|
|
|
806
813
|
this._cancelableInitUa.cancelRequest(), this._cancelableDisconnect.cancelRequest();
|
|
807
814
|
}
|
|
808
815
|
}
|
|
809
|
-
), this._cancelableInitUa = new
|
|
816
|
+
), this._cancelableInitUa = new N(
|
|
810
817
|
this._initUa,
|
|
811
818
|
{ moduleName: g }
|
|
812
|
-
), this._cancelableDisconnect = new
|
|
819
|
+
), this._cancelableDisconnect = new N(
|
|
813
820
|
this._disconnect,
|
|
814
821
|
{ moduleName: g }
|
|
815
|
-
), this._cancelableSet = new
|
|
822
|
+
), this._cancelableSet = new N(this._set, {
|
|
816
823
|
moduleName: g
|
|
817
|
-
}), this._cancelableCall = new
|
|
824
|
+
}), this._cancelableCall = new N(
|
|
818
825
|
this._call,
|
|
819
826
|
{ moduleName: g }
|
|
820
|
-
), this._cancelableAnswer = new
|
|
827
|
+
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(M, this._handleShareState), this.onSession(Ae, this._handleNewInfo), this.on(X, this._handleSipEvent), this.onSession(A, this._handleEnded), this.onSession(P, this._handleEnded);
|
|
821
828
|
}
|
|
822
829
|
async register() {
|
|
823
830
|
return new Promise((e, t) => {
|
|
824
|
-
this.isRegisterConfig && this.ua ? (this.ua.on(f, e), this.ua.on(
|
|
831
|
+
this.isRegisterConfig && this.ua ? (this.ua.on(f, e), this.ua.on(p, t), this.ua.register()) : t(new Error("Config is not registered"));
|
|
825
832
|
});
|
|
826
833
|
}
|
|
827
834
|
async unregister() {
|
|
828
835
|
return new Promise((e, t) => {
|
|
829
|
-
this.isRegistered && this.ua ? (this.ua.on(
|
|
836
|
+
this.isRegistered && this.ua ? (this.ua.on($, e), this.ua.unregister()) : t(new Error("ua is not registered"));
|
|
830
837
|
});
|
|
831
838
|
}
|
|
832
|
-
async sendOptions(e, t,
|
|
839
|
+
async sendOptions(e, t, n) {
|
|
833
840
|
if (!this.ua)
|
|
834
841
|
throw new Error("is not connected");
|
|
835
|
-
return new Promise((
|
|
842
|
+
return new Promise((s, o) => {
|
|
836
843
|
try {
|
|
837
844
|
this.ua.sendOptions(e, t, {
|
|
838
|
-
extraHeaders:
|
|
845
|
+
extraHeaders: n,
|
|
839
846
|
eventHandlers: {
|
|
840
847
|
succeeded: () => {
|
|
841
|
-
|
|
848
|
+
s();
|
|
842
849
|
},
|
|
843
850
|
failed: o
|
|
844
851
|
}
|
|
@@ -849,33 +856,33 @@ class on {
|
|
|
849
856
|
});
|
|
850
857
|
}
|
|
851
858
|
async ping(e, t) {
|
|
852
|
-
var
|
|
853
|
-
if (!((
|
|
859
|
+
var s;
|
|
860
|
+
if (!((s = this.ua) != null && s.configuration.uri))
|
|
854
861
|
throw new Error("is not connected");
|
|
855
|
-
const
|
|
856
|
-
return this.sendOptions(
|
|
862
|
+
const n = this.ua.configuration.uri;
|
|
863
|
+
return this.sendOptions(n, e, t);
|
|
857
864
|
}
|
|
858
865
|
async checkTelephony({
|
|
859
866
|
userAgent: e,
|
|
860
867
|
displayName: t,
|
|
861
|
-
sipServerUrl:
|
|
862
|
-
sipWebSocketServerURL:
|
|
868
|
+
sipServerUrl: n,
|
|
869
|
+
sipWebSocketServerURL: s
|
|
863
870
|
}) {
|
|
864
871
|
return new Promise((o, a) => {
|
|
865
872
|
const { configuration: c } = this.createUaConfiguration({
|
|
866
|
-
sipWebSocketServerURL:
|
|
873
|
+
sipWebSocketServerURL: s,
|
|
867
874
|
displayName: t,
|
|
868
875
|
userAgent: e,
|
|
869
|
-
sipServerUrl:
|
|
870
|
-
}),
|
|
871
|
-
const
|
|
872
|
-
a(
|
|
876
|
+
sipServerUrl: n
|
|
877
|
+
}), _ = this._createUa(c), E = () => {
|
|
878
|
+
const d = new Error("Telephony is not available");
|
|
879
|
+
a(d);
|
|
873
880
|
};
|
|
874
|
-
|
|
881
|
+
_.once(S, E);
|
|
875
882
|
const h = () => {
|
|
876
|
-
|
|
883
|
+
_.removeAllListeners(), _.once(S, o), _.stop();
|
|
877
884
|
};
|
|
878
|
-
|
|
885
|
+
_.once(m, h), _.start();
|
|
879
886
|
});
|
|
880
887
|
}
|
|
881
888
|
async replaceMediaStream(e, t) {
|
|
@@ -886,129 +893,155 @@ class on {
|
|
|
886
893
|
async askPermissionToEnableCam(e = {}) {
|
|
887
894
|
if (!this.session)
|
|
888
895
|
throw new Error("No session established");
|
|
889
|
-
const t = [
|
|
890
|
-
return this.session.sendInfo(
|
|
896
|
+
const t = [Cn];
|
|
897
|
+
return this.session.sendInfo(De, void 0, {
|
|
891
898
|
noTerminateWhenError: !0,
|
|
892
899
|
...e,
|
|
893
900
|
extraHeaders: t
|
|
894
|
-
}).catch((
|
|
895
|
-
if (
|
|
896
|
-
throw
|
|
901
|
+
}).catch((n) => {
|
|
902
|
+
if (Pn(n))
|
|
903
|
+
throw n;
|
|
897
904
|
});
|
|
898
905
|
}
|
|
899
906
|
get isPendingPresentation() {
|
|
900
907
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
901
908
|
}
|
|
909
|
+
async _sendPresentationWithDuplicatedCalls({
|
|
910
|
+
session: e,
|
|
911
|
+
stream: t,
|
|
912
|
+
presentationOptions: n,
|
|
913
|
+
options: s = {
|
|
914
|
+
callLimit: Wn
|
|
915
|
+
}
|
|
916
|
+
}) {
|
|
917
|
+
const o = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
918
|
+
return this._cancelableSendPresentationWithRepeatedCalls = Oe({
|
|
919
|
+
targetFunction: o,
|
|
920
|
+
isComplete: a,
|
|
921
|
+
isRejectAsValid: !0,
|
|
922
|
+
...s
|
|
923
|
+
}), this._cancelableSendPresentationWithRepeatedCalls.then((c) => {
|
|
924
|
+
if (c instanceof MediaStream)
|
|
925
|
+
return c;
|
|
926
|
+
throw c;
|
|
927
|
+
});
|
|
928
|
+
}
|
|
902
929
|
hasEqualConnectionConfiguration(e) {
|
|
903
|
-
var
|
|
904
|
-
const { configuration: t } = this.createUaConfiguration(e),
|
|
905
|
-
return (
|
|
930
|
+
var s;
|
|
931
|
+
const { configuration: t } = this.createUaConfiguration(e), n = (s = this.ua) == null ? void 0 : s.configuration;
|
|
932
|
+
return (n == null ? void 0 : n.password) === t.password && (n == null ? void 0 : n.register) === t.register && (n == null ? void 0 : n.uri.toString()) === t.uri && (n == null ? void 0 : n.display_name) === t.display_name && (n == null ? void 0 : n.user_agent) === t.user_agent && (n == null ? void 0 : n.sockets) === t.sockets && (n == null ? void 0 : n.session_timers) === t.session_timers && (n == null ? void 0 : n.register_expires) === t.register_expires && (n == null ? void 0 : n.connection_recovery_min_interval) === t.connection_recovery_min_interval && (n == null ? void 0 : n.connection_recovery_max_interval) === t.connection_recovery_max_interval;
|
|
906
933
|
}
|
|
907
934
|
createUaConfiguration({
|
|
908
935
|
user: e,
|
|
909
936
|
password: t,
|
|
910
|
-
sipWebSocketServerURL:
|
|
911
|
-
displayName:
|
|
937
|
+
sipWebSocketServerURL: n,
|
|
938
|
+
displayName: s = "",
|
|
912
939
|
sipServerUrl: o,
|
|
913
940
|
register: a = !1,
|
|
914
941
|
sessionTimers: c = !1,
|
|
915
|
-
registerExpires:
|
|
942
|
+
registerExpires: _ = 60 * 5,
|
|
916
943
|
// 5 minutes in sec
|
|
917
|
-
connectionRecoveryMinInterval:
|
|
944
|
+
connectionRecoveryMinInterval: E = 2,
|
|
918
945
|
connectionRecoveryMaxInterval: h = 6,
|
|
919
|
-
userAgent:
|
|
946
|
+
userAgent: d
|
|
920
947
|
}) {
|
|
921
948
|
if (a && !t)
|
|
922
949
|
throw new Error("password is required for authorized connection");
|
|
923
|
-
const
|
|
950
|
+
const l = a && e ? e.trim() : `${Rn()}`, T = gn(o), u = T(l), C = new this.JsSIP.WebSocketInterface(n);
|
|
924
951
|
return {
|
|
925
952
|
configuration: {
|
|
926
953
|
password: t,
|
|
927
954
|
register: a,
|
|
928
955
|
uri: u,
|
|
929
|
-
display_name:
|
|
930
|
-
user_agent:
|
|
956
|
+
display_name: be(s),
|
|
957
|
+
user_agent: d,
|
|
931
958
|
sdp_semantics: "unified-plan",
|
|
932
|
-
sockets: [
|
|
959
|
+
sockets: [C],
|
|
933
960
|
session_timers: c,
|
|
934
|
-
register_expires:
|
|
935
|
-
connection_recovery_min_interval:
|
|
961
|
+
register_expires: _,
|
|
962
|
+
connection_recovery_min_interval: E,
|
|
936
963
|
connection_recovery_max_interval: h
|
|
937
964
|
},
|
|
938
965
|
helpers: {
|
|
939
|
-
socket:
|
|
966
|
+
socket: C,
|
|
940
967
|
getSipServerUrl: T
|
|
941
968
|
}
|
|
942
969
|
};
|
|
943
970
|
}
|
|
944
971
|
async _sendPresentation(e, t, {
|
|
945
|
-
maxBitrate:
|
|
946
|
-
degradationPreference:
|
|
972
|
+
maxBitrate: n,
|
|
973
|
+
degradationPreference: s,
|
|
947
974
|
isNeedReinvite: o = !0,
|
|
948
975
|
isP2P: a = !1
|
|
949
976
|
}) {
|
|
950
|
-
const c =
|
|
977
|
+
const c = W(t);
|
|
951
978
|
this._streamPresentationCurrent = c;
|
|
952
|
-
const
|
|
953
|
-
extraHeaders:
|
|
979
|
+
const _ = a ? [Tn] : [hn], E = e.sendInfo(O, void 0, {
|
|
980
|
+
extraHeaders: _
|
|
954
981
|
}).then(async () => e.startPresentation(
|
|
955
982
|
c,
|
|
956
983
|
o,
|
|
957
|
-
|
|
984
|
+
s
|
|
958
985
|
)).then(async () => {
|
|
959
986
|
const { connection: h } = this;
|
|
960
|
-
if (!h ||
|
|
987
|
+
if (!h || n === void 0)
|
|
961
988
|
return;
|
|
962
|
-
const
|
|
963
|
-
await
|
|
989
|
+
const d = h.getSenders();
|
|
990
|
+
await wn(d, t, n);
|
|
964
991
|
}).then(() => t).catch((h) => {
|
|
965
|
-
throw this._sessionEvents.trigger(U, h), h;
|
|
992
|
+
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(U, h), h;
|
|
966
993
|
});
|
|
967
|
-
return this.promisePendingStartPresentation =
|
|
994
|
+
return this.promisePendingStartPresentation = E, E.finally(() => {
|
|
968
995
|
this.promisePendingStartPresentation = void 0;
|
|
969
996
|
});
|
|
970
997
|
}
|
|
971
998
|
async startPresentation(e, {
|
|
972
999
|
isNeedReinvite: t = !0,
|
|
973
|
-
isP2P:
|
|
974
|
-
maxBitrate:
|
|
1000
|
+
isP2P: n = !1,
|
|
1001
|
+
maxBitrate: s,
|
|
975
1002
|
degradationPreference: o
|
|
976
|
-
} = {}) {
|
|
977
|
-
const
|
|
978
|
-
if (!
|
|
1003
|
+
} = {}, a) {
|
|
1004
|
+
const c = this.establishedSession;
|
|
1005
|
+
if (!c)
|
|
979
1006
|
throw new Error("No session established");
|
|
980
1007
|
if (this._streamPresentationCurrent)
|
|
981
1008
|
throw new Error("Presentation is already started");
|
|
982
|
-
return
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1009
|
+
return n && await this.sendMustStopPresentation(c), this._sendPresentationWithDuplicatedCalls({
|
|
1010
|
+
session: c,
|
|
1011
|
+
stream: e,
|
|
1012
|
+
presentationOptions: {
|
|
1013
|
+
isNeedReinvite: t,
|
|
1014
|
+
isP2P: n,
|
|
1015
|
+
maxBitrate: s,
|
|
1016
|
+
degradationPreference: o
|
|
1017
|
+
},
|
|
1018
|
+
options: a
|
|
987
1019
|
});
|
|
988
1020
|
}
|
|
989
1021
|
async sendMustStopPresentation(e) {
|
|
990
|
-
await e.sendInfo(
|
|
991
|
-
extraHeaders: [
|
|
1022
|
+
await e.sendInfo(O, void 0, {
|
|
1023
|
+
extraHeaders: [dn]
|
|
992
1024
|
});
|
|
993
1025
|
}
|
|
994
1026
|
async stopPresentation({
|
|
995
1027
|
isP2P: e = !1
|
|
996
1028
|
} = {}) {
|
|
1029
|
+
this._cancelSendPresentationWithRepeatedCalls();
|
|
997
1030
|
const t = this._streamPresentationCurrent;
|
|
998
|
-
let
|
|
999
|
-
const
|
|
1000
|
-
return o && t && (
|
|
1001
|
-
extraHeaders:
|
|
1031
|
+
let n = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
1032
|
+
const s = e ? [Sn] : [ln], o = this.establishedSession;
|
|
1033
|
+
return o && t && (n = n.then(async () => o.sendInfo(O, void 0, {
|
|
1034
|
+
extraHeaders: s
|
|
1002
1035
|
})).then(async () => o.stopPresentation(t)).catch((a) => {
|
|
1003
1036
|
throw this._sessionEvents.trigger(U, a), a;
|
|
1004
|
-
})), !o && t && this._sessionEvents.trigger(
|
|
1037
|
+
})), !o && t && this._sessionEvents.trigger(Re, t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
1005
1038
|
this._resetPresentation();
|
|
1006
1039
|
});
|
|
1007
1040
|
}
|
|
1008
1041
|
async updatePresentation(e, {
|
|
1009
1042
|
isP2P: t = !1,
|
|
1010
|
-
maxBitrate:
|
|
1011
|
-
degradationPreference:
|
|
1043
|
+
maxBitrate: n,
|
|
1044
|
+
degradationPreference: s
|
|
1012
1045
|
} = {}) {
|
|
1013
1046
|
const o = this.establishedSession;
|
|
1014
1047
|
if (!o)
|
|
@@ -1017,13 +1050,19 @@ class on {
|
|
|
1017
1050
|
throw new Error("Presentation has not started yet");
|
|
1018
1051
|
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(o, e, {
|
|
1019
1052
|
isP2P: t,
|
|
1020
|
-
maxBitrate:
|
|
1021
|
-
degradationPreference:
|
|
1053
|
+
maxBitrate: n,
|
|
1054
|
+
degradationPreference: s,
|
|
1022
1055
|
isNeedReinvite: !1
|
|
1023
1056
|
});
|
|
1024
1057
|
}
|
|
1058
|
+
_removeStreamPresentationCurrent() {
|
|
1059
|
+
delete this._streamPresentationCurrent;
|
|
1060
|
+
}
|
|
1025
1061
|
_resetPresentation() {
|
|
1026
|
-
|
|
1062
|
+
this._removeStreamPresentationCurrent(), this.promisePendingStartPresentation = void 0, this.promisePendingStopPresentation = void 0;
|
|
1063
|
+
}
|
|
1064
|
+
_cancelRequestsAndResetPresentation() {
|
|
1065
|
+
this._cancelSendPresentationWithRepeatedCalls(), this._resetPresentation();
|
|
1027
1066
|
}
|
|
1028
1067
|
on(e, t) {
|
|
1029
1068
|
return this._uaEvents.on(e, t);
|
|
@@ -1064,18 +1103,18 @@ class on {
|
|
|
1064
1103
|
getRemoteStreams() {
|
|
1065
1104
|
if (!this.connection)
|
|
1066
1105
|
return;
|
|
1067
|
-
const t = this.connection.getReceivers().map(({ track:
|
|
1068
|
-
return
|
|
1106
|
+
const t = this.connection.getReceivers().map(({ track: n }) => n);
|
|
1107
|
+
return In(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1069
1108
|
}
|
|
1070
1109
|
get connection() {
|
|
1071
1110
|
var t;
|
|
1072
1111
|
return (t = this.session) == null ? void 0 : t.connection;
|
|
1073
1112
|
}
|
|
1074
1113
|
get remoteCallerData() {
|
|
1075
|
-
var e, t,
|
|
1114
|
+
var e, t, n, s, o, a;
|
|
1076
1115
|
return {
|
|
1077
1116
|
displayName: (t = (e = this.incomingSession) == null ? void 0 : e.remote_identity) == null ? void 0 : t.display_name,
|
|
1078
|
-
host: (
|
|
1117
|
+
host: (s = (n = this.incomingSession) == null ? void 0 : n.remote_identity) == null ? void 0 : s.uri.host,
|
|
1079
1118
|
incomingNumber: (a = (o = this.incomingSession) == null ? void 0 : o.remote_identity) == null ? void 0 : a.uri.user,
|
|
1080
1119
|
session: this.incomingSession
|
|
1081
1120
|
};
|
|
@@ -1100,27 +1139,27 @@ class on {
|
|
|
1100
1139
|
return !!this.incomingSession;
|
|
1101
1140
|
}
|
|
1102
1141
|
_generateStream(e, t) {
|
|
1103
|
-
const { id:
|
|
1104
|
-
return t &&
|
|
1142
|
+
const { id: n } = e, s = this._remoteStreams[n] || new MediaStream();
|
|
1143
|
+
return t && s.addTrack(t), s.addTrack(e), this._remoteStreams[n] = s, s;
|
|
1105
1144
|
}
|
|
1106
1145
|
_generateAudioStream(e) {
|
|
1107
|
-
const { id: t } = e,
|
|
1108
|
-
return
|
|
1146
|
+
const { id: t } = e, n = this._remoteStreams[t] || new MediaStream();
|
|
1147
|
+
return n.addTrack(e), this._remoteStreams[t] = n, n;
|
|
1109
1148
|
}
|
|
1110
1149
|
_generateStreams(e) {
|
|
1111
1150
|
const t = [];
|
|
1112
|
-
return e.forEach((
|
|
1113
|
-
if (
|
|
1151
|
+
return e.forEach((n, s) => {
|
|
1152
|
+
if (n.kind === "audio")
|
|
1114
1153
|
return;
|
|
1115
|
-
const o =
|
|
1154
|
+
const o = n, a = e[s - 1];
|
|
1116
1155
|
let c;
|
|
1117
1156
|
a && a.kind === "audio" && (c = a);
|
|
1118
|
-
const
|
|
1119
|
-
t.push(
|
|
1157
|
+
const _ = this._generateStream(o, c);
|
|
1158
|
+
t.push(_);
|
|
1120
1159
|
}), t;
|
|
1121
1160
|
}
|
|
1122
1161
|
_generateAudioStreams(e) {
|
|
1123
|
-
return e.map((
|
|
1162
|
+
return e.map((n) => this._generateAudioStream(n));
|
|
1124
1163
|
}
|
|
1125
1164
|
_cancelRequests() {
|
|
1126
1165
|
this._cancelActionsRequests(), this._cancelCallRequests(), this._cancelConnectWithRepeatedCalls();
|
|
@@ -1129,6 +1168,10 @@ class on {
|
|
|
1129
1168
|
var e;
|
|
1130
1169
|
(e = this._cancelableConnectWithRepeatedCalls) == null || e.cancel();
|
|
1131
1170
|
}
|
|
1171
|
+
_cancelSendPresentationWithRepeatedCalls() {
|
|
1172
|
+
var e;
|
|
1173
|
+
(e = this._cancelableSendPresentationWithRepeatedCalls) == null || e.cancel();
|
|
1174
|
+
}
|
|
1132
1175
|
_cancelCallRequests() {
|
|
1133
1176
|
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest();
|
|
1134
1177
|
}
|
|
@@ -1144,30 +1187,30 @@ class on {
|
|
|
1144
1187
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1145
1188
|
if (!this.session)
|
|
1146
1189
|
throw new Error("No session established");
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1190
|
+
const n = `${Me}: ${e}`, s = `${ve}: ${t}`, o = [
|
|
1191
|
+
n,
|
|
1192
|
+
s
|
|
1150
1193
|
];
|
|
1151
1194
|
return this.session.sendInfo($t, void 0, { extraHeaders: o });
|
|
1152
1195
|
}
|
|
1153
|
-
async sendMediaState({ cam: e, mic: t },
|
|
1196
|
+
async sendMediaState({ cam: e, mic: t }, n = {}) {
|
|
1154
1197
|
if (!this.session)
|
|
1155
1198
|
throw new Error("No session established");
|
|
1156
|
-
const
|
|
1157
|
-
|
|
1199
|
+
const s = `${nn}: currentstate`, o = `${rn}: ${Number(e)}`, a = `${on}: ${Number(t)}`, c = [
|
|
1200
|
+
s,
|
|
1158
1201
|
o,
|
|
1159
1202
|
a
|
|
1160
1203
|
];
|
|
1161
1204
|
return this.session.sendInfo(Xt, void 0, {
|
|
1162
1205
|
noTerminateWhenError: !0,
|
|
1163
|
-
...
|
|
1206
|
+
...n,
|
|
1164
1207
|
extraHeaders: c
|
|
1165
1208
|
});
|
|
1166
1209
|
}
|
|
1167
1210
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1168
1211
|
if (!this.session)
|
|
1169
1212
|
throw new Error("No session established");
|
|
1170
|
-
const c = [`${
|
|
1213
|
+
const c = [`${sn}: ${e === "mic" ? 0 : 1}`];
|
|
1171
1214
|
return this.session.sendInfo(Jt, void 0, {
|
|
1172
1215
|
noTerminateWhenError: !0,
|
|
1173
1216
|
...t,
|
|
@@ -1189,19 +1232,19 @@ export {
|
|
|
1189
1232
|
Ft as B,
|
|
1190
1233
|
I as E,
|
|
1191
1234
|
Mt as N,
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1235
|
+
Le as R,
|
|
1236
|
+
as as S,
|
|
1237
|
+
_t as U,
|
|
1238
|
+
ns as a,
|
|
1239
|
+
is as b,
|
|
1240
|
+
ts as c,
|
|
1241
|
+
rs as d,
|
|
1242
|
+
ss as e,
|
|
1243
|
+
k as f,
|
|
1244
|
+
q as g,
|
|
1245
|
+
os as h,
|
|
1246
|
+
Nn as i,
|
|
1204
1247
|
Et as j,
|
|
1205
|
-
|
|
1206
|
-
|
|
1248
|
+
H as l,
|
|
1249
|
+
bn as s
|
|
1207
1250
|
};
|