webitel-sdk 26.4.31 → 26.4.33
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/index.cjs +30 -7
- package/index.cjs.map +1 -1
- package/index.mjs +30 -7
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/sip/webrtc/index.d.ts +5 -2
- package/sip/webrtc/index.d.ts.map +1 -1
- package/sip/webrtc/user-agent.d.ts +3 -0
- package/sip/webrtc/user-agent.d.ts.map +1 -0
- package/socket/agent.d.ts +2 -0
- package/socket/agent.d.ts.map +1 -1
- package/socket/client.d.ts +2 -0
- package/socket/client.d.ts.map +1 -1
- package/socket/task.d.ts +4 -0
- package/socket/task.d.ts.map +1 -1
- package/version.d.ts +1 -1
package/index.cjs
CHANGED
|
@@ -66185,6 +66185,11 @@ var Session$2 = class {
|
|
|
66185
66185
|
}, 500);
|
|
66186
66186
|
}
|
|
66187
66187
|
};
|
|
66188
|
+
const DEFAULT_USER_AGENT = `webitel-web-phone-sdk/0.0.1`;
|
|
66189
|
+
const resolveUserAgent = (ua) => {
|
|
66190
|
+
var _ua$trim;
|
|
66191
|
+
return (_ua$trim = ua === null || ua === void 0 ? void 0 : ua.trim()) !== null && _ua$trim !== void 0 ? _ua$trim : DEFAULT_USER_AGENT;
|
|
66192
|
+
};
|
|
66188
66193
|
//#endregion
|
|
66189
66194
|
//#region src/sip/webrtc/index.ts
|
|
66190
66195
|
const { debug, version: version$2, UA, WebSocketInterface } = jssip_lib_JsSIP_js.default;
|
|
@@ -66193,14 +66198,16 @@ function patchRemoteSdp(sdp) {
|
|
|
66193
66198
|
sdp = sdp.replace(/(a=fmtp:\d+ [^\r\n]*packetization-mode[^\r\n]*)/g, "$1;x-google-start-bitrate=1500;x-google-min-bitrate=800;x-google-max-bitrate=3000");
|
|
66194
66199
|
return sdp;
|
|
66195
66200
|
}
|
|
66196
|
-
var SipPhone = class
|
|
66197
|
-
constructor(_instanceId, d, audioProcessing = {}) {
|
|
66201
|
+
var SipPhone = class extends ee_ts.EventEmitter {
|
|
66202
|
+
constructor(_instanceId, d, audioProcessing = {}, sipPhoneOptions = {}) {
|
|
66198
66203
|
super();
|
|
66199
66204
|
this.audioProcessing = audioProcessing;
|
|
66205
|
+
_defineProperty(this, "userAgent", void 0);
|
|
66200
66206
|
_defineProperty(this, "type", "webrtc");
|
|
66201
66207
|
_defineProperty(this, "ua", void 0);
|
|
66202
66208
|
_defineProperty(this, "sessionCache", /* @__PURE__ */ new Map());
|
|
66203
66209
|
_defineProperty(this, "log", void 0);
|
|
66210
|
+
this.userAgent = resolveUserAgent(sipPhoneOptions.userAgent);
|
|
66204
66211
|
this.log = new Log();
|
|
66205
66212
|
if (d) {
|
|
66206
66213
|
this.log.info(`JsSip version: ${version$2}`);
|
|
@@ -66283,7 +66290,7 @@ var SipPhone = class SipPhone extends ee_ts.EventEmitter {
|
|
|
66283
66290
|
uri: sipConf.uri,
|
|
66284
66291
|
authorization_user: sipConf.authorization_user,
|
|
66285
66292
|
ha1: sipConf.ha1,
|
|
66286
|
-
user_agent:
|
|
66293
|
+
user_agent: this.userAgent,
|
|
66287
66294
|
sockets: [socket],
|
|
66288
66295
|
session_timers: true,
|
|
66289
66296
|
display_name: sipConf.display_name,
|
|
@@ -66441,7 +66448,6 @@ var SipPhone = class SipPhone extends ee_ts.EventEmitter {
|
|
|
66441
66448
|
});
|
|
66442
66449
|
}
|
|
66443
66450
|
};
|
|
66444
|
-
_defineProperty(SipPhone, "userAgent", `Webitel-Phone/${version$2}`);
|
|
66445
66451
|
_defineProperty(SipPhone, "sipVersion", version$2);
|
|
66446
66452
|
async function getMediaStream(constraints) {
|
|
66447
66453
|
return new Promise((resolve, reject) => {
|
|
@@ -66728,7 +66734,7 @@ _defineProperty(SipPhone$1, "userAgent", `Webitel-Phone/${version$1}`);
|
|
|
66728
66734
|
_defineProperty(SipPhone$1, "sipVersion", version$1);
|
|
66729
66735
|
//#endregion
|
|
66730
66736
|
//#region src/version.ts
|
|
66731
|
-
const version = "26.4.
|
|
66737
|
+
const version = "26.4.33";
|
|
66732
66738
|
//#endregion
|
|
66733
66739
|
//#region src/socket/errors.ts
|
|
66734
66740
|
/**
|
|
@@ -67276,6 +67282,12 @@ var Task = class {
|
|
|
67276
67282
|
get hasReporting() {
|
|
67277
67283
|
return this.distribute.has_reporting;
|
|
67278
67284
|
}
|
|
67285
|
+
get memberJoinedAt() {
|
|
67286
|
+
return this.distribute.member_joined_at;
|
|
67287
|
+
}
|
|
67288
|
+
get queueMaxWaitTime() {
|
|
67289
|
+
return this.distribute.queue_max_wait_time;
|
|
67290
|
+
}
|
|
67279
67291
|
/**
|
|
67280
67292
|
* Чи дозволено звітування.
|
|
67281
67293
|
* @returns {boolean}
|
|
@@ -67732,6 +67744,7 @@ var Agent = class {
|
|
|
67732
67744
|
_defineProperty(this, "_channels", void 0);
|
|
67733
67745
|
_defineProperty(this, "_listOfflineMembers", void 0);
|
|
67734
67746
|
_defineProperty(this, "lastStatusChange", void 0);
|
|
67747
|
+
_defineProperty(this, "_waitingChatsSize", 0);
|
|
67735
67748
|
this.task = /* @__PURE__ */ new Map();
|
|
67736
67749
|
this._channels = /* @__PURE__ */ new Map();
|
|
67737
67750
|
this.initChannels(info.channels);
|
|
@@ -67749,6 +67762,9 @@ var Agent = class {
|
|
|
67749
67762
|
get agentId() {
|
|
67750
67763
|
return this.info.agent_id;
|
|
67751
67764
|
}
|
|
67765
|
+
get waitingChatsSize() {
|
|
67766
|
+
return this._waitingChatsSize;
|
|
67767
|
+
}
|
|
67752
67768
|
/**
|
|
67753
67769
|
* Метод, що повертає статус "On Demand".
|
|
67754
67770
|
* @method
|
|
@@ -67852,6 +67868,7 @@ var Agent = class {
|
|
|
67852
67868
|
if (e) {
|
|
67853
67869
|
this.waitingListCalls.length = 0;
|
|
67854
67870
|
this.waitingListChats.length = 0;
|
|
67871
|
+
this._waitingChatsSize = 0;
|
|
67855
67872
|
if (this.status !== "online") return;
|
|
67856
67873
|
for (const el of e.calls || []) this.waitingListCalls.push({
|
|
67857
67874
|
displayName: el.communication.name || "",
|
|
@@ -67862,6 +67879,7 @@ var Agent = class {
|
|
|
67862
67879
|
queue: el.queue,
|
|
67863
67880
|
wait: el.wait
|
|
67864
67881
|
});
|
|
67882
|
+
if (Array.isArray(e.chats)) this._waitingChatsSize = e.chats.length;
|
|
67865
67883
|
for (const el of e.chats || []) {
|
|
67866
67884
|
this.waitingListChats.push({
|
|
67867
67885
|
chat: el.communication.chat || "",
|
|
@@ -67887,7 +67905,8 @@ var Agent = class {
|
|
|
67887
67905
|
deleteWaitingAttempt(e) {
|
|
67888
67906
|
if (e) {
|
|
67889
67907
|
const attemptId = e.attempt_id;
|
|
67890
|
-
if (
|
|
67908
|
+
if (removeWaitingList(this.waitingListCalls, attemptId)) return;
|
|
67909
|
+
if (removeWaitingList(this.waitingListChats, attemptId)) this._waitingChatsSize--;
|
|
67891
67910
|
}
|
|
67892
67911
|
}
|
|
67893
67912
|
/**
|
|
@@ -68091,6 +68110,7 @@ var Agent = class {
|
|
|
68091
68110
|
} else {
|
|
68092
68111
|
this.waitingListCalls.length = 0;
|
|
68093
68112
|
this.waitingListChats.length = 0;
|
|
68113
|
+
this._waitingChatsSize = 0;
|
|
68094
68114
|
}
|
|
68095
68115
|
this.info.online_status = formatStatusPreset(e.status_preset);
|
|
68096
68116
|
this.info.status = e.status;
|
|
@@ -70348,6 +70368,7 @@ var Client = class extends ee_ts.EventEmitter {
|
|
|
70348
70368
|
_defineProperty(this, "pingTimer", void 0);
|
|
70349
70369
|
_defineProperty(this, "toneTimer", void 0);
|
|
70350
70370
|
_defineProperty(this, "screenResolver", void 0);
|
|
70371
|
+
_defineProperty(this, "userAgent", void 0);
|
|
70351
70372
|
this.log = new Log(_config.logLvl);
|
|
70352
70373
|
this.eventHandler = new ee_ts.EventEmitter();
|
|
70353
70374
|
this.callStore = /* @__PURE__ */ new Map();
|
|
@@ -70360,6 +70381,7 @@ var Client = class extends ee_ts.EventEmitter {
|
|
|
70360
70381
|
this.lastError = null;
|
|
70361
70382
|
this.lastLatency = null;
|
|
70362
70383
|
this.screenResolver = _config.screenResolver || null;
|
|
70384
|
+
this.userAgent = _config.userAgent || `webitel-web-phone-sdk.${this.buildVersion}`;
|
|
70363
70385
|
}
|
|
70364
70386
|
async connect() {
|
|
70365
70387
|
await this.connectToSocket();
|
|
@@ -71060,7 +71082,8 @@ var Client = class extends ee_ts.EventEmitter {
|
|
|
71060
71082
|
noiseSuppression: this._config.noiseSuppression,
|
|
71061
71083
|
autoGainControl: this._config.autoGainControl
|
|
71062
71084
|
};
|
|
71063
|
-
|
|
71085
|
+
const sipOptions = { userAgent: this.userAgent };
|
|
71086
|
+
return this.registerCallClient(this.connectionInfo.b2bua ? new SipPhone$1(this, audioProcessing) : new SipPhone(this.instanceId, this._config.debug, audioProcessing, sipOptions));
|
|
71064
71087
|
}
|
|
71065
71088
|
async latency() {
|
|
71066
71089
|
const ack = {
|