sip-connector 10.0.0 → 11.0.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-P-kMtUcq.js → SipConnector-zEWljwQJ.js} +496 -487
- package/dist/SipConnector.d.ts +14 -9
- package/dist/__fixtures__/RTCRtpSenderMock.d.ts +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +20 -15
- package/dist/index.cjs +1 -1
- package/dist/index.js +239 -241
- package/dist/setParametersToSender/configureEncodings.d.ts +1 -8
- package/dist/tools/answerIncomingCall.d.ts +2 -2
- package/dist/tools/callToServer.d.ts +2 -2
- package/dist/tools/resolveStartPresentation.d.ts +3 -3
- package/dist/tools/resolveUpdatePresentation.d.ts +3 -3
- package/dist/types.d.ts +1 -1
- package/package.json +4 -4
- package/dist/SipConnector-93CcnqPF.cjs +0 -1
- package/dist/tools/resolveHandleAddedSender.d.ts +0 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
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
|
-
var
|
|
4
|
-
import { CancelableRequest as
|
|
3
|
+
var o = (s, e, t) => Rt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CancelableRequest as g, isCanceledError as It } from "@krivega/cancelable-promise";
|
|
5
5
|
import pe from "events-constructor";
|
|
6
|
-
import { repeatedCallsAsync as
|
|
7
|
-
import
|
|
8
|
-
const ft = "Connection Error",
|
|
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,
|
|
@@ -22,149 +22,148 @@ const ft = "Connection Error", Le = "Request Timeout", mt = "SIP Failure Code",
|
|
|
22
22
|
NOT_FOUND: Mt,
|
|
23
23
|
NO_ACK: Wt,
|
|
24
24
|
NO_ANSWER: Lt,
|
|
25
|
-
REDIRECTED:
|
|
26
|
-
REJECTED:
|
|
27
|
-
REQUEST_TIMEOUT:
|
|
25
|
+
REDIRECTED: Dt,
|
|
26
|
+
REJECTED: We,
|
|
27
|
+
REQUEST_TIMEOUT: He,
|
|
28
28
|
RTP_TIMEOUT: Ft,
|
|
29
29
|
SIP_FAILURE_CODE: mt,
|
|
30
|
-
UNAVAILABLE:
|
|
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:
|
|
35
|
+
ACCEPTED: $e,
|
|
36
|
+
ACCOUNT_CHANGED: ge,
|
|
37
37
|
ACCOUNT_DELETED: Ce,
|
|
38
|
-
ADMIN_FORCE_SYNC_MEDIA_STATE:
|
|
39
|
-
ADMIN_START_MAIN_CAM:
|
|
40
|
-
ADMIN_START_MIC:
|
|
38
|
+
ADMIN_FORCE_SYNC_MEDIA_STATE: b,
|
|
39
|
+
ADMIN_START_MAIN_CAM: ae,
|
|
40
|
+
ADMIN_START_MIC: _e,
|
|
41
41
|
ADMIN_STOP_MAIN_CAM: re,
|
|
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:
|
|
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
75
|
PARTICIPATION_CANCELLING_WORD_REQUEST: ue,
|
|
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:
|
|
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
87
|
PRESENTATION_STARTED: rt,
|
|
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:
|
|
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
101
|
UNMUTED: Xe,
|
|
102
102
|
UNREGISTERED: X,
|
|
103
|
-
UPDATE:
|
|
104
|
-
USE_LICENSE:
|
|
105
|
-
WEBCAST_STARTED:
|
|
106
|
-
WEBCAST_STOPPED:
|
|
107
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
108
|
-
V,
|
|
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
|
+
$,
|
|
112
|
+
Te,
|
|
113
113
|
ue,
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
he,
|
|
115
|
+
se,
|
|
116
|
+
Ae,
|
|
116
117
|
ge,
|
|
117
|
-
Ne,
|
|
118
118
|
Ce,
|
|
119
|
-
Te,
|
|
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
144
|
oe,
|
|
146
|
-
re,
|
|
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,
|
|
163
|
+
Je,
|
|
164
164
|
Xe,
|
|
165
|
-
Ae,
|
|
166
165
|
Re,
|
|
167
|
-
|
|
166
|
+
Ie,
|
|
168
167
|
ze,
|
|
169
168
|
Qe,
|
|
170
169
|
je,
|
|
@@ -175,65 +174,65 @@ const ft = "Connection Error", Le = "Request Timeout", mt = "SIP Failure Code",
|
|
|
175
174
|
nt,
|
|
176
175
|
st,
|
|
177
176
|
it,
|
|
178
|
-
rt,
|
|
179
177
|
ot,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
178
|
+
rt,
|
|
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", p = "application/vinteo.webrtc.sharedesktop", Gt = "application/vinteo.webrtc.roomname", $t = "application/vinteo.webrtc.channels",
|
|
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
|
-
|
|
200
|
-
},
|
|
199
|
+
V.enable(`-${Oe}`);
|
|
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
|
|
208
208
|
} = {}) => {
|
|
209
209
|
if (!s || e === "recvonly" && t === "recvonly")
|
|
210
210
|
return;
|
|
211
|
-
const i = t === "recvonly" ? [] : s.getAudioTracks(),
|
|
212
|
-
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" &&
|
|
211
|
+
const i = t === "recvonly" ? [] : s.getAudioTracks(), r = e === "recvonly" ? [] : s.getVideoTracks(), a = [...i, ...r], c = new MediaStream(a);
|
|
212
|
+
return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" && 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
|
-
}), mn = "Error decline with 603", Pn = 1006, On = (s) => typeof s == "object" && s !== null && "code" in s && s.code === Pn,
|
|
222
|
-
|
|
223
|
-
t
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, St = (s) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== s, yn = St(), wn = (s, e) => {
|
|
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) => {
|
|
222
|
+
s.encodings === void 0 && (s.encodings = []);
|
|
223
|
+
for (let t = s.encodings.length; t < e; t += 1)
|
|
224
|
+
s.encodings.push({});
|
|
225
|
+
return s;
|
|
226
|
+
}, Nt = (s) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== s, yn = Nt(), wn = (s, e) => {
|
|
228
227
|
if (yn(s, e))
|
|
229
228
|
return s;
|
|
230
229
|
}, bn = (s, e) => {
|
|
231
230
|
const t = s.maxBitrate, n = wn(e, t);
|
|
232
|
-
return n !== void 0
|
|
233
|
-
},
|
|
234
|
-
|
|
231
|
+
return n !== void 0 && (s.maxBitrate = n), s;
|
|
232
|
+
}, gt = 1, Un = Nt(
|
|
233
|
+
gt
|
|
235
234
|
), Ln = (s, e) => {
|
|
236
|
-
const t = s === void 0 ? void 0 : Math.max(s,
|
|
235
|
+
const t = s === void 0 ? void 0 : Math.max(s, gt);
|
|
237
236
|
if (t !== void 0 && Un(
|
|
238
237
|
t,
|
|
239
238
|
e
|
|
@@ -244,39 +243,37 @@ const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, be = (s) =>
|
|
|
244
243
|
e,
|
|
245
244
|
t
|
|
246
245
|
);
|
|
247
|
-
return n !== void 0
|
|
246
|
+
return n !== void 0 && (s.scaleResolutionDownBy = n), s;
|
|
248
247
|
}, Wn = (s, e) => {
|
|
249
|
-
var
|
|
250
|
-
const t = ((
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
255
|
-
return { ...n, encodings: i };
|
|
248
|
+
var n;
|
|
249
|
+
const t = ((n = e.encodings) == null ? void 0 : n.length) ?? 0;
|
|
250
|
+
return vn(s, t), s.encodings.forEach((i, r) => {
|
|
251
|
+
const a = ((e == null ? void 0 : e.encodings) ?? [])[r], c = a == null ? void 0 : a.maxBitrate, E = a == null ? void 0 : a.scaleResolutionDownBy;
|
|
252
|
+
bn(i, c), Hn(i, E);
|
|
253
|
+
}), s;
|
|
256
254
|
}, kn = (s, e) => {
|
|
257
|
-
var t, n, i,
|
|
255
|
+
var t, n, i, r, a, c, E, d;
|
|
258
256
|
if (((t = s.codecs) == null ? void 0 : t.length) !== ((n = e.codecs) == null ? void 0 : n.length))
|
|
259
257
|
return !0;
|
|
260
|
-
for (let
|
|
261
|
-
if (JSON.stringify(s.codecs[
|
|
258
|
+
for (let _ = 0; _ < (((i = s.codecs) == null ? void 0 : i.length) ?? 0); _++)
|
|
259
|
+
if (JSON.stringify(s.codecs[_]) !== JSON.stringify(e.codecs[_]))
|
|
262
260
|
return !0;
|
|
263
|
-
if (((
|
|
261
|
+
if (((r = s.headerExtensions) == null ? void 0 : r.length) !== ((a = e.headerExtensions) == null ? void 0 : a.length))
|
|
264
262
|
return !0;
|
|
265
|
-
for (let
|
|
266
|
-
if (JSON.stringify(s.headerExtensions[
|
|
263
|
+
for (let _ = 0; _ < (((c = s.headerExtensions) == null ? void 0 : c.length) ?? 0); _++)
|
|
264
|
+
if (JSON.stringify(s.headerExtensions[_]) !== JSON.stringify(e.headerExtensions[_]))
|
|
267
265
|
return !0;
|
|
268
|
-
if (((
|
|
266
|
+
if (((E = s.encodings) == null ? void 0 : E.length) !== ((d = e.encodings) == null ? void 0 : d.length))
|
|
269
267
|
return !0;
|
|
270
|
-
for (let
|
|
271
|
-
if (JSON.stringify(s.encodings[
|
|
268
|
+
for (let _ = 0; _ < (s.encodings.length ?? 0); _++)
|
|
269
|
+
if (JSON.stringify(s.encodings[_]) !== JSON.stringify(e.encodings[_]))
|
|
272
270
|
return !0;
|
|
273
271
|
return s.rtcp.cname !== e.rtcp.cname || s.rtcp.reducedSize !== e.rtcp.reducedSize || s.degradationPreference !== e.degradationPreference;
|
|
274
272
|
}, Bn = async (s, e) => {
|
|
275
|
-
const t = s.getParameters();
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return i && await s.setParameters(n), { parameters: n, isChanged: i };
|
|
273
|
+
const t = s.getParameters(), n = JSON.parse(JSON.stringify(t));
|
|
274
|
+
Wn(t, e), Mn(t, e);
|
|
275
|
+
const i = kn(n, t);
|
|
276
|
+
return i && await s.setParameters(t), { parameters: t, isChanged: i };
|
|
280
277
|
}, qn = async (s, e, t) => {
|
|
281
278
|
const { isChanged: n, parameters: i } = await Bn(s, {
|
|
282
279
|
encodings: [
|
|
@@ -288,76 +285,76 @@ const Rn = (s, e) => () => Math.floor(Math.random() * (e - s)) + s, be = (s) =>
|
|
|
288
285
|
});
|
|
289
286
|
return n && t && t(i), { isChanged: n, parameters: i };
|
|
290
287
|
}, Fn = async (s, e, t) => {
|
|
291
|
-
const n =
|
|
288
|
+
const n = pn(s, e);
|
|
292
289
|
if (n)
|
|
293
290
|
return qn(n, { maxBitrate: t });
|
|
294
|
-
}, xn = 486, Vn = 487,
|
|
291
|
+
}, xn = 486, Vn = 487, x = "local", Le = "remote", Yn = 3, Gn = 1, ls = (s = new Error()) => {
|
|
295
292
|
const { originator: e, cause: t } = s;
|
|
296
|
-
return It(s) ? !0 : typeof t == "string" ? t ===
|
|
297
|
-
},
|
|
298
|
-
class
|
|
293
|
+
return It(s) ? !0 : typeof t == "string" ? t === He || t === We || e === x && (t === Be || t === ke) : !1;
|
|
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
|
+
class Ts {
|
|
299
296
|
constructor({ JsSIP: e }) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
297
|
+
o(this, "_isRegisterConfig", !1);
|
|
298
|
+
o(this, "_connectionConfiguration", {});
|
|
299
|
+
o(this, "_remoteStreams", {});
|
|
300
|
+
o(this, "JsSIP");
|
|
301
|
+
o(this, "_sessionEvents");
|
|
302
|
+
o(this, "_uaEvents");
|
|
303
|
+
o(this, "_cancelableConnect");
|
|
304
|
+
o(this, "_cancelableConnectWithRepeatedCalls");
|
|
305
|
+
o(this, "_cancelableSendPresentationWithRepeatedCalls");
|
|
306
|
+
o(this, "_cancelableInitUa");
|
|
307
|
+
o(this, "_cancelableDisconnect");
|
|
308
|
+
o(this, "_cancelableSet");
|
|
309
|
+
o(this, "_cancelableCall");
|
|
310
|
+
o(this, "_cancelableAnswer");
|
|
311
|
+
o(this, "_cancelableSendDTMF");
|
|
312
|
+
o(this, "getSipServerUrl", (e) => e);
|
|
313
|
+
o(this, "promisePendingStartPresentation");
|
|
314
|
+
o(this, "promisePendingStopPresentation");
|
|
315
|
+
o(this, "ua");
|
|
316
|
+
o(this, "session");
|
|
317
|
+
o(this, "incomingSession");
|
|
318
|
+
o(this, "_streamPresentationCurrent");
|
|
319
|
+
o(this, "socket");
|
|
320
|
+
o(this, "connect", async (e, t) => (this._cancelRequests(), this._connectWithDuplicatedCalls(e, t)));
|
|
321
|
+
o(this, "initUa", async (e) => this._cancelableInitUa.request(e));
|
|
322
|
+
o(this, "set", async (e) => this._cancelableSet.request(e));
|
|
323
|
+
o(this, "call", async (e) => this._cancelableCall.request(e));
|
|
324
|
+
o(this, "disconnect", async () => (this._cancelRequests(), this._disconnectWithoutCancelRequests()));
|
|
325
|
+
o(this, "answerToIncomingCall", async (e) => this._cancelableAnswer.request(e));
|
|
326
|
+
o(this, "sendDTMF", async (e) => this._cancelableSendDTMF.request(e));
|
|
327
|
+
o(this, "hangUp", async () => (this._cancelRequests(), this._hangUpWithoutCancelRequests()));
|
|
328
|
+
o(this, "tryRegister", async () => {
|
|
332
329
|
if (!this.isRegisterConfig)
|
|
333
330
|
throw new Error("Config is not registered");
|
|
334
|
-
this._uaEvents.trigger(
|
|
331
|
+
this._uaEvents.trigger(W, void 0);
|
|
335
332
|
try {
|
|
336
333
|
await this.unregister();
|
|
337
334
|
} catch (e) {
|
|
338
|
-
|
|
335
|
+
B("tryRegister", e);
|
|
339
336
|
}
|
|
340
337
|
return this.register();
|
|
341
338
|
});
|
|
342
|
-
|
|
339
|
+
o(this, "declineToIncomingCall", async ({ statusCode: e = Vn } = {}) => new Promise((t, n) => {
|
|
343
340
|
if (!this.isAvailableIncomingCall) {
|
|
344
341
|
n(new Error("no incomingSession"));
|
|
345
342
|
return;
|
|
346
343
|
}
|
|
347
|
-
const i = this.incomingSession,
|
|
348
|
-
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(
|
|
344
|
+
const i = this.incomingSession, r = this.remoteCallerData;
|
|
345
|
+
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(G, r), t(i.terminate({ status_code: e }));
|
|
349
346
|
}));
|
|
350
|
-
|
|
351
|
-
|
|
347
|
+
o(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: xn }));
|
|
348
|
+
o(this, "removeIncomingSession", () => {
|
|
352
349
|
delete this.incomingSession;
|
|
353
350
|
});
|
|
354
|
-
|
|
355
|
-
const n = async () => this._cancelableConnect.request(e), i = (
|
|
351
|
+
o(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = Yn } = {}) => {
|
|
352
|
+
const n = async () => this._cancelableConnect.request(e), i = (r) => {
|
|
356
353
|
var d;
|
|
357
|
-
const c = !!((d = this.ua) != null && d.isConnected()) && this.hasEqualConnectionConfiguration(e),
|
|
358
|
-
return c ||
|
|
354
|
+
const c = !!((d = this.ua) != null && d.isConnected()) && this.hasEqualConnectionConfiguration(e), E = !!r && !On(r);
|
|
355
|
+
return c || E;
|
|
359
356
|
};
|
|
360
|
-
return this._cancelableConnectWithRepeatedCalls =
|
|
357
|
+
return this._cancelableConnectWithRepeatedCalls = Me({
|
|
361
358
|
targetFunction: n,
|
|
362
359
|
isComplete: i,
|
|
363
360
|
callLimit: t,
|
|
@@ -366,71 +363,71 @@ class us {
|
|
|
366
363
|
onAfterCancel: () => {
|
|
367
364
|
this._cancelableConnect.cancelRequest();
|
|
368
365
|
}
|
|
369
|
-
}), this._cancelableConnectWithRepeatedCalls.then((
|
|
370
|
-
if (
|
|
371
|
-
return
|
|
372
|
-
throw
|
|
366
|
+
}), this._cancelableConnectWithRepeatedCalls.then((r) => {
|
|
367
|
+
if (r instanceof this.JsSIP.UA)
|
|
368
|
+
return r;
|
|
369
|
+
throw r;
|
|
373
370
|
});
|
|
374
371
|
});
|
|
375
|
-
|
|
376
|
-
if (e ===
|
|
372
|
+
o(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
373
|
+
if (e === Le) {
|
|
377
374
|
this.incomingSession = t;
|
|
378
375
|
const n = this.remoteCallerData;
|
|
379
|
-
t.on(
|
|
380
|
-
this.removeIncomingSession(), i.originator ===
|
|
381
|
-
}), 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);
|
|
382
379
|
}
|
|
383
380
|
});
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
o(this, "_connect", async (e) => this.initUa(e).then(async () => this._start()));
|
|
382
|
+
o(this, "_initUa", async ({
|
|
386
383
|
user: e,
|
|
387
384
|
password: t,
|
|
388
385
|
sipServerUrl: n,
|
|
389
386
|
sipWebSocketServerURL: i,
|
|
390
|
-
remoteAddress:
|
|
387
|
+
remoteAddress: r,
|
|
391
388
|
sessionTimers: a,
|
|
392
389
|
registerExpires: c,
|
|
393
|
-
connectionRecoveryMinInterval:
|
|
390
|
+
connectionRecoveryMinInterval: E,
|
|
394
391
|
connectionRecoveryMaxInterval: d,
|
|
395
|
-
userAgent:
|
|
396
|
-
displayName:
|
|
397
|
-
register:
|
|
398
|
-
extraHeaders:
|
|
392
|
+
userAgent: _,
|
|
393
|
+
displayName: l = "",
|
|
394
|
+
register: h = !1,
|
|
395
|
+
extraHeaders: T = []
|
|
399
396
|
}) => {
|
|
400
397
|
if (!n)
|
|
401
398
|
throw new Error("sipServerUrl is required");
|
|
402
399
|
if (!i)
|
|
403
400
|
throw new Error("sipWebSocketServerURL is required");
|
|
404
|
-
if (
|
|
401
|
+
if (h && !e)
|
|
405
402
|
throw new Error("user is required for authorized connection");
|
|
406
|
-
if (
|
|
403
|
+
if (h && !t)
|
|
407
404
|
throw new Error("password is required for authorized connection");
|
|
408
405
|
this._connectionConfiguration = {
|
|
409
406
|
sipServerUrl: n,
|
|
410
|
-
displayName:
|
|
411
|
-
register:
|
|
407
|
+
displayName: l,
|
|
408
|
+
register: h,
|
|
412
409
|
user: e,
|
|
413
410
|
password: t
|
|
414
411
|
};
|
|
415
|
-
const { configuration:
|
|
412
|
+
const { configuration: u, helpers: S } = this.createUaConfiguration({
|
|
416
413
|
user: e,
|
|
417
414
|
sipServerUrl: n,
|
|
418
415
|
sipWebSocketServerURL: i,
|
|
419
416
|
password: t,
|
|
420
|
-
displayName:
|
|
421
|
-
register:
|
|
417
|
+
displayName: l,
|
|
418
|
+
register: h,
|
|
422
419
|
sessionTimers: a,
|
|
423
420
|
registerExpires: c,
|
|
424
|
-
connectionRecoveryMinInterval:
|
|
421
|
+
connectionRecoveryMinInterval: E,
|
|
425
422
|
connectionRecoveryMaxInterval: d,
|
|
426
|
-
userAgent:
|
|
423
|
+
userAgent: _
|
|
427
424
|
});
|
|
428
|
-
return this.getSipServerUrl =
|
|
429
|
-
const
|
|
430
|
-
|
|
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);
|
|
431
428
|
}), this.ua;
|
|
432
429
|
});
|
|
433
|
-
|
|
430
|
+
o(this, "_createUa", ({
|
|
434
431
|
remoteAddress: e,
|
|
435
432
|
extraHeaders: t = [],
|
|
436
433
|
...n
|
|
@@ -438,7 +435,7 @@ class us {
|
|
|
438
435
|
const i = new this.JsSIP.UA(n), a = [...e ? xt(e) : [], ...t];
|
|
439
436
|
return a.length > 0 && i.registrator().setExtraHeaders(a), i;
|
|
440
437
|
});
|
|
441
|
-
|
|
438
|
+
o(this, "_start", async () => new Promise((e, t) => {
|
|
442
439
|
const { ua: n } = this;
|
|
443
440
|
if (!n) {
|
|
444
441
|
t(new Error("this.ua is not initialized"));
|
|
@@ -446,212 +443,216 @@ class us {
|
|
|
446
443
|
}
|
|
447
444
|
const i = () => {
|
|
448
445
|
c(), e(n);
|
|
449
|
-
},
|
|
450
|
-
c(), t(
|
|
446
|
+
}, r = (E) => {
|
|
447
|
+
c(), t(E);
|
|
451
448
|
}, a = () => {
|
|
452
|
-
this.isRegisterConfig ? (this.on(
|
|
449
|
+
this.isRegisterConfig ? (this.on(P, i), this.on(O, r)) : this.on(m, i), this.on(N, r);
|
|
453
450
|
}, c = () => {
|
|
454
|
-
this.off(
|
|
451
|
+
this.off(P, i), this.off(O, r), this.off(m, i), this.off(N, r);
|
|
455
452
|
};
|
|
456
|
-
a(), this.on(
|
|
453
|
+
a(), this.on(v, this.handleNewRTCSession), n.start();
|
|
457
454
|
}));
|
|
458
|
-
|
|
459
|
-
const { ua:
|
|
460
|
-
if (!
|
|
455
|
+
o(this, "_set", async ({ displayName: e, password: t }) => new Promise((n, i) => {
|
|
456
|
+
const { ua: r } = this;
|
|
457
|
+
if (!r) {
|
|
461
458
|
i(new Error("this.ua is not initialized"));
|
|
462
459
|
return;
|
|
463
460
|
}
|
|
464
461
|
let a = !1, c = !1;
|
|
465
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a =
|
|
466
|
-
const
|
|
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
|
+
const E = a || c;
|
|
467
464
|
c && this.isRegisterConfig ? this.register().then(() => {
|
|
468
|
-
n(
|
|
465
|
+
n(E);
|
|
469
466
|
}).catch((d) => {
|
|
470
467
|
i(d);
|
|
471
|
-
}) :
|
|
468
|
+
}) : E ? n(E) : i(new Error("nothing changed"));
|
|
472
469
|
}));
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
this.off(
|
|
470
|
+
o(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
|
|
471
|
+
o(this, "_disconnect", async () => {
|
|
472
|
+
this.off(v, this.handleNewRTCSession);
|
|
476
473
|
const e = new Promise((t) => {
|
|
477
|
-
this.once(
|
|
474
|
+
this.once(N, () => {
|
|
478
475
|
delete this.ua, t();
|
|
479
476
|
});
|
|
480
477
|
});
|
|
481
|
-
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;
|
|
482
479
|
});
|
|
483
|
-
|
|
480
|
+
o(this, "_call", async ({
|
|
484
481
|
number: e,
|
|
485
482
|
mediaStream: t,
|
|
486
483
|
extraHeaders: n = [],
|
|
487
484
|
ontrack: i,
|
|
488
|
-
iceServers:
|
|
485
|
+
iceServers: r,
|
|
489
486
|
videoMode: a,
|
|
490
487
|
audioMode: c,
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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) {
|
|
498
496
|
u(new Error("this.ua is not initialized"));
|
|
499
497
|
return;
|
|
500
498
|
}
|
|
501
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: i }).then(
|
|
502
|
-
u(
|
|
503
|
-
}), 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), {
|
|
504
502
|
extraHeaders: n,
|
|
505
|
-
mediaStream:
|
|
503
|
+
mediaStream: M(t, {
|
|
506
504
|
videoMode: a,
|
|
507
505
|
audioMode: c,
|
|
508
|
-
contentHint:
|
|
506
|
+
contentHint: E
|
|
509
507
|
}),
|
|
510
508
|
eventHandlers: this._sessionEvents.triggers,
|
|
511
509
|
videoMode: a,
|
|
512
510
|
audioMode: c,
|
|
513
|
-
onAddedSender: _,
|
|
514
511
|
pcConfig: {
|
|
515
|
-
iceServers:
|
|
512
|
+
iceServers: r
|
|
516
513
|
},
|
|
517
514
|
rtcOfferConstraints: {
|
|
518
|
-
offerToReceiveAudio:
|
|
519
|
-
offerToReceiveVideo:
|
|
520
|
-
}
|
|
515
|
+
offerToReceiveAudio: d,
|
|
516
|
+
offerToReceiveVideo: _
|
|
517
|
+
},
|
|
518
|
+
sendEncodings: l,
|
|
519
|
+
onAddedTransceiver: h
|
|
521
520
|
});
|
|
522
521
|
}));
|
|
523
|
-
|
|
522
|
+
o(this, "_answer", async ({
|
|
524
523
|
mediaStream: e,
|
|
525
524
|
ontrack: t,
|
|
526
525
|
extraHeaders: n = [],
|
|
527
526
|
iceServers: i,
|
|
528
|
-
videoMode:
|
|
527
|
+
videoMode: r,
|
|
529
528
|
audioMode: a,
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
529
|
+
contentHint: c,
|
|
530
|
+
sendEncodings: E,
|
|
531
|
+
onAddedTransceiver: d
|
|
532
|
+
}) => new Promise((_, l) => {
|
|
533
533
|
if (!this.isAvailableIncomingCall) {
|
|
534
|
-
|
|
534
|
+
l(new Error("no incomingSession"));
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
537
|
this.session = this.incomingSession, this.removeIncomingSession();
|
|
538
538
|
const { session: h } = this;
|
|
539
539
|
if (!h) {
|
|
540
|
-
|
|
540
|
+
l(new Error("No session established"));
|
|
541
541
|
return;
|
|
542
542
|
}
|
|
543
|
-
this._sessionEvents.eachTriggers((u,
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(
|
|
547
|
-
|
|
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);
|
|
548
548
|
});
|
|
549
|
-
const
|
|
550
|
-
videoMode:
|
|
549
|
+
const T = M(e, {
|
|
550
|
+
videoMode: r,
|
|
551
551
|
audioMode: a,
|
|
552
|
-
contentHint:
|
|
552
|
+
contentHint: c
|
|
553
553
|
});
|
|
554
554
|
h.answer({
|
|
555
555
|
extraHeaders: n,
|
|
556
|
-
videoMode:
|
|
556
|
+
videoMode: r,
|
|
557
557
|
audioMode: a,
|
|
558
|
-
|
|
559
|
-
mediaStream: l,
|
|
558
|
+
mediaStream: T,
|
|
560
559
|
pcConfig: {
|
|
561
560
|
iceServers: i
|
|
562
|
-
}
|
|
561
|
+
},
|
|
562
|
+
sendEncodings: E,
|
|
563
|
+
onAddedTransceiver: d
|
|
563
564
|
});
|
|
564
565
|
}));
|
|
565
|
-
|
|
566
|
+
o(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
|
|
566
567
|
const i = () => {
|
|
567
|
-
this.onSession(
|
|
568
|
-
},
|
|
569
|
-
this.offSession(
|
|
568
|
+
this.onSession(L, _), this.onSession(U, l);
|
|
569
|
+
}, r = () => {
|
|
570
|
+
this.offSession(L, _), this.offSession(U, l);
|
|
570
571
|
}, a = () => {
|
|
571
|
-
this.onSession(
|
|
572
|
+
this.onSession(R, E), this.onSession(D, E);
|
|
572
573
|
}, c = () => {
|
|
573
|
-
this.offSession(
|
|
574
|
-
},
|
|
575
|
-
|
|
574
|
+
this.offSession(R, E), this.offSession(D, E);
|
|
575
|
+
}, E = (h) => {
|
|
576
|
+
r(), c(), n(h);
|
|
576
577
|
};
|
|
577
578
|
let d;
|
|
578
|
-
const
|
|
579
|
-
d =
|
|
580
|
-
this._sessionEvents.trigger(
|
|
579
|
+
const _ = ({ peerconnection: h }) => {
|
|
580
|
+
d = h, d.ontrack = (T) => {
|
|
581
|
+
this._sessionEvents.trigger(ne, d), e && e(T);
|
|
581
582
|
};
|
|
582
|
-
},
|
|
583
|
-
d && this._sessionEvents.trigger(
|
|
583
|
+
}, l = () => {
|
|
584
|
+
d && this._sessionEvents.trigger(te, d), r(), c(), t(d);
|
|
584
585
|
};
|
|
585
586
|
i(), a();
|
|
586
587
|
}));
|
|
587
|
-
|
|
588
|
+
o(this, "_restoreSession", () => {
|
|
588
589
|
this._cancelRequestsAndResetPresentation(), delete this._connectionConfiguration.number, delete this.session, this._remoteStreams = {};
|
|
589
590
|
});
|
|
590
|
-
|
|
591
|
+
o(this, "_sendDTMF", async (e) => new Promise((t, n) => {
|
|
591
592
|
const { session: i } = this;
|
|
592
593
|
if (!i) {
|
|
593
594
|
n(new Error("No session established"));
|
|
594
595
|
return;
|
|
595
596
|
}
|
|
596
|
-
this.onceSession(
|
|
597
|
-
|
|
597
|
+
this.onceSession(Re, ({ originator: r }) => {
|
|
598
|
+
r === x && t();
|
|
598
599
|
}), i.sendDTMF(e, {
|
|
599
600
|
duration: 120,
|
|
600
601
|
interToneGap: 600
|
|
601
602
|
});
|
|
602
603
|
}));
|
|
603
|
-
|
|
604
|
+
o(this, "_hangUpWithoutCancelRequests", async () => {
|
|
604
605
|
if (this.ua && this.session) {
|
|
605
606
|
const { session: e } = this;
|
|
606
607
|
if (this._streamPresentationCurrent)
|
|
607
608
|
try {
|
|
608
609
|
await this.stopPresentation();
|
|
609
610
|
} catch (t) {
|
|
610
|
-
|
|
611
|
+
B("error stop presentation: ", t);
|
|
611
612
|
}
|
|
612
613
|
if (this._restoreSession(), !e.isEnded())
|
|
613
614
|
return e.terminateAsync();
|
|
614
615
|
}
|
|
615
616
|
});
|
|
616
|
-
|
|
617
|
+
o(this, "_handleShareState", (e) => {
|
|
617
618
|
switch (e) {
|
|
618
|
-
case
|
|
619
|
-
this._sessionEvents.trigger(
|
|
619
|
+
case Tt: {
|
|
620
|
+
this._sessionEvents.trigger(Q, void 0);
|
|
620
621
|
break;
|
|
621
622
|
}
|
|
622
623
|
case ut: {
|
|
623
|
-
this._sessionEvents.trigger(
|
|
624
|
+
this._sessionEvents.trigger(j, void 0);
|
|
624
625
|
break;
|
|
625
626
|
}
|
|
626
|
-
case
|
|
627
|
-
this._sessionEvents.trigger(
|
|
627
|
+
case St: {
|
|
628
|
+
this._sessionEvents.trigger(K, void 0);
|
|
628
629
|
break;
|
|
629
630
|
}
|
|
630
631
|
}
|
|
631
632
|
});
|
|
632
|
-
|
|
633
|
-
const t = e.getHeader(
|
|
633
|
+
o(this, "_maybeTriggerChannels", (e) => {
|
|
634
|
+
const t = e.getHeader(ye), n = e.getHeader(we);
|
|
634
635
|
if (t && n) {
|
|
635
636
|
const i = {
|
|
636
637
|
inputChannels: t,
|
|
637
638
|
outputChannels: n
|
|
638
639
|
};
|
|
639
|
-
this._sessionEvents.trigger(
|
|
640
|
+
this._sessionEvents.trigger(w, i);
|
|
640
641
|
}
|
|
641
642
|
});
|
|
642
|
-
|
|
643
|
+
o(this, "_handleNotify", (e) => {
|
|
643
644
|
switch (e.cmd) {
|
|
644
645
|
case $n: {
|
|
645
646
|
const t = e;
|
|
646
647
|
this._triggerChannelsNotify(t);
|
|
647
648
|
break;
|
|
648
649
|
}
|
|
649
|
-
case
|
|
650
|
+
case Jn: {
|
|
650
651
|
const t = e;
|
|
651
652
|
this._triggerWebcastStartedNotify(t);
|
|
652
653
|
break;
|
|
653
654
|
}
|
|
654
|
-
case
|
|
655
|
+
case Xn: {
|
|
655
656
|
const t = e;
|
|
656
657
|
this._triggerWebcastStoppedNotify(t);
|
|
657
658
|
break;
|
|
@@ -695,47 +696,47 @@ class us {
|
|
|
695
696
|
break;
|
|
696
697
|
}
|
|
697
698
|
default:
|
|
698
|
-
|
|
699
|
+
B("unknown cmd", e.cmd);
|
|
699
700
|
}
|
|
700
701
|
});
|
|
701
|
-
|
|
702
|
+
o(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
702
703
|
conference: e
|
|
703
704
|
}) => {
|
|
704
705
|
const t = {
|
|
705
706
|
conference: e
|
|
706
707
|
};
|
|
707
708
|
this._uaEvents.trigger(
|
|
708
|
-
|
|
709
|
+
de,
|
|
709
710
|
t
|
|
710
711
|
);
|
|
711
712
|
});
|
|
712
|
-
|
|
713
|
+
o(this, "_triggerAddedToListModeratorsNotify", ({ conference: e }) => {
|
|
713
714
|
const t = {
|
|
714
715
|
conference: e
|
|
715
716
|
};
|
|
716
|
-
this._uaEvents.trigger(
|
|
717
|
+
this._uaEvents.trigger(Ee, t);
|
|
717
718
|
});
|
|
718
|
-
|
|
719
|
+
o(this, "_triggerWebcastStartedNotify", ({ body: { conference: e, type: t } }) => {
|
|
719
720
|
const n = {
|
|
720
721
|
conference: e,
|
|
721
722
|
type: t
|
|
722
723
|
};
|
|
723
|
-
this._uaEvents.trigger(
|
|
724
|
+
this._uaEvents.trigger(Se, n);
|
|
724
725
|
});
|
|
725
|
-
|
|
726
|
+
o(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
|
|
726
727
|
const n = {
|
|
727
728
|
conference: e,
|
|
728
729
|
type: t
|
|
729
730
|
};
|
|
730
|
-
this._uaEvents.trigger(
|
|
731
|
+
this._uaEvents.trigger(Ne, n);
|
|
731
732
|
});
|
|
732
|
-
|
|
733
|
-
this._uaEvents.trigger(
|
|
733
|
+
o(this, "_triggerAccountChangedNotify", () => {
|
|
734
|
+
this._uaEvents.trigger(ge, void 0);
|
|
734
735
|
});
|
|
735
|
-
|
|
736
|
+
o(this, "_triggerAccountDeletedNotify", () => {
|
|
736
737
|
this._uaEvents.trigger(Ce, void 0);
|
|
737
738
|
});
|
|
738
|
-
|
|
739
|
+
o(this, "_triggerConferenceParticipantTokenIssued", ({
|
|
739
740
|
body: { conference: e, participant: t, jwt: n }
|
|
740
741
|
}) => {
|
|
741
742
|
const i = {
|
|
@@ -744,26 +745,26 @@ class us {
|
|
|
744
745
|
jwt: n
|
|
745
746
|
};
|
|
746
747
|
this._uaEvents.trigger(
|
|
747
|
-
|
|
748
|
+
Ae,
|
|
748
749
|
i
|
|
749
750
|
);
|
|
750
751
|
});
|
|
751
|
-
|
|
752
|
+
o(this, "_triggerChannelsNotify", (e) => {
|
|
752
753
|
const t = e.input, n = e.output, i = {
|
|
753
754
|
inputChannels: t,
|
|
754
755
|
outputChannels: n
|
|
755
756
|
};
|
|
756
|
-
this._uaEvents.trigger(
|
|
757
|
+
this._uaEvents.trigger(se, i);
|
|
757
758
|
});
|
|
758
|
-
|
|
759
|
+
o(this, "_triggerParticipationAcceptingWordRequest", ({
|
|
759
760
|
body: { conference: e }
|
|
760
761
|
}) => {
|
|
761
762
|
const t = {
|
|
762
763
|
conference: e
|
|
763
764
|
};
|
|
764
|
-
this._uaEvents.trigger(
|
|
765
|
+
this._uaEvents.trigger(Te, t);
|
|
765
766
|
});
|
|
766
|
-
|
|
767
|
+
o(this, "_triggerParticipationCancellingWordRequest", ({
|
|
767
768
|
body: { conference: e }
|
|
768
769
|
}) => {
|
|
769
770
|
const t = {
|
|
@@ -771,51 +772,51 @@ class us {
|
|
|
771
772
|
};
|
|
772
773
|
this._uaEvents.trigger(ue, t);
|
|
773
774
|
});
|
|
774
|
-
|
|
775
|
+
o(this, "_triggerParticipantMoveRequestToStream", ({
|
|
775
776
|
body: { conference: e }
|
|
776
777
|
}) => {
|
|
777
778
|
const t = {
|
|
778
779
|
conference: e
|
|
779
780
|
};
|
|
780
|
-
this._uaEvents.trigger(
|
|
781
|
+
this._uaEvents.trigger(he, t);
|
|
781
782
|
});
|
|
782
|
-
|
|
783
|
+
o(this, "_triggerEnterRoom", (e) => {
|
|
783
784
|
const t = e.getHeader(Yt), n = e.getHeader(Kt);
|
|
784
|
-
this._sessionEvents.trigger(
|
|
785
|
+
this._sessionEvents.trigger(Z, { room: t, participantName: n });
|
|
785
786
|
});
|
|
786
|
-
|
|
787
|
-
const t = e.getHeader(
|
|
788
|
-
this._sessionEvents.trigger(
|
|
787
|
+
o(this, "_triggerShareState", (e) => {
|
|
788
|
+
const t = e.getHeader(I);
|
|
789
|
+
this._sessionEvents.trigger(y, t);
|
|
789
790
|
});
|
|
790
|
-
|
|
791
|
-
e.getHeader(cn) ===
|
|
791
|
+
o(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
792
|
+
e.getHeader(cn) === ct && this._sessionEvents.trigger(le, void 0);
|
|
792
793
|
});
|
|
793
|
-
|
|
794
|
-
const t = e.getHeader(Zt), n = e.getHeader(
|
|
795
|
-
if (t ===
|
|
796
|
-
this._sessionEvents.trigger(
|
|
794
|
+
o(this, "_triggerMainCamControl", (e) => {
|
|
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 });
|
|
797
798
|
return;
|
|
798
799
|
}
|
|
799
|
-
if (t ===
|
|
800
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
800
801
|
this._sessionEvents.trigger(re, { isSyncForced: i });
|
|
801
802
|
return;
|
|
802
803
|
}
|
|
803
|
-
(t ===
|
|
804
|
-
const
|
|
805
|
-
this._sessionEvents.trigger(
|
|
804
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(b, { isSyncForced: i });
|
|
805
|
+
const r = e.getHeader(tn);
|
|
806
|
+
this._sessionEvents.trigger(oe, {
|
|
806
807
|
mainCam: t,
|
|
807
|
-
resolutionMainCam:
|
|
808
|
+
resolutionMainCam: r
|
|
808
809
|
});
|
|
809
810
|
});
|
|
810
|
-
|
|
811
|
-
const t = e.getHeader(en), i = e.getHeader(
|
|
812
|
-
t ===
|
|
811
|
+
o(this, "_triggerMicControl", (e) => {
|
|
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 });
|
|
813
814
|
});
|
|
814
|
-
|
|
815
|
+
o(this, "_triggerUseLicense", (e) => {
|
|
815
816
|
const t = e.getHeader(jt);
|
|
816
|
-
this._sessionEvents.trigger(
|
|
817
|
+
this._sessionEvents.trigger(ee, t);
|
|
817
818
|
});
|
|
818
|
-
|
|
819
|
+
o(this, "_handleNewInfo", (e) => {
|
|
819
820
|
const { originator: t } = e;
|
|
820
821
|
if (t !== "remote")
|
|
821
822
|
return;
|
|
@@ -834,7 +835,7 @@ class us {
|
|
|
834
835
|
this._triggerShareState(n);
|
|
835
836
|
break;
|
|
836
837
|
}
|
|
837
|
-
case
|
|
838
|
+
case ve: {
|
|
838
839
|
this._triggerMainCamControl(n);
|
|
839
840
|
break;
|
|
840
841
|
}
|
|
@@ -852,44 +853,44 @@ class us {
|
|
|
852
853
|
}
|
|
853
854
|
}
|
|
854
855
|
});
|
|
855
|
-
|
|
856
|
+
o(this, "_handleSipEvent", ({ request: e }) => {
|
|
856
857
|
this._maybeHandleNotify(e);
|
|
857
858
|
});
|
|
858
|
-
|
|
859
|
+
o(this, "_maybeHandleNotify", (e) => {
|
|
859
860
|
const t = e.getHeader(En);
|
|
860
861
|
if (t) {
|
|
861
862
|
const n = JSON.parse(t);
|
|
862
863
|
this._handleNotify(n);
|
|
863
864
|
}
|
|
864
865
|
});
|
|
865
|
-
|
|
866
|
+
o(this, "_handleEnded", (e) => {
|
|
866
867
|
const { originator: t } = e;
|
|
867
|
-
t ===
|
|
868
|
+
t === Le && this._sessionEvents.trigger(ie, e), this._restoreSession();
|
|
868
869
|
});
|
|
869
|
-
this.JsSIP = e, this._sessionEvents = new pe(
|
|
870
|
+
this.JsSIP = e, this._sessionEvents = new pe(lt), this._uaEvents = new pe(ht), this._cancelableConnect = new g(
|
|
870
871
|
this._connect,
|
|
871
872
|
{
|
|
872
|
-
moduleName:
|
|
873
|
+
moduleName: C,
|
|
873
874
|
afterCancelRequest: () => {
|
|
874
875
|
this._cancelableInitUa.cancelRequest(), this._cancelableDisconnect.cancelRequest();
|
|
875
876
|
}
|
|
876
877
|
}
|
|
877
|
-
), this._cancelableInitUa = new
|
|
878
|
+
), this._cancelableInitUa = new g(
|
|
878
879
|
this._initUa,
|
|
879
|
-
{ moduleName:
|
|
880
|
-
), this._cancelableDisconnect = new
|
|
880
|
+
{ moduleName: C }
|
|
881
|
+
), this._cancelableDisconnect = new g(
|
|
881
882
|
this._disconnect,
|
|
882
|
-
{ moduleName:
|
|
883
|
-
), this._cancelableSet = new
|
|
884
|
-
moduleName:
|
|
885
|
-
}), this._cancelableCall = new
|
|
883
|
+
{ moduleName: C }
|
|
884
|
+
), this._cancelableSet = new g(this._set, {
|
|
885
|
+
moduleName: C
|
|
886
|
+
}), this._cancelableCall = new g(
|
|
886
887
|
this._call,
|
|
887
|
-
{ moduleName:
|
|
888
|
-
), this._cancelableAnswer = new
|
|
888
|
+
{ moduleName: C }
|
|
889
|
+
), this._cancelableAnswer = new g(this._answer, { moduleName: C }), this._cancelableSendDTMF = new g(this._sendDTMF, { moduleName: C }), this.onSession(y, this._handleShareState), this.onSession(Ie, this._handleNewInfo), this.on(z, this._handleSipEvent), this.onSession(R, this._handleEnded), this.onSession(D, this._handleEnded);
|
|
889
890
|
}
|
|
890
891
|
async register() {
|
|
891
892
|
return new Promise((e, t) => {
|
|
892
|
-
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"));
|
|
893
894
|
});
|
|
894
895
|
}
|
|
895
896
|
async unregister() {
|
|
@@ -900,7 +901,7 @@ class us {
|
|
|
900
901
|
async sendOptions(e, t, n) {
|
|
901
902
|
if (!this.ua)
|
|
902
903
|
throw new Error("is not connected");
|
|
903
|
-
return new Promise((i,
|
|
904
|
+
return new Promise((i, r) => {
|
|
904
905
|
try {
|
|
905
906
|
this.ua.sendOptions(e, t, {
|
|
906
907
|
extraHeaders: n,
|
|
@@ -908,11 +909,11 @@ class us {
|
|
|
908
909
|
succeeded: () => {
|
|
909
910
|
i();
|
|
910
911
|
},
|
|
911
|
-
failed:
|
|
912
|
+
failed: r
|
|
912
913
|
}
|
|
913
914
|
});
|
|
914
915
|
} catch (a) {
|
|
915
|
-
|
|
916
|
+
r(a);
|
|
916
917
|
}
|
|
917
918
|
});
|
|
918
919
|
}
|
|
@@ -928,42 +929,42 @@ class us {
|
|
|
928
929
|
displayName: t,
|
|
929
930
|
sipServerUrl: n,
|
|
930
931
|
sipWebSocketServerURL: i,
|
|
931
|
-
remoteAddress:
|
|
932
|
+
remoteAddress: r,
|
|
932
933
|
extraHeaders: a
|
|
933
934
|
}) {
|
|
934
|
-
return new Promise((c,
|
|
935
|
+
return new Promise((c, E) => {
|
|
935
936
|
const { configuration: d } = this.createUaConfiguration({
|
|
936
937
|
sipWebSocketServerURL: i,
|
|
937
938
|
displayName: t,
|
|
938
939
|
userAgent: e,
|
|
939
940
|
sipServerUrl: n
|
|
940
|
-
}),
|
|
941
|
-
const
|
|
942
|
-
|
|
941
|
+
}), _ = this._createUa({ ...d, remoteAddress: r, extraHeaders: a }), l = () => {
|
|
942
|
+
const T = new Error("Telephony is not available");
|
|
943
|
+
E(T);
|
|
943
944
|
};
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
|
|
945
|
+
_.once(N, l);
|
|
946
|
+
const h = () => {
|
|
947
|
+
_.removeAllListeners(), _.once(N, c), _.stop();
|
|
947
948
|
};
|
|
948
|
-
|
|
949
|
+
_.once(m, h), _.start();
|
|
949
950
|
});
|
|
950
951
|
}
|
|
951
952
|
async replaceMediaStream(e, t) {
|
|
952
953
|
if (!this.session)
|
|
953
954
|
throw new Error("No session established");
|
|
954
|
-
const { contentHint: n } = t || {}, i =
|
|
955
|
+
const { contentHint: n } = t || {}, i = M(e, { contentHint: n });
|
|
955
956
|
return this.session.replaceMediaStream(i, t);
|
|
956
957
|
}
|
|
957
958
|
async askPermissionToEnableCam(e = {}) {
|
|
958
959
|
if (!this.session)
|
|
959
960
|
throw new Error("No session established");
|
|
960
961
|
const t = [Nn];
|
|
961
|
-
return this.session.sendInfo(
|
|
962
|
+
return this.session.sendInfo(ve, void 0, {
|
|
962
963
|
noTerminateWhenError: !0,
|
|
963
964
|
...e,
|
|
964
965
|
extraHeaders: t
|
|
965
966
|
}).catch((n) => {
|
|
966
|
-
if (
|
|
967
|
+
if (Dn(n))
|
|
967
968
|
throw n;
|
|
968
969
|
});
|
|
969
970
|
}
|
|
@@ -978,9 +979,9 @@ class us {
|
|
|
978
979
|
callLimit: Gn
|
|
979
980
|
}
|
|
980
981
|
}) {
|
|
981
|
-
const
|
|
982
|
-
return this._cancelableSendPresentationWithRepeatedCalls =
|
|
983
|
-
targetFunction:
|
|
982
|
+
const r = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
983
|
+
return this._cancelableSendPresentationWithRepeatedCalls = Me({
|
|
984
|
+
targetFunction: r,
|
|
984
985
|
isComplete: a,
|
|
985
986
|
isRejectAsValid: !0,
|
|
986
987
|
...i
|
|
@@ -996,59 +997,63 @@ class us {
|
|
|
996
997
|
password: t,
|
|
997
998
|
sipWebSocketServerURL: n,
|
|
998
999
|
displayName: i = "",
|
|
999
|
-
sipServerUrl:
|
|
1000
|
+
sipServerUrl: r,
|
|
1000
1001
|
register: a = !1,
|
|
1001
1002
|
sessionTimers: c = !1,
|
|
1002
|
-
registerExpires:
|
|
1003
|
+
registerExpires: E = 60 * 5,
|
|
1003
1004
|
// 5 minutes in sec
|
|
1004
1005
|
connectionRecoveryMinInterval: d = 2,
|
|
1005
|
-
connectionRecoveryMaxInterval:
|
|
1006
|
-
userAgent:
|
|
1006
|
+
connectionRecoveryMaxInterval: _ = 6,
|
|
1007
|
+
userAgent: l
|
|
1007
1008
|
}) {
|
|
1008
1009
|
if (a && !t)
|
|
1009
1010
|
throw new Error("password is required for authorized connection");
|
|
1010
|
-
const
|
|
1011
|
+
const h = a && e ? e.trim() : `${In()}`, T = An(r), u = T(h), S = new this.JsSIP.WebSocketInterface(n);
|
|
1011
1012
|
return {
|
|
1012
1013
|
configuration: {
|
|
1013
1014
|
password: t,
|
|
1014
1015
|
register: a,
|
|
1015
|
-
uri:
|
|
1016
|
-
display_name:
|
|
1017
|
-
user_agent:
|
|
1016
|
+
uri: u,
|
|
1017
|
+
display_name: Ue(i),
|
|
1018
|
+
user_agent: l,
|
|
1018
1019
|
sdp_semantics: "unified-plan",
|
|
1019
|
-
sockets: [
|
|
1020
|
+
sockets: [S],
|
|
1020
1021
|
session_timers: c,
|
|
1021
|
-
register_expires:
|
|
1022
|
+
register_expires: E,
|
|
1022
1023
|
connection_recovery_min_interval: d,
|
|
1023
|
-
connection_recovery_max_interval:
|
|
1024
|
+
connection_recovery_max_interval: _
|
|
1024
1025
|
},
|
|
1025
1026
|
helpers: {
|
|
1026
|
-
socket:
|
|
1027
|
-
getSipServerUrl:
|
|
1027
|
+
socket: S,
|
|
1028
|
+
getSipServerUrl: T
|
|
1028
1029
|
}
|
|
1029
1030
|
};
|
|
1030
1031
|
}
|
|
1031
1032
|
async _sendPresentation(e, t, {
|
|
1032
|
-
maxBitrate: n =
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1033
|
+
maxBitrate: n = _t,
|
|
1034
|
+
isNeedReinvite: i = !0,
|
|
1035
|
+
isP2P: r = !1,
|
|
1036
|
+
contentHint: a = "detail",
|
|
1037
|
+
sendEncodings: c,
|
|
1038
|
+
onAddedTransceiver: E
|
|
1037
1039
|
}) {
|
|
1038
|
-
const
|
|
1039
|
-
this._streamPresentationCurrent =
|
|
1040
|
-
const
|
|
1041
|
-
extraHeaders:
|
|
1042
|
-
}).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 () => {
|
|
1043
1048
|
const { connection: h } = this;
|
|
1044
1049
|
if (!h || n === void 0)
|
|
1045
1050
|
return;
|
|
1046
|
-
const
|
|
1047
|
-
await Fn(
|
|
1051
|
+
const T = h.getSenders();
|
|
1052
|
+
await Fn(T, t, n);
|
|
1048
1053
|
}).then(() => t).catch((h) => {
|
|
1049
|
-
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(
|
|
1054
|
+
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(H, h), h;
|
|
1050
1055
|
});
|
|
1051
|
-
return this.promisePendingStartPresentation =
|
|
1056
|
+
return this.promisePendingStartPresentation = l, l.finally(() => {
|
|
1052
1057
|
this.promisePendingStartPresentation = void 0;
|
|
1053
1058
|
});
|
|
1054
1059
|
}
|
|
@@ -1056,25 +1061,27 @@ class us {
|
|
|
1056
1061
|
isNeedReinvite: t,
|
|
1057
1062
|
isP2P: n,
|
|
1058
1063
|
maxBitrate: i,
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
+
contentHint: r,
|
|
1065
|
+
sendEncodings: a,
|
|
1066
|
+
onAddedTransceiver: c
|
|
1067
|
+
} = {}, E) {
|
|
1068
|
+
const d = this.establishedSession;
|
|
1069
|
+
if (!d)
|
|
1064
1070
|
throw new Error("No session established");
|
|
1065
1071
|
if (this._streamPresentationCurrent)
|
|
1066
1072
|
throw new Error("Presentation is already started");
|
|
1067
|
-
return n && await this.sendMustStopPresentation(
|
|
1068
|
-
session:
|
|
1073
|
+
return n && await this.sendMustStopPresentation(d), this._sendPresentationWithDuplicatedCalls({
|
|
1074
|
+
session: d,
|
|
1069
1075
|
stream: e,
|
|
1070
1076
|
presentationOptions: {
|
|
1071
1077
|
isNeedReinvite: t,
|
|
1072
1078
|
isP2P: n,
|
|
1073
1079
|
maxBitrate: i,
|
|
1074
|
-
|
|
1075
|
-
|
|
1080
|
+
contentHint: r,
|
|
1081
|
+
sendEncodings: a,
|
|
1082
|
+
onAddedTransceiver: c
|
|
1076
1083
|
},
|
|
1077
|
-
options:
|
|
1084
|
+
options: E
|
|
1078
1085
|
});
|
|
1079
1086
|
}
|
|
1080
1087
|
async sendMustStopPresentation(e) {
|
|
@@ -1088,32 +1095,34 @@ class us {
|
|
|
1088
1095
|
this._cancelSendPresentationWithRepeatedCalls();
|
|
1089
1096
|
const t = this._streamPresentationCurrent;
|
|
1090
1097
|
let n = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
1091
|
-
const i = e ? [
|
|
1092
|
-
return
|
|
1098
|
+
const i = e ? [un] : [hn], r = this.establishedSession;
|
|
1099
|
+
return r && t && (n = n.then(async () => r.sendInfo(p, void 0, {
|
|
1093
1100
|
extraHeaders: i
|
|
1094
|
-
})).then(async () =>
|
|
1095
|
-
throw this._sessionEvents.trigger(
|
|
1096
|
-
})), !
|
|
1101
|
+
})).then(async () => r.stopPresentation(t)).catch((a) => {
|
|
1102
|
+
throw this._sessionEvents.trigger(H, a), a;
|
|
1103
|
+
})), !r && t && this._sessionEvents.trigger(fe, t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
1097
1104
|
this._resetPresentation();
|
|
1098
1105
|
});
|
|
1099
1106
|
}
|
|
1100
1107
|
async updatePresentation(e, {
|
|
1101
1108
|
isP2P: t,
|
|
1102
1109
|
maxBitrate: n,
|
|
1103
|
-
|
|
1104
|
-
|
|
1110
|
+
contentHint: i,
|
|
1111
|
+
sendEncodings: r,
|
|
1112
|
+
onAddedTransceiver: a
|
|
1105
1113
|
} = {}) {
|
|
1106
|
-
const
|
|
1107
|
-
if (!
|
|
1114
|
+
const c = this.establishedSession;
|
|
1115
|
+
if (!c)
|
|
1108
1116
|
throw new Error("No session established");
|
|
1109
1117
|
if (!this._streamPresentationCurrent)
|
|
1110
1118
|
throw new Error("Presentation has not started yet");
|
|
1111
|
-
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(
|
|
1119
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(c, e, {
|
|
1112
1120
|
isP2P: t,
|
|
1113
1121
|
maxBitrate: n,
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1122
|
+
contentHint: i,
|
|
1123
|
+
isNeedReinvite: !1,
|
|
1124
|
+
sendEncodings: r,
|
|
1125
|
+
onAddedTransceiver: a
|
|
1117
1126
|
});
|
|
1118
1127
|
}
|
|
1119
1128
|
_removeStreamPresentationCurrent() {
|
|
@@ -1172,11 +1181,11 @@ class us {
|
|
|
1172
1181
|
return (t = this.session) == null ? void 0 : t.connection;
|
|
1173
1182
|
}
|
|
1174
1183
|
get remoteCallerData() {
|
|
1175
|
-
var e, t, n, i,
|
|
1184
|
+
var e, t, n, i, r, a;
|
|
1176
1185
|
return {
|
|
1177
1186
|
displayName: (t = (e = this.incomingSession) == null ? void 0 : e.remote_identity) == null ? void 0 : t.display_name,
|
|
1178
1187
|
host: (i = (n = this.incomingSession) == null ? void 0 : n.remote_identity) == null ? void 0 : i.uri.host,
|
|
1179
|
-
incomingNumber: (a = (
|
|
1188
|
+
incomingNumber: (a = (r = this.incomingSession) == null ? void 0 : r.remote_identity) == null ? void 0 : a.uri.user,
|
|
1180
1189
|
session: this.incomingSession
|
|
1181
1190
|
};
|
|
1182
1191
|
}
|
|
@@ -1212,11 +1221,11 @@ class us {
|
|
|
1212
1221
|
return e.forEach((n, i) => {
|
|
1213
1222
|
if (n.kind === "audio")
|
|
1214
1223
|
return;
|
|
1215
|
-
const
|
|
1224
|
+
const r = n, a = e[i - 1];
|
|
1216
1225
|
let c;
|
|
1217
1226
|
a && a.kind === "audio" && (c = a);
|
|
1218
|
-
const
|
|
1219
|
-
t.push(
|
|
1227
|
+
const E = this._generateStream(r, c);
|
|
1228
|
+
t.push(E);
|
|
1220
1229
|
}), t;
|
|
1221
1230
|
}
|
|
1222
1231
|
_generateAudioStreams(e) {
|
|
@@ -1240,29 +1249,29 @@ class us {
|
|
|
1240
1249
|
this._cancelableAnswer.cancelRequest(), this._cancelableSendDTMF.cancelRequest();
|
|
1241
1250
|
}
|
|
1242
1251
|
async waitChannels() {
|
|
1243
|
-
return this.waitSession(
|
|
1252
|
+
return this.waitSession(w);
|
|
1244
1253
|
}
|
|
1245
1254
|
async waitSyncMediaState() {
|
|
1246
|
-
return this.waitSession(
|
|
1255
|
+
return this.waitSession(b);
|
|
1247
1256
|
}
|
|
1248
1257
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1249
1258
|
if (!this.session)
|
|
1250
1259
|
throw new Error("No session established");
|
|
1251
|
-
const n = `${
|
|
1260
|
+
const n = `${ye}: ${e}`, i = `${we}: ${t}`, r = [
|
|
1252
1261
|
n,
|
|
1253
1262
|
i
|
|
1254
1263
|
];
|
|
1255
|
-
return this.session.sendInfo($t, void 0, { extraHeaders:
|
|
1264
|
+
return this.session.sendInfo($t, void 0, { extraHeaders: r });
|
|
1256
1265
|
}
|
|
1257
1266
|
async sendMediaState({ cam: e, mic: t }, n = {}) {
|
|
1258
1267
|
if (!this.session)
|
|
1259
1268
|
throw new Error("No session established");
|
|
1260
|
-
const i = `${nn}: currentstate`,
|
|
1269
|
+
const i = `${nn}: currentstate`, r = `${on}: ${Number(e)}`, a = `${rn}: ${Number(t)}`, c = [
|
|
1261
1270
|
i,
|
|
1262
|
-
|
|
1271
|
+
r,
|
|
1263
1272
|
a
|
|
1264
1273
|
];
|
|
1265
|
-
return this.session.sendInfo(
|
|
1274
|
+
return this.session.sendInfo(Jt, void 0, {
|
|
1266
1275
|
noTerminateWhenError: !0,
|
|
1267
1276
|
...n,
|
|
1268
1277
|
extraHeaders: c
|
|
@@ -1272,7 +1281,7 @@ class us {
|
|
|
1272
1281
|
if (!this.session)
|
|
1273
1282
|
throw new Error("No session established");
|
|
1274
1283
|
const c = [`${sn}: ${e === "mic" ? 0 : 1}`];
|
|
1275
|
-
return this.session.sendInfo(
|
|
1284
|
+
return this.session.sendInfo(Xt, void 0, {
|
|
1276
1285
|
noTerminateWhenError: !0,
|
|
1277
1286
|
...t,
|
|
1278
1287
|
extraHeaders: c
|
|
@@ -1291,22 +1300,22 @@ class us {
|
|
|
1291
1300
|
}
|
|
1292
1301
|
export {
|
|
1293
1302
|
qt as B,
|
|
1294
|
-
|
|
1303
|
+
f as E,
|
|
1295
1304
|
Mt as N,
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1305
|
+
We as R,
|
|
1306
|
+
Ts as S,
|
|
1307
|
+
ht as U,
|
|
1308
|
+
_s as a,
|
|
1309
|
+
ds as b,
|
|
1301
1310
|
cs as c,
|
|
1302
1311
|
hs as d,
|
|
1303
1312
|
Es as e,
|
|
1304
|
-
|
|
1305
|
-
|
|
1313
|
+
Bn as f,
|
|
1314
|
+
q as g,
|
|
1306
1315
|
ls as h,
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1316
|
+
F as i,
|
|
1317
|
+
Cn as j,
|
|
1318
|
+
lt as k,
|
|
1319
|
+
B as l,
|
|
1320
|
+
qn as s
|
|
1312
1321
|
};
|