opensips-js 0.1.8 → 0.1.10
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/index.d.ts +7 -15
- package/dist/opensips-js.cjs.js +54 -54
- package/dist/opensips-js.es.js +14 -27
- package/dist/opensips-js.iife.js +45 -45
- package/dist/opensips-js.umd.js +45 -45
- package/package.json +1 -1
- package/src/types/listeners.d.ts +2 -0
- package/src/types/rtc.d.ts +1 -0
package/dist/opensips-js.es.js
CHANGED
|
@@ -23417,35 +23417,15 @@ class iE {
|
|
|
23417
23417
|
}
|
|
23418
23418
|
class lE {
|
|
23419
23419
|
constructor() {
|
|
23420
|
-
this.resumePromise = null, this.
|
|
23421
|
-
this.stateChangeCount++;
|
|
23422
|
-
const t = Date.now();
|
|
23423
|
-
this.lastStateChange = t;
|
|
23424
|
-
});
|
|
23420
|
+
this.resumePromise = null, this.context = new AudioContext();
|
|
23425
23421
|
}
|
|
23426
23422
|
async getContext() {
|
|
23427
|
-
return this.context.state === "suspended" && (this.
|
|
23423
|
+
return this.context.state === "suspended" && (this.resumePromise || (this.resumePromise = this.context.resume().then(() => {
|
|
23428
23424
|
this.resumePromise = null;
|
|
23429
23425
|
}).catch((t) => {
|
|
23430
23426
|
throw this.resumePromise = null, t;
|
|
23431
23427
|
})), await this.resumePromise), this.context;
|
|
23432
23428
|
}
|
|
23433
|
-
get rawContext() {
|
|
23434
|
-
return this.context;
|
|
23435
|
-
}
|
|
23436
|
-
getDebugInfo() {
|
|
23437
|
-
return {
|
|
23438
|
-
state: this.context.state,
|
|
23439
|
-
sampleRate: this.context.sampleRate,
|
|
23440
|
-
currentTime: this.context.currentTime,
|
|
23441
|
-
stateChangeCount: this.stateChangeCount,
|
|
23442
|
-
resumeAttempts: this.resumeAttempts,
|
|
23443
|
-
lastStateChange: new Date(this.lastStateChange).toISOString(),
|
|
23444
|
-
hasResumePromise: !!this.resumePromise,
|
|
23445
|
-
documentHidden: document.hidden,
|
|
23446
|
-
documentVisibility: document.visibilityState
|
|
23447
|
-
};
|
|
23448
|
-
}
|
|
23449
23429
|
}
|
|
23450
23430
|
const da = {
|
|
23451
23431
|
SELECTED_INPUT_DEVICE: "OpensipsJSInputDevice",
|
|
@@ -24794,7 +24774,7 @@ class OE extends FT {
|
|
|
24794
24774
|
...t.configuration,
|
|
24795
24775
|
sockets: t.socketInterfaces.map((o) => new ov.WebSocketInterface(o))
|
|
24796
24776
|
};
|
|
24797
|
-
super(a), this.initialized = !1, this.connected = !1, this.logger = console, this.newRTCSessionEventName = "newRTCSession", this.registeredEventName = "registered", this.unregisteredEventName = "unregistered", this.disconnectedEventName = "disconnected", this.connectedEventName = "connected", this.newMSRPSessionEventName = "newMSRPSession", this.isReconnecting = !1, this.activeConnection = !1, this.waitingForSessionHangup = !1, this.waitingForSessionTimeout = null, this.audio = null, this.msrp = null, this.video = null, this.listenersList = {}, this.modules = [], t.pnExtraHeaders && Object.keys(t.pnExtraHeaders).length && this.registrator().setExtraContactUriParams(t.pnExtraHeaders), this.options = t, this.modules = t.modules, n && YT(n) && (this.logger = n);
|
|
24777
|
+
super(a), this.initialized = !1, this.connected = !1, this.logger = console, this.newRTCSessionEventName = "newRTCSession", this.registeredEventName = "registered", this.unregisteredEventName = "unregistered", this.disconnectedEventName = "disconnected", this.connectedEventName = "connected", this.newMSRPSessionEventName = "newMSRPSession", this.isReconnecting = !1, this.activeConnection = !1, this.waitingForSessionHangup = !1, this.waitingForSessionTimeout = null, this.reconnectionAttemptsLimit = 1 / 0, this.reconnectionAttemptsCounter = 0, this.audio = null, this.msrp = null, this.video = null, this.listenersList = {}, this.modules = [], t.pnExtraHeaders && Object.keys(t.pnExtraHeaders).length && this.registrator().setExtraContactUriParams(t.pnExtraHeaders), this.options = t, this.modules = t.modules, t.configuration.reconnectionAttemptsLimit && (this.reconnectionAttemptsLimit = t.configuration.reconnectionAttemptsLimit), n && YT(n) && (this.logger = n);
|
|
24798
24778
|
}
|
|
24799
24779
|
/*public setWaitingForSessionHangup (value: boolean) {
|
|
24800
24780
|
this.waitingForSessionHangup = value
|
|
@@ -24803,7 +24783,7 @@ class OE extends FT {
|
|
|
24803
24783
|
return this.waitingForSessionHangup;
|
|
24804
24784
|
}
|
|
24805
24785
|
stopSessionAfterWaiting() {
|
|
24806
|
-
this.setInitialized(!1), this.waitingForSessionHangup = !1, clearTimeout(this.waitingForSessionTimeout), this.waitingForSessionTimeout = null, this.activeConnection &&
|
|
24786
|
+
this.setInitialized(!1), this.waitingForSessionHangup = !1, clearTimeout(this.waitingForSessionTimeout), this.waitingForSessionTimeout = null, this.activeConnection && this.reconnect();
|
|
24807
24787
|
}
|
|
24808
24788
|
get hasActiveSessions() {
|
|
24809
24789
|
return this.modules.includes(_a.AUDIO) ? this.audio.hasActiveAnsweredCalls : !1;
|
|
@@ -24833,6 +24813,13 @@ class OE extends FT {
|
|
|
24833
24813
|
getPlugin(t) {
|
|
24834
24814
|
return this.newStreamPlugins.find((n) => n.name === t) || this.processStreamPlugins.find((n) => n.name === t);
|
|
24835
24815
|
}
|
|
24816
|
+
reconnect() {
|
|
24817
|
+
if (this.reconnectionAttemptsCounter < this.reconnectionAttemptsLimit) {
|
|
24818
|
+
const n = 5e3 * Math.pow(2, this.reconnectionAttemptsCounter);
|
|
24819
|
+
this.reconnectionAttemptsCounter++, setTimeout(this.start.bind(this), n);
|
|
24820
|
+
} else
|
|
24821
|
+
this.emit("reconnectionAttemptsLimitReached", void 0);
|
|
24822
|
+
}
|
|
24836
24823
|
begin() {
|
|
24837
24824
|
if (this.isConnected()) {
|
|
24838
24825
|
console.error("Connection is already established");
|
|
@@ -24851,14 +24838,14 @@ class OE extends FT {
|
|
|
24851
24838
|
), this.on(
|
|
24852
24839
|
this.connectedEventName,
|
|
24853
24840
|
() => {
|
|
24854
|
-
this.logger.log("Connected to", this.options.socketInterfaces[0]), this.setConnected(!0), this.setReconnecting(!1), this.activeConnection = !0, this.waitingForSessionHangup = !1;
|
|
24841
|
+
this.logger.log("Connected to", this.options.socketInterfaces[0]), this.setConnected(!0), this.setReconnecting(!1), this.activeConnection = !0, this.waitingForSessionHangup = !1, this.reconnectionAttemptsCounter = 0;
|
|
24855
24842
|
}
|
|
24856
24843
|
), this.on(
|
|
24857
24844
|
this.disconnectedEventName,
|
|
24858
24845
|
() => {
|
|
24859
24846
|
this.setConnected(!1), !this.isReconnecting && (this.setReconnecting(!0), this.logger.log("Disconnected from", this.options.socketInterfaces[0]), this.logger.log("Reconnecting to", this.options.socketInterfaces[0]), this.hasActiveSessions ? (this.waitingForSessionHangup = !0, this.stop(!1), this.waitingForSessionTimeout = setTimeout(() => {
|
|
24860
|
-
this.terminateAllSessions(), this.setInitialized(!1), this.waitingForSessionHangup = !1, this.activeConnection &&
|
|
24861
|
-
}, 12e5)) : (this.stop(), this.setInitialized(!1), this.activeConnection &&
|
|
24847
|
+
this.terminateAllSessions(), this.setInitialized(!1), this.waitingForSessionHangup = !1, this.activeConnection && this.reconnect();
|
|
24848
|
+
}, 12e5)) : (this.stop(), this.setInitialized(!1), this.activeConnection && this.reconnect()));
|
|
24862
24849
|
}
|
|
24863
24850
|
), this.logger.log("Connecting to", this.options.socketInterfaces[0]), this.start(), this;
|
|
24864
24851
|
}
|