sip-connector 10.0.1 → 11.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-5B3QzrjB.cjs +1 -0
- package/dist/{SipConnector-JHUHYEf2.js → SipConnector-zEWljwQJ.js} +329 -317
- package/dist/SipConnector.d.ts +14 -9
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +381 -320
- package/dist/tools/answerIncomingCall.d.ts +3 -2
- package/dist/tools/callToServer.d.ts +3 -2
- package/dist/tools/generateSimulcastEncodings.d.ts +7 -0
- package/dist/tools/resolveStartPresentation.d.ts +4 -3
- package/dist/tools/resolveUpdatePresentation.d.ts +4 -3
- package/dist/types.d.ts +6 -1
- package/dist/utils/findVideoTrack.d.ts +2 -0
- package/dist/videoSendingBalancer/processSender.d.ts +2 -2
- package/dist/videoSendingBalancer/scaleResolutionAndBitrate.d.ts +10 -0
- package/package.json +3 -3
- package/dist/SipConnector-D9yQTGlS.cjs +0 -1
- package/dist/tools/resolveHandleAddedSender.d.ts +0 -3
|
@@ -2,17 +2,17 @@ var At = Object.defineProperty;
|
|
|
2
2
|
var Rt = (s, e, t) => e in s ? At(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
3
|
var o = (s, e, t) => Rt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { CancelableRequest as g, isCanceledError as It } from "@krivega/cancelable-promise";
|
|
5
|
-
import
|
|
6
|
-
import { repeatedCallsAsync as
|
|
7
|
-
import
|
|
8
|
-
const ft = "Connection Error",
|
|
5
|
+
import pe from "events-constructor";
|
|
6
|
+
import { repeatedCallsAsync as Me } from "repeated-calls";
|
|
7
|
+
import V from "debug";
|
|
8
|
+
const ft = "Connection Error", He = "Request Timeout", mt = "SIP Failure Code", Pt = "Internal Error", Ot = "Busy", We = "Rejected", Dt = "Redirected", pt = "Unavailable", Mt = "Not Found", vt = "Address Incomplete", yt = "Incompatible SDP", wt = "Missing SDP", bt = "Authentication Error", ke = "Terminated", Ut = "WebRTC Error", Be = "Canceled", Lt = "No Answer", Ht = "Expires", Wt = "No ACK", kt = "Dialog Error", Bt = "User Denied Media Access", qt = "Bad Media Description", Ft = "RTP Timeout", cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
9
|
__proto__: null,
|
|
10
10
|
ADDRESS_INCOMPLETE: vt,
|
|
11
11
|
AUTHENTICATION_ERROR: bt,
|
|
12
12
|
BAD_MEDIA_DESCRIPTION: qt,
|
|
13
13
|
BUSY: Ot,
|
|
14
|
-
BYE:
|
|
15
|
-
CANCELED:
|
|
14
|
+
BYE: ke,
|
|
15
|
+
CANCELED: Be,
|
|
16
16
|
CONNECTION_ERROR: ft,
|
|
17
17
|
DIALOG_ERROR: kt,
|
|
18
18
|
EXPIRES: Ht,
|
|
@@ -23,148 +23,147 @@ const ft = "Connection Error", Le = "Request Timeout", mt = "SIP Failure Code",
|
|
|
23
23
|
NO_ACK: Wt,
|
|
24
24
|
NO_ANSWER: Lt,
|
|
25
25
|
REDIRECTED: Dt,
|
|
26
|
-
REJECTED:
|
|
27
|
-
REQUEST_TIMEOUT:
|
|
26
|
+
REJECTED: We,
|
|
27
|
+
REQUEST_TIMEOUT: He,
|
|
28
28
|
RTP_TIMEOUT: Ft,
|
|
29
29
|
SIP_FAILURE_CODE: mt,
|
|
30
30
|
UNAVAILABLE: pt,
|
|
31
31
|
USER_DENIED_MEDIA_ACCESS: Bt,
|
|
32
32
|
WEBRTC_ERROR: Ut
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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", qe = "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 = "participation:accepting-word-request", ue = "participation:cancelling-word-request", Se = "webcast:started", Ne = "webcast:stopped", ge = "account:changed", Ce = "account:deleted", Ae = "conference:participant-token-issued", D = "ended", Fe = "sending", xe = "reinvite", Ve = "replaces", Ye = "refer", Ge = "progress", $e = "accepted", U = "confirmed", L = "peerconnection", R = "failed", Je = "muted", Xe = "unmuted", Re = "newDTMF", Ie = "newInfo", ze = "hold", Qe = "unhold", je = "update", Ke = "sdp", Ze = "icecandidate", et = "getusermediafailed", tt = "peerconnection:createofferfailed", nt = "peerconnection:createanswerfailed", st = "peerconnection:setlocaldescriptionfailed", it = "peerconnection:setremotedescriptionfailed", ot = "presentation:start", rt = "presentation:started", at = "presentation:end", fe = "presentation:ended", H = "presentation:failed", ct = "SPECTATOR", _t = 1e6, _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
34
34
|
__proto__: null,
|
|
35
|
-
ACCEPTED:
|
|
36
|
-
ACCOUNT_CHANGED:
|
|
37
|
-
ACCOUNT_DELETED:
|
|
38
|
-
ADMIN_FORCE_SYNC_MEDIA_STATE:
|
|
39
|
-
ADMIN_START_MAIN_CAM:
|
|
40
|
-
ADMIN_START_MIC:
|
|
41
|
-
ADMIN_STOP_MAIN_CAM:
|
|
42
|
-
ADMIN_STOP_MIC:
|
|
43
|
-
AVAILABLE_SECOND_REMOTE_STREAM_EVENT:
|
|
44
|
-
CHANNELS:
|
|
45
|
-
CHANNELS_NOTIFY:
|
|
46
|
-
CONFERENCE_PARTICIPANT_TOKEN_ISSUED:
|
|
47
|
-
CONFIRMED:
|
|
48
|
-
CONNECTED:
|
|
49
|
-
CONNECTING:
|
|
50
|
-
DECLINED_INCOMING_CALL:
|
|
51
|
-
DISCONNECTED:
|
|
52
|
-
ENDED:
|
|
53
|
-
ENDED_FROM_SERVER:
|
|
54
|
-
ENTER_ROOM:
|
|
55
|
-
FAILED:
|
|
56
|
-
FAILED_INCOMING_CALL:
|
|
57
|
-
GET_USER_MEDIA_FAILED:
|
|
58
|
-
HOLD:
|
|
59
|
-
ICE_CANDIDATE:
|
|
60
|
-
INCOMING_CALL:
|
|
61
|
-
MAIN_CAM_CONTROL:
|
|
62
|
-
MUST_STOP_PRESENTATION_EVENT:
|
|
63
|
-
MUTED:
|
|
64
|
-
NEW_DTMF:
|
|
65
|
-
NEW_INFO:
|
|
66
|
-
NEW_MESSAGE:
|
|
67
|
-
NEW_RTC_SESSION:
|
|
68
|
-
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:
|
|
69
|
-
ONE_MEGABIT_IN_BITS:
|
|
70
|
-
PARTICIPANT_ADDED_TO_LIST_MODERATORS:
|
|
71
|
-
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:
|
|
72
|
-
PARTICIPANT_MOVE_REQUEST_TO_STREAM:
|
|
73
|
-
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:
|
|
74
|
-
PARTICIPATION_ACCEPTING_WORD_REQUEST:
|
|
75
|
-
PARTICIPATION_CANCELLING_WORD_REQUEST:
|
|
76
|
-
PEER_CONNECTION:
|
|
77
|
-
PEER_CONNECTION_CONFIRMED:
|
|
78
|
-
PEER_CONNECTION_CREATE_ANSWER_FAILED:
|
|
79
|
-
PEER_CONNECTION_CREATE_OFFER_FAILED:
|
|
80
|
-
PEER_CONNECTION_ONTRACK:
|
|
81
|
-
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:
|
|
82
|
-
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:
|
|
83
|
-
PRESENTATION_END:
|
|
84
|
-
PRESENTATION_ENDED:
|
|
85
|
-
PRESENTATION_FAILED:
|
|
86
|
-
PRESENTATION_START:
|
|
87
|
-
PRESENTATION_STARTED:
|
|
88
|
-
PROGRESS:
|
|
89
|
-
REFER:
|
|
90
|
-
REGISTERED:
|
|
91
|
-
REGISTRATION_FAILED:
|
|
92
|
-
REINVITE:
|
|
93
|
-
REPLACES:
|
|
94
|
-
SDP:
|
|
95
|
-
SENDING:
|
|
96
|
-
SHARE_STATE:
|
|
97
|
-
SIP_EVENT:
|
|
98
|
-
SPECTATOR:
|
|
99
|
-
TERMINATED_INCOMING_CALL:
|
|
100
|
-
UNHOLD:
|
|
101
|
-
UNMUTED:
|
|
102
|
-
UNREGISTERED:
|
|
103
|
-
UPDATE:
|
|
104
|
-
USE_LICENSE:
|
|
105
|
-
WEBCAST_STARTED:
|
|
106
|
-
WEBCAST_STOPPED:
|
|
107
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
108
|
-
V,
|
|
35
|
+
ACCEPTED: $e,
|
|
36
|
+
ACCOUNT_CHANGED: ge,
|
|
37
|
+
ACCOUNT_DELETED: Ce,
|
|
38
|
+
ADMIN_FORCE_SYNC_MEDIA_STATE: b,
|
|
39
|
+
ADMIN_START_MAIN_CAM: ae,
|
|
40
|
+
ADMIN_START_MIC: _e,
|
|
41
|
+
ADMIN_STOP_MAIN_CAM: re,
|
|
42
|
+
ADMIN_STOP_MIC: ce,
|
|
43
|
+
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: Q,
|
|
44
|
+
CHANNELS: w,
|
|
45
|
+
CHANNELS_NOTIFY: se,
|
|
46
|
+
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ae,
|
|
47
|
+
CONFIRMED: U,
|
|
48
|
+
CONNECTED: m,
|
|
49
|
+
CONNECTING: W,
|
|
50
|
+
DECLINED_INCOMING_CALL: G,
|
|
51
|
+
DISCONNECTED: N,
|
|
52
|
+
ENDED: D,
|
|
53
|
+
ENDED_FROM_SERVER: ie,
|
|
54
|
+
ENTER_ROOM: Z,
|
|
55
|
+
FAILED: R,
|
|
56
|
+
FAILED_INCOMING_CALL: $,
|
|
57
|
+
GET_USER_MEDIA_FAILED: et,
|
|
58
|
+
HOLD: ze,
|
|
59
|
+
ICE_CANDIDATE: Ze,
|
|
60
|
+
INCOMING_CALL: Y,
|
|
61
|
+
MAIN_CAM_CONTROL: oe,
|
|
62
|
+
MUST_STOP_PRESENTATION_EVENT: K,
|
|
63
|
+
MUTED: Je,
|
|
64
|
+
NEW_DTMF: Re,
|
|
65
|
+
NEW_INFO: Ie,
|
|
66
|
+
NEW_MESSAGE: qe,
|
|
67
|
+
NEW_RTC_SESSION: v,
|
|
68
|
+
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: j,
|
|
69
|
+
ONE_MEGABIT_IN_BITS: _t,
|
|
70
|
+
PARTICIPANT_ADDED_TO_LIST_MODERATORS: Ee,
|
|
71
|
+
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: le,
|
|
72
|
+
PARTICIPANT_MOVE_REQUEST_TO_STREAM: he,
|
|
73
|
+
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: de,
|
|
74
|
+
PARTICIPATION_ACCEPTING_WORD_REQUEST: Te,
|
|
75
|
+
PARTICIPATION_CANCELLING_WORD_REQUEST: ue,
|
|
76
|
+
PEER_CONNECTION: L,
|
|
77
|
+
PEER_CONNECTION_CONFIRMED: te,
|
|
78
|
+
PEER_CONNECTION_CREATE_ANSWER_FAILED: nt,
|
|
79
|
+
PEER_CONNECTION_CREATE_OFFER_FAILED: tt,
|
|
80
|
+
PEER_CONNECTION_ONTRACK: ne,
|
|
81
|
+
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: st,
|
|
82
|
+
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: it,
|
|
83
|
+
PRESENTATION_END: at,
|
|
84
|
+
PRESENTATION_ENDED: fe,
|
|
85
|
+
PRESENTATION_FAILED: H,
|
|
86
|
+
PRESENTATION_START: ot,
|
|
87
|
+
PRESENTATION_STARTED: rt,
|
|
88
|
+
PROGRESS: Ge,
|
|
89
|
+
REFER: Ye,
|
|
90
|
+
REGISTERED: P,
|
|
91
|
+
REGISTRATION_FAILED: O,
|
|
92
|
+
REINVITE: xe,
|
|
93
|
+
REPLACES: Ve,
|
|
94
|
+
SDP: Ke,
|
|
95
|
+
SENDING: Fe,
|
|
96
|
+
SHARE_STATE: y,
|
|
97
|
+
SIP_EVENT: z,
|
|
98
|
+
SPECTATOR: ct,
|
|
99
|
+
TERMINATED_INCOMING_CALL: J,
|
|
100
|
+
UNHOLD: Qe,
|
|
101
|
+
UNMUTED: Xe,
|
|
102
|
+
UNREGISTERED: X,
|
|
103
|
+
UPDATE: je,
|
|
104
|
+
USE_LICENSE: ee,
|
|
105
|
+
WEBCAST_STARTED: Se,
|
|
106
|
+
WEBCAST_STOPPED: Ne
|
|
107
|
+
}, Symbol.toStringTag, { value: "Module" })), Et = [
|
|
109
108
|
Y,
|
|
110
|
-
$,
|
|
111
109
|
G,
|
|
112
|
-
|
|
110
|
+
J,
|
|
111
|
+
$,
|
|
113
112
|
Te,
|
|
114
|
-
de,
|
|
115
|
-
ne,
|
|
116
|
-
Ce,
|
|
117
|
-
Ne,
|
|
118
|
-
ge,
|
|
119
113
|
ue,
|
|
114
|
+
he,
|
|
115
|
+
se,
|
|
116
|
+
Ae,
|
|
117
|
+
ge,
|
|
118
|
+
Ce,
|
|
120
119
|
Se,
|
|
121
|
-
|
|
122
|
-
Ee
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
S,
|
|
127
|
-
M,
|
|
120
|
+
Ne,
|
|
121
|
+
Ee,
|
|
122
|
+
de
|
|
123
|
+
], me = [
|
|
124
|
+
W,
|
|
128
125
|
m,
|
|
129
|
-
|
|
126
|
+
N,
|
|
127
|
+
v,
|
|
130
128
|
P,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
z
|
|
129
|
+
X,
|
|
130
|
+
O,
|
|
131
|
+
qe,
|
|
132
|
+
z
|
|
133
|
+
], dt = [
|
|
135
134
|
Q,
|
|
136
135
|
j,
|
|
137
|
-
v,
|
|
138
136
|
K,
|
|
137
|
+
y,
|
|
139
138
|
Z,
|
|
140
139
|
ee,
|
|
141
140
|
te,
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
ne,
|
|
142
|
+
w,
|
|
144
143
|
ie,
|
|
145
|
-
re,
|
|
146
144
|
oe,
|
|
147
145
|
ae,
|
|
146
|
+
re,
|
|
148
147
|
ce,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
_e,
|
|
149
|
+
b,
|
|
150
|
+
le
|
|
151
|
+
], Pe = [
|
|
152
|
+
D,
|
|
153
|
+
W,
|
|
155
154
|
Fe,
|
|
156
155
|
xe,
|
|
157
156
|
Ve,
|
|
158
157
|
Ye,
|
|
159
158
|
Ge,
|
|
160
|
-
b,
|
|
161
|
-
U,
|
|
162
|
-
A,
|
|
163
159
|
$e,
|
|
160
|
+
U,
|
|
161
|
+
L,
|
|
162
|
+
R,
|
|
164
163
|
Je,
|
|
165
|
-
Ae,
|
|
166
|
-
Re,
|
|
167
164
|
Xe,
|
|
165
|
+
Re,
|
|
166
|
+
Ie,
|
|
168
167
|
ze,
|
|
169
168
|
Qe,
|
|
170
169
|
je,
|
|
@@ -177,31 +176,32 @@ const ft = "Connection Error", Le = "Request Timeout", mt = "SIP Failure Code",
|
|
|
177
176
|
it,
|
|
178
177
|
ot,
|
|
179
178
|
rt,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
...
|
|
179
|
+
at,
|
|
180
|
+
fe,
|
|
181
|
+
H
|
|
182
|
+
], ht = [...me, ...Et], lt = [
|
|
183
|
+
...Pe,
|
|
184
|
+
...dt
|
|
185
185
|
], Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
186
186
|
__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:
|
|
187
|
+
SESSION_EVENT_NAMES: lt,
|
|
188
|
+
SESSION_JSSIP_EVENT_NAMES: Pe,
|
|
189
|
+
SESSION_SYNTHETICS_EVENT_NAMES: dt,
|
|
190
|
+
UA_EVENT_NAMES: ht,
|
|
191
|
+
UA_JSSIP_EVENT_NAMES: me,
|
|
192
|
+
UA_SYNTHETICS_EVENT_NAMES: Et
|
|
193
193
|
}, Symbol.toStringTag, { value: "Module" })), xt = (s) => {
|
|
194
194
|
const e = [];
|
|
195
195
|
return s && e.push(`X-Vinteo-Remote: ${s}`), e;
|
|
196
|
-
}, Vt = "content-type", Yt = "x-webrtc-enter-room",
|
|
197
|
-
|
|
196
|
+
}, Vt = "content-type", Yt = "x-webrtc-enter-room", p = "application/vinteo.webrtc.sharedesktop", Gt = "application/vinteo.webrtc.roomname", $t = "application/vinteo.webrtc.channels", Jt = "application/vinteo.webrtc.mediastate", Xt = "application/vinteo.webrtc.refusal", ve = "application/vinteo.webrtc.maincam", zt = "application/vinteo.webrtc.mic", Qt = "application/vinteo.webrtc.uselic", jt = "X-WEBRTC-USE-LICENSE", Kt = "X-WEBRTC-PARTICIPANT-NAME", ye = "X-WEBRTC-INPUT-CHANNELS", we = "X-WEBRTC-OUTPUT-CHANNELS", Zt = "X-WEBRTC-MAINCAM", en = "X-WEBRTC-MIC", be = "X-WEBRTC-SYNC", tn = "X-WEBRTC-MAINCAM-RESOLUTION", nn = "X-WEBRTC-MEDIA-STATE", sn = "X-Vinteo-Media-Type", on = "X-Vinteo-MainCam-State", rn = "X-Vinteo-Mic-State", an = "application/vinteo.webrtc.partstate", cn = "X-WEBRTC-PARTSTATE", _n = "application/vinteo.webrtc.notify", En = "X-VINTEO-NOTIFY", I = "x-webrtc-share-state", dn = `${I}: LETMESTARTPRESENTATION`, hn = `${I}: STOPPRESENTATION`, Tt = "YOUCANRECEIVECONTENT", ut = "CONTENTEND", St = "YOUMUSTSTOPSENDCONTENT", ln = `${I}: ${St}`, Tn = `${I}: ${Tt}`, un = `${I}: ${ut}`, Sn = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Nn = `${Sn}: LETMESTARTMAINCAM`, Oe = "sip-connector", B = V(Oe), ds = () => {
|
|
197
|
+
V.enable(Oe);
|
|
198
198
|
}, hs = () => {
|
|
199
|
-
|
|
199
|
+
V.enable(`-${Oe}`);
|
|
200
200
|
}, gn = (s, e) => {
|
|
201
201
|
s.getVideoTracks().forEach((n) => {
|
|
202
202
|
"contentHint" in n && n.contentHint !== e && (n.contentHint = e);
|
|
203
203
|
});
|
|
204
|
-
},
|
|
204
|
+
}, M = (s, {
|
|
205
205
|
videoMode: e,
|
|
206
206
|
audioMode: t,
|
|
207
207
|
contentHint: n
|
|
@@ -211,11 +211,11 @@ const ft = "Connection Error", Le = "Request Timeout", mt = "SIP Failure Code",
|
|
|
211
211
|
const i = t === "recvonly" ? [] : s.getAudioTracks(), r = e === "recvonly" ? [] : s.getVideoTracks(), a = [...i, ...r], c = new MediaStream(a);
|
|
212
212
|
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" && gn(c, n), c;
|
|
213
213
|
};
|
|
214
|
-
var
|
|
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 || {}), Cn = /* @__PURE__ */ ((s) => (s.AUDIO = "AUDIO", s.VIDEO = "VIDEO", s.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", s))(Cn || {});
|
|
215
215
|
function An(s) {
|
|
216
216
|
return (e) => `sip:${e}@${s}`;
|
|
217
217
|
}
|
|
218
|
-
const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s,
|
|
218
|
+
const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, Ue = (s) => s.trim().replaceAll(" ", "_"), In = Rn(1e5, 99999999), fn = (s) => s.some((t) => {
|
|
219
219
|
const { kind: n } = t;
|
|
220
220
|
return n === "video";
|
|
221
221
|
}), mn = "Error decline with 603", Pn = 1006, On = (s) => typeof s == "object" && s !== null && "code" in s && s.code === Pn, Dn = (s) => s.message === mn, pn = (s, e) => s.find((t) => t.track && e.getTracks().includes(t.track)), Mn = (s, e) => (s.degradationPreference = e.degradationPreference, s), vn = (s, e) => {
|
|
@@ -223,16 +223,16 @@ const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, be = (s) =>
|
|
|
223
223
|
for (let t = s.encodings.length; t < e; t += 1)
|
|
224
224
|
s.encodings.push({});
|
|
225
225
|
return s;
|
|
226
|
-
},
|
|
226
|
+
}, Nt = (s) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== s, yn = Nt(), wn = (s, e) => {
|
|
227
227
|
if (yn(s, e))
|
|
228
228
|
return s;
|
|
229
229
|
}, bn = (s, e) => {
|
|
230
230
|
const t = s.maxBitrate, n = wn(e, t);
|
|
231
231
|
return n !== void 0 && (s.maxBitrate = n), s;
|
|
232
|
-
},
|
|
233
|
-
|
|
232
|
+
}, gt = 1, Un = Nt(
|
|
233
|
+
gt
|
|
234
234
|
), Ln = (s, e) => {
|
|
235
|
-
const t = s === void 0 ? void 0 : Math.max(s,
|
|
235
|
+
const t = s === void 0 ? void 0 : Math.max(s, gt);
|
|
236
236
|
if (t !== void 0 && Un(
|
|
237
237
|
t,
|
|
238
238
|
e
|
|
@@ -288,9 +288,9 @@ const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, be = (s) =>
|
|
|
288
288
|
const n = pn(s, e);
|
|
289
289
|
if (n)
|
|
290
290
|
return qn(n, { maxBitrate: t });
|
|
291
|
-
}, xn = 486, Vn = 487,
|
|
291
|
+
}, xn = 486, Vn = 487, x = "local", Le = "remote", Yn = 3, Gn = 1, ls = (s = new Error()) => {
|
|
292
292
|
const { originator: e, cause: t } = s;
|
|
293
|
-
return It(s) ? !0 : typeof t == "string" ? t ===
|
|
293
|
+
return It(s) ? !0 : typeof t == "string" ? t === He || t === We || e === x && (t === Be || t === ke) : !1;
|
|
294
294
|
}, C = "SipConnector", $n = "channels", Jn = "WebcastStarted", Xn = "WebcastStopped", zn = "accountChanged", Qn = "accountDeleted", jn = "addedToListModerators", Kn = "removedFromListModerators", Zn = "ParticipationRequestAccepted", es = "ParticipationRequestRejected", ts = "ParticipantMovedToWebcast", ns = "ConferenceParticipantTokenIssued";
|
|
295
295
|
class Ts {
|
|
296
296
|
constructor({ JsSIP: e }) {
|
|
@@ -328,11 +328,11 @@ class Ts {
|
|
|
328
328
|
o(this, "tryRegister", async () => {
|
|
329
329
|
if (!this.isRegisterConfig)
|
|
330
330
|
throw new Error("Config is not registered");
|
|
331
|
-
this._uaEvents.trigger(
|
|
331
|
+
this._uaEvents.trigger(W, void 0);
|
|
332
332
|
try {
|
|
333
333
|
await this.unregister();
|
|
334
334
|
} catch (e) {
|
|
335
|
-
|
|
335
|
+
B("tryRegister", e);
|
|
336
336
|
}
|
|
337
337
|
return this.register();
|
|
338
338
|
});
|
|
@@ -342,7 +342,7 @@ class Ts {
|
|
|
342
342
|
return;
|
|
343
343
|
}
|
|
344
344
|
const i = this.incomingSession, r = this.remoteCallerData;
|
|
345
|
-
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(
|
|
345
|
+
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(G, r), t(i.terminate({ status_code: e }));
|
|
346
346
|
}));
|
|
347
347
|
o(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: xn }));
|
|
348
348
|
o(this, "removeIncomingSession", () => {
|
|
@@ -354,7 +354,7 @@ class Ts {
|
|
|
354
354
|
const c = !!((d = this.ua) != null && d.isConnected()) && this.hasEqualConnectionConfiguration(e), E = !!r && !On(r);
|
|
355
355
|
return c || E;
|
|
356
356
|
};
|
|
357
|
-
return this._cancelableConnectWithRepeatedCalls =
|
|
357
|
+
return this._cancelableConnectWithRepeatedCalls = Me({
|
|
358
358
|
targetFunction: n,
|
|
359
359
|
isComplete: i,
|
|
360
360
|
callLimit: t,
|
|
@@ -370,12 +370,12 @@ class Ts {
|
|
|
370
370
|
});
|
|
371
371
|
});
|
|
372
372
|
o(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
373
|
-
if (e ===
|
|
373
|
+
if (e === Le) {
|
|
374
374
|
this.incomingSession = t;
|
|
375
375
|
const n = this.remoteCallerData;
|
|
376
|
-
t.on(
|
|
377
|
-
this.removeIncomingSession(), i.originator ===
|
|
378
|
-
}), this._uaEvents.trigger(
|
|
376
|
+
t.on(R, (i) => {
|
|
377
|
+
this.removeIncomingSession(), i.originator === x ? this._uaEvents.trigger(J, n) : this._uaEvents.trigger($, n);
|
|
378
|
+
}), this._uaEvents.trigger(Y, n);
|
|
379
379
|
}
|
|
380
380
|
});
|
|
381
381
|
o(this, "_connect", async (e) => this.initUa(e).then(async () => this._start()));
|
|
@@ -390,41 +390,41 @@ class Ts {
|
|
|
390
390
|
connectionRecoveryMinInterval: E,
|
|
391
391
|
connectionRecoveryMaxInterval: d,
|
|
392
392
|
userAgent: _,
|
|
393
|
-
displayName:
|
|
394
|
-
register:
|
|
393
|
+
displayName: l = "",
|
|
394
|
+
register: h = !1,
|
|
395
395
|
extraHeaders: T = []
|
|
396
396
|
}) => {
|
|
397
397
|
if (!n)
|
|
398
398
|
throw new Error("sipServerUrl is required");
|
|
399
399
|
if (!i)
|
|
400
400
|
throw new Error("sipWebSocketServerURL is required");
|
|
401
|
-
if (
|
|
401
|
+
if (h && !e)
|
|
402
402
|
throw new Error("user is required for authorized connection");
|
|
403
|
-
if (
|
|
403
|
+
if (h && !t)
|
|
404
404
|
throw new Error("password is required for authorized connection");
|
|
405
405
|
this._connectionConfiguration = {
|
|
406
406
|
sipServerUrl: n,
|
|
407
|
-
displayName:
|
|
408
|
-
register:
|
|
407
|
+
displayName: l,
|
|
408
|
+
register: h,
|
|
409
409
|
user: e,
|
|
410
410
|
password: t
|
|
411
411
|
};
|
|
412
|
-
const { configuration:
|
|
412
|
+
const { configuration: u, helpers: S } = this.createUaConfiguration({
|
|
413
413
|
user: e,
|
|
414
414
|
sipServerUrl: n,
|
|
415
415
|
sipWebSocketServerURL: i,
|
|
416
416
|
password: t,
|
|
417
|
-
displayName:
|
|
418
|
-
register:
|
|
417
|
+
displayName: l,
|
|
418
|
+
register: h,
|
|
419
419
|
sessionTimers: a,
|
|
420
420
|
registerExpires: c,
|
|
421
421
|
connectionRecoveryMinInterval: E,
|
|
422
422
|
connectionRecoveryMaxInterval: d,
|
|
423
423
|
userAgent: _
|
|
424
424
|
});
|
|
425
|
-
return this.getSipServerUrl =
|
|
426
|
-
const
|
|
427
|
-
|
|
425
|
+
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 De = me.find((Ct) => Ct === k);
|
|
427
|
+
De && this.ua && this.ua.on(De, A);
|
|
428
428
|
}), this.ua;
|
|
429
429
|
});
|
|
430
430
|
o(this, "_createUa", ({
|
|
@@ -446,11 +446,11 @@ class Ts {
|
|
|
446
446
|
}, r = (E) => {
|
|
447
447
|
c(), t(E);
|
|
448
448
|
}, a = () => {
|
|
449
|
-
this.isRegisterConfig ? (this.on(
|
|
449
|
+
this.isRegisterConfig ? (this.on(P, i), this.on(O, r)) : this.on(m, i), this.on(N, r);
|
|
450
450
|
}, c = () => {
|
|
451
|
-
this.off(
|
|
451
|
+
this.off(P, i), this.off(O, r), this.off(m, i), this.off(N, r);
|
|
452
452
|
};
|
|
453
|
-
a(), this.on(
|
|
453
|
+
a(), this.on(v, this.handleNewRTCSession), n.start();
|
|
454
454
|
}));
|
|
455
455
|
o(this, "_set", async ({ displayName: e, password: t }) => new Promise((n, i) => {
|
|
456
456
|
const { ua: r } = this;
|
|
@@ -459,7 +459,7 @@ class Ts {
|
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
461
|
let a = !1, c = !1;
|
|
462
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = r.set("display_name",
|
|
462
|
+
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = r.set("display_name", Ue(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = r.set("password", t), this._connectionConfiguration.password = t);
|
|
463
463
|
const E = a || c;
|
|
464
464
|
c && this.isRegisterConfig ? this.register().then(() => {
|
|
465
465
|
n(E);
|
|
@@ -469,13 +469,13 @@ class Ts {
|
|
|
469
469
|
}));
|
|
470
470
|
o(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
|
|
471
471
|
o(this, "_disconnect", async () => {
|
|
472
|
-
this.off(
|
|
472
|
+
this.off(v, this.handleNewRTCSession);
|
|
473
473
|
const e = new Promise((t) => {
|
|
474
|
-
this.once(
|
|
474
|
+
this.once(N, () => {
|
|
475
475
|
delete this.ua, t();
|
|
476
476
|
});
|
|
477
477
|
});
|
|
478
|
-
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(
|
|
478
|
+
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(N, void 0)) : this._uaEvents.trigger(N, void 0), e;
|
|
479
479
|
});
|
|
480
480
|
o(this, "_call", async ({
|
|
481
481
|
number: e,
|
|
@@ -485,36 +485,38 @@ class Ts {
|
|
|
485
485
|
iceServers: r,
|
|
486
486
|
videoMode: a,
|
|
487
487
|
audioMode: c,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
488
|
+
contentHint: E,
|
|
489
|
+
offerToReceiveAudio: d = !0,
|
|
490
|
+
offerToReceiveVideo: _ = !0,
|
|
491
|
+
sendEncodings: l,
|
|
492
|
+
onAddedTransceiver: h
|
|
493
|
+
}) => new Promise((T, u) => {
|
|
494
|
+
const { ua: S } = this;
|
|
495
|
+
if (!S) {
|
|
496
|
+
u(new Error("this.ua is not initialized"));
|
|
496
497
|
return;
|
|
497
498
|
}
|
|
498
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: i }).then(
|
|
499
|
-
|
|
500
|
-
}), this.session =
|
|
499
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: i }).then(T).catch((A) => {
|
|
500
|
+
u(A);
|
|
501
|
+
}), this.session = S.call(this.getSipServerUrl(e), {
|
|
501
502
|
extraHeaders: n,
|
|
502
|
-
mediaStream:
|
|
503
|
+
mediaStream: M(t, {
|
|
503
504
|
videoMode: a,
|
|
504
505
|
audioMode: c,
|
|
505
|
-
contentHint:
|
|
506
|
+
contentHint: E
|
|
506
507
|
}),
|
|
507
508
|
eventHandlers: this._sessionEvents.triggers,
|
|
508
509
|
videoMode: a,
|
|
509
510
|
audioMode: c,
|
|
510
|
-
onAddedSender: E,
|
|
511
511
|
pcConfig: {
|
|
512
512
|
iceServers: r
|
|
513
513
|
},
|
|
514
514
|
rtcOfferConstraints: {
|
|
515
|
-
offerToReceiveAudio:
|
|
516
|
-
offerToReceiveVideo:
|
|
517
|
-
}
|
|
515
|
+
offerToReceiveAudio: d,
|
|
516
|
+
offerToReceiveVideo: _
|
|
517
|
+
},
|
|
518
|
+
sendEncodings: l,
|
|
519
|
+
onAddedTransceiver: h
|
|
518
520
|
});
|
|
519
521
|
}));
|
|
520
522
|
o(this, "_answer", async ({
|
|
@@ -524,60 +526,62 @@ class Ts {
|
|
|
524
526
|
iceServers: i,
|
|
525
527
|
videoMode: r,
|
|
526
528
|
audioMode: a,
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
529
|
+
contentHint: c,
|
|
530
|
+
sendEncodings: E,
|
|
531
|
+
onAddedTransceiver: d
|
|
532
|
+
}) => new Promise((_, l) => {
|
|
530
533
|
if (!this.isAvailableIncomingCall) {
|
|
531
|
-
|
|
534
|
+
l(new Error("no incomingSession"));
|
|
532
535
|
return;
|
|
533
536
|
}
|
|
534
537
|
this.session = this.incomingSession, this.removeIncomingSession();
|
|
535
538
|
const { session: h } = this;
|
|
536
539
|
if (!h) {
|
|
537
|
-
|
|
540
|
+
l(new Error("No session established"));
|
|
538
541
|
return;
|
|
539
542
|
}
|
|
540
|
-
this._sessionEvents.eachTriggers((
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(
|
|
544
|
-
|
|
543
|
+
this._sessionEvents.eachTriggers((u, S) => {
|
|
544
|
+
const A = Pe.find((k) => k === S);
|
|
545
|
+
A && h.on(A, u);
|
|
546
|
+
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(_).catch((u) => {
|
|
547
|
+
l(u);
|
|
545
548
|
});
|
|
546
|
-
const
|
|
549
|
+
const T = M(e, {
|
|
547
550
|
videoMode: r,
|
|
548
551
|
audioMode: a,
|
|
549
|
-
contentHint:
|
|
552
|
+
contentHint: c
|
|
550
553
|
});
|
|
551
554
|
h.answer({
|
|
552
555
|
extraHeaders: n,
|
|
553
556
|
videoMode: r,
|
|
554
557
|
audioMode: a,
|
|
555
|
-
|
|
556
|
-
mediaStream: l,
|
|
558
|
+
mediaStream: T,
|
|
557
559
|
pcConfig: {
|
|
558
560
|
iceServers: i
|
|
559
|
-
}
|
|
561
|
+
},
|
|
562
|
+
sendEncodings: E,
|
|
563
|
+
onAddedTransceiver: d
|
|
560
564
|
});
|
|
561
565
|
}));
|
|
562
566
|
o(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
|
|
563
567
|
const i = () => {
|
|
564
|
-
this.onSession(
|
|
568
|
+
this.onSession(L, _), this.onSession(U, l);
|
|
565
569
|
}, r = () => {
|
|
566
|
-
this.offSession(
|
|
570
|
+
this.offSession(L, _), this.offSession(U, l);
|
|
567
571
|
}, a = () => {
|
|
568
|
-
this.onSession(
|
|
572
|
+
this.onSession(R, E), this.onSession(D, E);
|
|
569
573
|
}, c = () => {
|
|
570
|
-
this.offSession(
|
|
571
|
-
}, E = (
|
|
572
|
-
r(), c(), n(
|
|
574
|
+
this.offSession(R, E), this.offSession(D, E);
|
|
575
|
+
}, E = (h) => {
|
|
576
|
+
r(), c(), n(h);
|
|
573
577
|
};
|
|
574
578
|
let d;
|
|
575
|
-
const _ = ({ peerconnection:
|
|
576
|
-
d =
|
|
577
|
-
this._sessionEvents.trigger(
|
|
579
|
+
const _ = ({ peerconnection: h }) => {
|
|
580
|
+
d = h, d.ontrack = (T) => {
|
|
581
|
+
this._sessionEvents.trigger(ne, d), e && e(T);
|
|
578
582
|
};
|
|
579
|
-
},
|
|
580
|
-
d && this._sessionEvents.trigger(
|
|
583
|
+
}, l = () => {
|
|
584
|
+
d && this._sessionEvents.trigger(te, d), r(), c(), t(d);
|
|
581
585
|
};
|
|
582
586
|
i(), a();
|
|
583
587
|
}));
|
|
@@ -590,8 +594,8 @@ class Ts {
|
|
|
590
594
|
n(new Error("No session established"));
|
|
591
595
|
return;
|
|
592
596
|
}
|
|
593
|
-
this.onceSession(
|
|
594
|
-
r ===
|
|
597
|
+
this.onceSession(Re, ({ originator: r }) => {
|
|
598
|
+
r === x && t();
|
|
595
599
|
}), i.sendDTMF(e, {
|
|
596
600
|
duration: 120,
|
|
597
601
|
interToneGap: 600
|
|
@@ -604,7 +608,7 @@ class Ts {
|
|
|
604
608
|
try {
|
|
605
609
|
await this.stopPresentation();
|
|
606
610
|
} catch (t) {
|
|
607
|
-
|
|
611
|
+
B("error stop presentation: ", t);
|
|
608
612
|
}
|
|
609
613
|
if (this._restoreSession(), !e.isEnded())
|
|
610
614
|
return e.terminateAsync();
|
|
@@ -612,10 +616,6 @@ class Ts {
|
|
|
612
616
|
});
|
|
613
617
|
o(this, "_handleShareState", (e) => {
|
|
614
618
|
switch (e) {
|
|
615
|
-
case lt: {
|
|
616
|
-
this._sessionEvents.trigger(z, void 0);
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
619
|
case Tt: {
|
|
620
620
|
this._sessionEvents.trigger(Q, void 0);
|
|
621
621
|
break;
|
|
@@ -624,16 +624,20 @@ class Ts {
|
|
|
624
624
|
this._sessionEvents.trigger(j, void 0);
|
|
625
625
|
break;
|
|
626
626
|
}
|
|
627
|
+
case St: {
|
|
628
|
+
this._sessionEvents.trigger(K, void 0);
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
627
631
|
}
|
|
628
632
|
});
|
|
629
633
|
o(this, "_maybeTriggerChannels", (e) => {
|
|
630
|
-
const t = e.getHeader(
|
|
634
|
+
const t = e.getHeader(ye), n = e.getHeader(we);
|
|
631
635
|
if (t && n) {
|
|
632
636
|
const i = {
|
|
633
637
|
inputChannels: t,
|
|
634
638
|
outputChannels: n
|
|
635
639
|
};
|
|
636
|
-
this._sessionEvents.trigger(
|
|
640
|
+
this._sessionEvents.trigger(w, i);
|
|
637
641
|
}
|
|
638
642
|
});
|
|
639
643
|
o(this, "_handleNotify", (e) => {
|
|
@@ -692,7 +696,7 @@ class Ts {
|
|
|
692
696
|
break;
|
|
693
697
|
}
|
|
694
698
|
default:
|
|
695
|
-
|
|
699
|
+
B("unknown cmd", e.cmd);
|
|
696
700
|
}
|
|
697
701
|
});
|
|
698
702
|
o(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
@@ -702,7 +706,7 @@ class Ts {
|
|
|
702
706
|
conference: e
|
|
703
707
|
};
|
|
704
708
|
this._uaEvents.trigger(
|
|
705
|
-
|
|
709
|
+
de,
|
|
706
710
|
t
|
|
707
711
|
);
|
|
708
712
|
});
|
|
@@ -710,27 +714,27 @@ class Ts {
|
|
|
710
714
|
const t = {
|
|
711
715
|
conference: e
|
|
712
716
|
};
|
|
713
|
-
this._uaEvents.trigger(
|
|
717
|
+
this._uaEvents.trigger(Ee, t);
|
|
714
718
|
});
|
|
715
719
|
o(this, "_triggerWebcastStartedNotify", ({ body: { conference: e, type: t } }) => {
|
|
716
720
|
const n = {
|
|
717
721
|
conference: e,
|
|
718
722
|
type: t
|
|
719
723
|
};
|
|
720
|
-
this._uaEvents.trigger(
|
|
724
|
+
this._uaEvents.trigger(Se, n);
|
|
721
725
|
});
|
|
722
726
|
o(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
|
|
723
727
|
const n = {
|
|
724
728
|
conference: e,
|
|
725
729
|
type: t
|
|
726
730
|
};
|
|
727
|
-
this._uaEvents.trigger(
|
|
731
|
+
this._uaEvents.trigger(Ne, n);
|
|
728
732
|
});
|
|
729
733
|
o(this, "_triggerAccountChangedNotify", () => {
|
|
730
|
-
this._uaEvents.trigger(
|
|
734
|
+
this._uaEvents.trigger(ge, void 0);
|
|
731
735
|
});
|
|
732
736
|
o(this, "_triggerAccountDeletedNotify", () => {
|
|
733
|
-
this._uaEvents.trigger(
|
|
737
|
+
this._uaEvents.trigger(Ce, void 0);
|
|
734
738
|
});
|
|
735
739
|
o(this, "_triggerConferenceParticipantTokenIssued", ({
|
|
736
740
|
body: { conference: e, participant: t, jwt: n }
|
|
@@ -741,7 +745,7 @@ class Ts {
|
|
|
741
745
|
jwt: n
|
|
742
746
|
};
|
|
743
747
|
this._uaEvents.trigger(
|
|
744
|
-
|
|
748
|
+
Ae,
|
|
745
749
|
i
|
|
746
750
|
);
|
|
747
751
|
});
|
|
@@ -750,7 +754,7 @@ class Ts {
|
|
|
750
754
|
inputChannels: t,
|
|
751
755
|
outputChannels: n
|
|
752
756
|
};
|
|
753
|
-
this._uaEvents.trigger(
|
|
757
|
+
this._uaEvents.trigger(se, i);
|
|
754
758
|
});
|
|
755
759
|
o(this, "_triggerParticipationAcceptingWordRequest", ({
|
|
756
760
|
body: { conference: e }
|
|
@@ -758,7 +762,7 @@ class Ts {
|
|
|
758
762
|
const t = {
|
|
759
763
|
conference: e
|
|
760
764
|
};
|
|
761
|
-
this._uaEvents.trigger(
|
|
765
|
+
this._uaEvents.trigger(Te, t);
|
|
762
766
|
});
|
|
763
767
|
o(this, "_triggerParticipationCancellingWordRequest", ({
|
|
764
768
|
body: { conference: e }
|
|
@@ -766,7 +770,7 @@ class Ts {
|
|
|
766
770
|
const t = {
|
|
767
771
|
conference: e
|
|
768
772
|
};
|
|
769
|
-
this._uaEvents.trigger(
|
|
773
|
+
this._uaEvents.trigger(ue, t);
|
|
770
774
|
});
|
|
771
775
|
o(this, "_triggerParticipantMoveRequestToStream", ({
|
|
772
776
|
body: { conference: e }
|
|
@@ -774,43 +778,43 @@ class Ts {
|
|
|
774
778
|
const t = {
|
|
775
779
|
conference: e
|
|
776
780
|
};
|
|
777
|
-
this._uaEvents.trigger(
|
|
781
|
+
this._uaEvents.trigger(he, t);
|
|
778
782
|
});
|
|
779
783
|
o(this, "_triggerEnterRoom", (e) => {
|
|
780
784
|
const t = e.getHeader(Yt), n = e.getHeader(Kt);
|
|
781
|
-
this._sessionEvents.trigger(
|
|
785
|
+
this._sessionEvents.trigger(Z, { room: t, participantName: n });
|
|
782
786
|
});
|
|
783
787
|
o(this, "_triggerShareState", (e) => {
|
|
784
|
-
const t = e.getHeader(
|
|
785
|
-
this._sessionEvents.trigger(
|
|
788
|
+
const t = e.getHeader(I);
|
|
789
|
+
this._sessionEvents.trigger(y, t);
|
|
786
790
|
});
|
|
787
791
|
o(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
788
|
-
e.getHeader(cn) ===
|
|
792
|
+
e.getHeader(cn) === ct && this._sessionEvents.trigger(le, void 0);
|
|
789
793
|
});
|
|
790
794
|
o(this, "_triggerMainCamControl", (e) => {
|
|
791
|
-
const t = e.getHeader(Zt), n = e.getHeader(
|
|
792
|
-
if (t ===
|
|
793
|
-
this._sessionEvents.trigger(
|
|
795
|
+
const t = e.getHeader(Zt), n = e.getHeader(be), i = n === F.ADMIN_SYNC_FORCED;
|
|
796
|
+
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
797
|
+
this._sessionEvents.trigger(ae, { isSyncForced: i });
|
|
794
798
|
return;
|
|
795
799
|
}
|
|
796
|
-
if (t ===
|
|
797
|
-
this._sessionEvents.trigger(
|
|
800
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
801
|
+
this._sessionEvents.trigger(re, { isSyncForced: i });
|
|
798
802
|
return;
|
|
799
803
|
}
|
|
800
|
-
(t ===
|
|
804
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(b, { isSyncForced: i });
|
|
801
805
|
const r = e.getHeader(tn);
|
|
802
|
-
this._sessionEvents.trigger(
|
|
806
|
+
this._sessionEvents.trigger(oe, {
|
|
803
807
|
mainCam: t,
|
|
804
808
|
resolutionMainCam: r
|
|
805
809
|
});
|
|
806
810
|
});
|
|
807
811
|
o(this, "_triggerMicControl", (e) => {
|
|
808
|
-
const t = e.getHeader(en), i = e.getHeader(
|
|
809
|
-
t ===
|
|
812
|
+
const t = e.getHeader(en), i = e.getHeader(be) === F.ADMIN_SYNC_FORCED;
|
|
813
|
+
t === q.ADMIN_START_MIC ? this._sessionEvents.trigger(_e, { isSyncForced: i }) : t === q.ADMIN_STOP_MIC && this._sessionEvents.trigger(ce, { isSyncForced: i });
|
|
810
814
|
});
|
|
811
815
|
o(this, "_triggerUseLicense", (e) => {
|
|
812
816
|
const t = e.getHeader(jt);
|
|
813
|
-
this._sessionEvents.trigger(
|
|
817
|
+
this._sessionEvents.trigger(ee, t);
|
|
814
818
|
});
|
|
815
819
|
o(this, "_handleNewInfo", (e) => {
|
|
816
820
|
const { originator: t } = e;
|
|
@@ -827,11 +831,11 @@ class Ts {
|
|
|
827
831
|
this._maybeHandleNotify(n);
|
|
828
832
|
break;
|
|
829
833
|
}
|
|
830
|
-
case
|
|
834
|
+
case p: {
|
|
831
835
|
this._triggerShareState(n);
|
|
832
836
|
break;
|
|
833
837
|
}
|
|
834
|
-
case
|
|
838
|
+
case ve: {
|
|
835
839
|
this._triggerMainCamControl(n);
|
|
836
840
|
break;
|
|
837
841
|
}
|
|
@@ -861,9 +865,9 @@ class Ts {
|
|
|
861
865
|
});
|
|
862
866
|
o(this, "_handleEnded", (e) => {
|
|
863
867
|
const { originator: t } = e;
|
|
864
|
-
t ===
|
|
868
|
+
t === Le && this._sessionEvents.trigger(ie, e), this._restoreSession();
|
|
865
869
|
});
|
|
866
|
-
this.JsSIP = e, this._sessionEvents = new
|
|
870
|
+
this.JsSIP = e, this._sessionEvents = new pe(lt), this._uaEvents = new pe(ht), this._cancelableConnect = new g(
|
|
867
871
|
this._connect,
|
|
868
872
|
{
|
|
869
873
|
moduleName: C,
|
|
@@ -882,16 +886,16 @@ class Ts {
|
|
|
882
886
|
}), this._cancelableCall = new g(
|
|
883
887
|
this._call,
|
|
884
888
|
{ moduleName: C }
|
|
885
|
-
), this._cancelableAnswer = new g(this._answer, { moduleName: C }), this._cancelableSendDTMF = new g(this._sendDTMF, { moduleName: C }), this.onSession(
|
|
889
|
+
), this._cancelableAnswer = new g(this._answer, { moduleName: C }), this._cancelableSendDTMF = new g(this._sendDTMF, { moduleName: C }), this.onSession(y, this._handleShareState), this.onSession(Ie, this._handleNewInfo), this.on(z, this._handleSipEvent), this.onSession(R, this._handleEnded), this.onSession(D, this._handleEnded);
|
|
886
890
|
}
|
|
887
891
|
async register() {
|
|
888
892
|
return new Promise((e, t) => {
|
|
889
|
-
this.isRegisterConfig && this.ua ? (this.ua.on(
|
|
893
|
+
this.isRegisterConfig && this.ua ? (this.ua.on(P, e), this.ua.on(O, t), this.ua.register()) : t(new Error("Config is not registered"));
|
|
890
894
|
});
|
|
891
895
|
}
|
|
892
896
|
async unregister() {
|
|
893
897
|
return new Promise((e, t) => {
|
|
894
|
-
this.isRegistered && this.ua ? (this.ua.on(
|
|
898
|
+
this.isRegistered && this.ua ? (this.ua.on(X, e), this.ua.unregister()) : t(new Error("ua is not registered"));
|
|
895
899
|
});
|
|
896
900
|
}
|
|
897
901
|
async sendOptions(e, t, n) {
|
|
@@ -934,28 +938,28 @@ class Ts {
|
|
|
934
938
|
displayName: t,
|
|
935
939
|
userAgent: e,
|
|
936
940
|
sipServerUrl: n
|
|
937
|
-
}), _ = this._createUa({ ...d, remoteAddress: r, extraHeaders: a }),
|
|
941
|
+
}), _ = this._createUa({ ...d, remoteAddress: r, extraHeaders: a }), l = () => {
|
|
938
942
|
const T = new Error("Telephony is not available");
|
|
939
943
|
E(T);
|
|
940
944
|
};
|
|
941
|
-
_.once(
|
|
942
|
-
const
|
|
943
|
-
_.removeAllListeners(), _.once(
|
|
945
|
+
_.once(N, l);
|
|
946
|
+
const h = () => {
|
|
947
|
+
_.removeAllListeners(), _.once(N, c), _.stop();
|
|
944
948
|
};
|
|
945
|
-
_.once(
|
|
949
|
+
_.once(m, h), _.start();
|
|
946
950
|
});
|
|
947
951
|
}
|
|
948
952
|
async replaceMediaStream(e, t) {
|
|
949
953
|
if (!this.session)
|
|
950
954
|
throw new Error("No session established");
|
|
951
|
-
const { contentHint: n } = t || {}, i =
|
|
955
|
+
const { contentHint: n } = t || {}, i = M(e, { contentHint: n });
|
|
952
956
|
return this.session.replaceMediaStream(i, t);
|
|
953
957
|
}
|
|
954
958
|
async askPermissionToEnableCam(e = {}) {
|
|
955
959
|
if (!this.session)
|
|
956
960
|
throw new Error("No session established");
|
|
957
961
|
const t = [Nn];
|
|
958
|
-
return this.session.sendInfo(
|
|
962
|
+
return this.session.sendInfo(ve, void 0, {
|
|
959
963
|
noTerminateWhenError: !0,
|
|
960
964
|
...e,
|
|
961
965
|
extraHeaders: t
|
|
@@ -976,7 +980,7 @@ class Ts {
|
|
|
976
980
|
}
|
|
977
981
|
}) {
|
|
978
982
|
const r = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
979
|
-
return this._cancelableSendPresentationWithRepeatedCalls =
|
|
983
|
+
return this._cancelableSendPresentationWithRepeatedCalls = Me({
|
|
980
984
|
targetFunction: r,
|
|
981
985
|
isComplete: a,
|
|
982
986
|
isRejectAsValid: !0,
|
|
@@ -1000,52 +1004,56 @@ class Ts {
|
|
|
1000
1004
|
// 5 minutes in sec
|
|
1001
1005
|
connectionRecoveryMinInterval: d = 2,
|
|
1002
1006
|
connectionRecoveryMaxInterval: _ = 6,
|
|
1003
|
-
userAgent:
|
|
1007
|
+
userAgent: l
|
|
1004
1008
|
}) {
|
|
1005
1009
|
if (a && !t)
|
|
1006
1010
|
throw new Error("password is required for authorized connection");
|
|
1007
|
-
const
|
|
1011
|
+
const h = a && e ? e.trim() : `${In()}`, T = An(r), u = T(h), S = new this.JsSIP.WebSocketInterface(n);
|
|
1008
1012
|
return {
|
|
1009
1013
|
configuration: {
|
|
1010
1014
|
password: t,
|
|
1011
1015
|
register: a,
|
|
1012
|
-
uri:
|
|
1013
|
-
display_name:
|
|
1014
|
-
user_agent:
|
|
1016
|
+
uri: u,
|
|
1017
|
+
display_name: Ue(i),
|
|
1018
|
+
user_agent: l,
|
|
1015
1019
|
sdp_semantics: "unified-plan",
|
|
1016
|
-
sockets: [
|
|
1020
|
+
sockets: [S],
|
|
1017
1021
|
session_timers: c,
|
|
1018
1022
|
register_expires: E,
|
|
1019
1023
|
connection_recovery_min_interval: d,
|
|
1020
1024
|
connection_recovery_max_interval: _
|
|
1021
1025
|
},
|
|
1022
1026
|
helpers: {
|
|
1023
|
-
socket:
|
|
1027
|
+
socket: S,
|
|
1024
1028
|
getSipServerUrl: T
|
|
1025
1029
|
}
|
|
1026
1030
|
};
|
|
1027
1031
|
}
|
|
1028
1032
|
async _sendPresentation(e, t, {
|
|
1029
|
-
maxBitrate: n =
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1033
|
+
maxBitrate: n = _t,
|
|
1034
|
+
isNeedReinvite: i = !0,
|
|
1035
|
+
isP2P: r = !1,
|
|
1036
|
+
contentHint: a = "detail",
|
|
1037
|
+
sendEncodings: c,
|
|
1038
|
+
onAddedTransceiver: E
|
|
1034
1039
|
}) {
|
|
1035
|
-
const
|
|
1036
|
-
this._streamPresentationCurrent =
|
|
1037
|
-
const
|
|
1038
|
-
extraHeaders:
|
|
1039
|
-
}).then(async () => e.startPresentation(
|
|
1040
|
+
const d = M(t, { contentHint: a });
|
|
1041
|
+
this._streamPresentationCurrent = d;
|
|
1042
|
+
const _ = r ? [Tn] : [dn], l = e.sendInfo(p, void 0, {
|
|
1043
|
+
extraHeaders: _
|
|
1044
|
+
}).then(async () => e.startPresentation(d, i, {
|
|
1045
|
+
sendEncodings: c,
|
|
1046
|
+
onAddedTransceiver: E
|
|
1047
|
+
})).then(async () => {
|
|
1040
1048
|
const { connection: h } = this;
|
|
1041
1049
|
if (!h || n === void 0)
|
|
1042
1050
|
return;
|
|
1043
|
-
const
|
|
1044
|
-
await Fn(
|
|
1051
|
+
const T = h.getSenders();
|
|
1052
|
+
await Fn(T, t, n);
|
|
1045
1053
|
}).then(() => t).catch((h) => {
|
|
1046
|
-
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(
|
|
1054
|
+
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(H, h), h;
|
|
1047
1055
|
});
|
|
1048
|
-
return this.promisePendingStartPresentation =
|
|
1056
|
+
return this.promisePendingStartPresentation = l, l.finally(() => {
|
|
1049
1057
|
this.promisePendingStartPresentation = void 0;
|
|
1050
1058
|
});
|
|
1051
1059
|
}
|
|
@@ -1053,29 +1061,31 @@ class Ts {
|
|
|
1053
1061
|
isNeedReinvite: t,
|
|
1054
1062
|
isP2P: n,
|
|
1055
1063
|
maxBitrate: i,
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1064
|
+
contentHint: r,
|
|
1065
|
+
sendEncodings: a,
|
|
1066
|
+
onAddedTransceiver: c
|
|
1067
|
+
} = {}, E) {
|
|
1068
|
+
const d = this.establishedSession;
|
|
1069
|
+
if (!d)
|
|
1061
1070
|
throw new Error("No session established");
|
|
1062
1071
|
if (this._streamPresentationCurrent)
|
|
1063
1072
|
throw new Error("Presentation is already started");
|
|
1064
|
-
return n && await this.sendMustStopPresentation(
|
|
1065
|
-
session:
|
|
1073
|
+
return n && await this.sendMustStopPresentation(d), this._sendPresentationWithDuplicatedCalls({
|
|
1074
|
+
session: d,
|
|
1066
1075
|
stream: e,
|
|
1067
1076
|
presentationOptions: {
|
|
1068
1077
|
isNeedReinvite: t,
|
|
1069
1078
|
isP2P: n,
|
|
1070
1079
|
maxBitrate: i,
|
|
1071
|
-
|
|
1072
|
-
|
|
1080
|
+
contentHint: r,
|
|
1081
|
+
sendEncodings: a,
|
|
1082
|
+
onAddedTransceiver: c
|
|
1073
1083
|
},
|
|
1074
|
-
options:
|
|
1084
|
+
options: E
|
|
1075
1085
|
});
|
|
1076
1086
|
}
|
|
1077
1087
|
async sendMustStopPresentation(e) {
|
|
1078
|
-
await e.sendInfo(
|
|
1088
|
+
await e.sendInfo(p, void 0, {
|
|
1079
1089
|
extraHeaders: [ln]
|
|
1080
1090
|
});
|
|
1081
1091
|
}
|
|
@@ -1086,31 +1096,33 @@ class Ts {
|
|
|
1086
1096
|
const t = this._streamPresentationCurrent;
|
|
1087
1097
|
let n = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
1088
1098
|
const i = e ? [un] : [hn], r = this.establishedSession;
|
|
1089
|
-
return r && t && (n = n.then(async () => r.sendInfo(
|
|
1099
|
+
return r && t && (n = n.then(async () => r.sendInfo(p, void 0, {
|
|
1090
1100
|
extraHeaders: i
|
|
1091
1101
|
})).then(async () => r.stopPresentation(t)).catch((a) => {
|
|
1092
|
-
throw this._sessionEvents.trigger(
|
|
1093
|
-
})), !r && t && this._sessionEvents.trigger(
|
|
1102
|
+
throw this._sessionEvents.trigger(H, a), a;
|
|
1103
|
+
})), !r && t && this._sessionEvents.trigger(fe, t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
1094
1104
|
this._resetPresentation();
|
|
1095
1105
|
});
|
|
1096
1106
|
}
|
|
1097
1107
|
async updatePresentation(e, {
|
|
1098
1108
|
isP2P: t,
|
|
1099
1109
|
maxBitrate: n,
|
|
1100
|
-
|
|
1101
|
-
|
|
1110
|
+
contentHint: i,
|
|
1111
|
+
sendEncodings: r,
|
|
1112
|
+
onAddedTransceiver: a
|
|
1102
1113
|
} = {}) {
|
|
1103
|
-
const
|
|
1104
|
-
if (!
|
|
1114
|
+
const c = this.establishedSession;
|
|
1115
|
+
if (!c)
|
|
1105
1116
|
throw new Error("No session established");
|
|
1106
1117
|
if (!this._streamPresentationCurrent)
|
|
1107
1118
|
throw new Error("Presentation has not started yet");
|
|
1108
|
-
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(
|
|
1119
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(c, e, {
|
|
1109
1120
|
isP2P: t,
|
|
1110
1121
|
maxBitrate: n,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1122
|
+
contentHint: i,
|
|
1123
|
+
isNeedReinvite: !1,
|
|
1124
|
+
sendEncodings: r,
|
|
1125
|
+
onAddedTransceiver: a
|
|
1114
1126
|
});
|
|
1115
1127
|
}
|
|
1116
1128
|
_removeStreamPresentationCurrent() {
|
|
@@ -1237,15 +1249,15 @@ class Ts {
|
|
|
1237
1249
|
this._cancelableAnswer.cancelRequest(), this._cancelableSendDTMF.cancelRequest();
|
|
1238
1250
|
}
|
|
1239
1251
|
async waitChannels() {
|
|
1240
|
-
return this.waitSession(
|
|
1252
|
+
return this.waitSession(w);
|
|
1241
1253
|
}
|
|
1242
1254
|
async waitSyncMediaState() {
|
|
1243
|
-
return this.waitSession(
|
|
1255
|
+
return this.waitSession(b);
|
|
1244
1256
|
}
|
|
1245
1257
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1246
1258
|
if (!this.session)
|
|
1247
1259
|
throw new Error("No session established");
|
|
1248
|
-
const n = `${
|
|
1260
|
+
const n = `${ye}: ${e}`, i = `${we}: ${t}`, r = [
|
|
1249
1261
|
n,
|
|
1250
1262
|
i
|
|
1251
1263
|
];
|
|
@@ -1288,22 +1300,22 @@ class Ts {
|
|
|
1288
1300
|
}
|
|
1289
1301
|
export {
|
|
1290
1302
|
qt as B,
|
|
1291
|
-
|
|
1303
|
+
f as E,
|
|
1292
1304
|
Mt as N,
|
|
1293
|
-
|
|
1305
|
+
We as R,
|
|
1294
1306
|
Ts as S,
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1307
|
+
ht as U,
|
|
1308
|
+
_s as a,
|
|
1309
|
+
ds as b,
|
|
1298
1310
|
cs as c,
|
|
1299
1311
|
hs as d,
|
|
1300
1312
|
Es as e,
|
|
1301
|
-
|
|
1302
|
-
|
|
1313
|
+
Bn as f,
|
|
1314
|
+
q as g,
|
|
1303
1315
|
ls as h,
|
|
1304
|
-
|
|
1316
|
+
F as i,
|
|
1305
1317
|
Cn as j,
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1318
|
+
lt as k,
|
|
1319
|
+
B as l,
|
|
1320
|
+
qn as s
|
|
1309
1321
|
};
|