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.mjs
CHANGED
|
@@ -66160,6 +66160,11 @@ var Session$2 = class {
|
|
|
66160
66160
|
}, 500);
|
|
66161
66161
|
}
|
|
66162
66162
|
};
|
|
66163
|
+
const DEFAULT_USER_AGENT = `webitel-web-phone-sdk/0.0.1`;
|
|
66164
|
+
const resolveUserAgent = (ua) => {
|
|
66165
|
+
var _ua$trim;
|
|
66166
|
+
return (_ua$trim = ua === null || ua === void 0 ? void 0 : ua.trim()) !== null && _ua$trim !== void 0 ? _ua$trim : DEFAULT_USER_AGENT;
|
|
66167
|
+
};
|
|
66163
66168
|
//#endregion
|
|
66164
66169
|
//#region src/sip/webrtc/index.ts
|
|
66165
66170
|
const { debug, version: version$2, UA, WebSocketInterface } = JsSIP;
|
|
@@ -66168,14 +66173,16 @@ function patchRemoteSdp(sdp) {
|
|
|
66168
66173
|
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");
|
|
66169
66174
|
return sdp;
|
|
66170
66175
|
}
|
|
66171
|
-
var SipPhone = class
|
|
66172
|
-
constructor(_instanceId, d, audioProcessing = {}) {
|
|
66176
|
+
var SipPhone = class extends EventEmitter {
|
|
66177
|
+
constructor(_instanceId, d, audioProcessing = {}, sipPhoneOptions = {}) {
|
|
66173
66178
|
super();
|
|
66174
66179
|
this.audioProcessing = audioProcessing;
|
|
66180
|
+
_defineProperty(this, "userAgent", void 0);
|
|
66175
66181
|
_defineProperty(this, "type", "webrtc");
|
|
66176
66182
|
_defineProperty(this, "ua", void 0);
|
|
66177
66183
|
_defineProperty(this, "sessionCache", /* @__PURE__ */ new Map());
|
|
66178
66184
|
_defineProperty(this, "log", void 0);
|
|
66185
|
+
this.userAgent = resolveUserAgent(sipPhoneOptions.userAgent);
|
|
66179
66186
|
this.log = new Log();
|
|
66180
66187
|
if (d) {
|
|
66181
66188
|
this.log.info(`JsSip version: ${version$2}`);
|
|
@@ -66258,7 +66265,7 @@ var SipPhone = class SipPhone extends EventEmitter {
|
|
|
66258
66265
|
uri: sipConf.uri,
|
|
66259
66266
|
authorization_user: sipConf.authorization_user,
|
|
66260
66267
|
ha1: sipConf.ha1,
|
|
66261
|
-
user_agent:
|
|
66268
|
+
user_agent: this.userAgent,
|
|
66262
66269
|
sockets: [socket],
|
|
66263
66270
|
session_timers: true,
|
|
66264
66271
|
display_name: sipConf.display_name,
|
|
@@ -66416,7 +66423,6 @@ var SipPhone = class SipPhone extends EventEmitter {
|
|
|
66416
66423
|
});
|
|
66417
66424
|
}
|
|
66418
66425
|
};
|
|
66419
|
-
_defineProperty(SipPhone, "userAgent", `Webitel-Phone/${version$2}`);
|
|
66420
66426
|
_defineProperty(SipPhone, "sipVersion", version$2);
|
|
66421
66427
|
async function getMediaStream(constraints) {
|
|
66422
66428
|
return new Promise((resolve, reject) => {
|
|
@@ -66703,7 +66709,7 @@ _defineProperty(SipPhone$1, "userAgent", `Webitel-Phone/${version$1}`);
|
|
|
66703
66709
|
_defineProperty(SipPhone$1, "sipVersion", version$1);
|
|
66704
66710
|
//#endregion
|
|
66705
66711
|
//#region src/version.ts
|
|
66706
|
-
const version = "26.4.
|
|
66712
|
+
const version = "26.4.33";
|
|
66707
66713
|
//#endregion
|
|
66708
66714
|
//#region src/socket/errors.ts
|
|
66709
66715
|
/**
|
|
@@ -67251,6 +67257,12 @@ var Task = class {
|
|
|
67251
67257
|
get hasReporting() {
|
|
67252
67258
|
return this.distribute.has_reporting;
|
|
67253
67259
|
}
|
|
67260
|
+
get memberJoinedAt() {
|
|
67261
|
+
return this.distribute.member_joined_at;
|
|
67262
|
+
}
|
|
67263
|
+
get queueMaxWaitTime() {
|
|
67264
|
+
return this.distribute.queue_max_wait_time;
|
|
67265
|
+
}
|
|
67254
67266
|
/**
|
|
67255
67267
|
* Чи дозволено звітування.
|
|
67256
67268
|
* @returns {boolean}
|
|
@@ -67707,6 +67719,7 @@ var Agent = class {
|
|
|
67707
67719
|
_defineProperty(this, "_channels", void 0);
|
|
67708
67720
|
_defineProperty(this, "_listOfflineMembers", void 0);
|
|
67709
67721
|
_defineProperty(this, "lastStatusChange", void 0);
|
|
67722
|
+
_defineProperty(this, "_waitingChatsSize", 0);
|
|
67710
67723
|
this.task = /* @__PURE__ */ new Map();
|
|
67711
67724
|
this._channels = /* @__PURE__ */ new Map();
|
|
67712
67725
|
this.initChannels(info.channels);
|
|
@@ -67724,6 +67737,9 @@ var Agent = class {
|
|
|
67724
67737
|
get agentId() {
|
|
67725
67738
|
return this.info.agent_id;
|
|
67726
67739
|
}
|
|
67740
|
+
get waitingChatsSize() {
|
|
67741
|
+
return this._waitingChatsSize;
|
|
67742
|
+
}
|
|
67727
67743
|
/**
|
|
67728
67744
|
* Метод, що повертає статус "On Demand".
|
|
67729
67745
|
* @method
|
|
@@ -67827,6 +67843,7 @@ var Agent = class {
|
|
|
67827
67843
|
if (e) {
|
|
67828
67844
|
this.waitingListCalls.length = 0;
|
|
67829
67845
|
this.waitingListChats.length = 0;
|
|
67846
|
+
this._waitingChatsSize = 0;
|
|
67830
67847
|
if (this.status !== "online") return;
|
|
67831
67848
|
for (const el of e.calls || []) this.waitingListCalls.push({
|
|
67832
67849
|
displayName: el.communication.name || "",
|
|
@@ -67837,6 +67854,7 @@ var Agent = class {
|
|
|
67837
67854
|
queue: el.queue,
|
|
67838
67855
|
wait: el.wait
|
|
67839
67856
|
});
|
|
67857
|
+
if (Array.isArray(e.chats)) this._waitingChatsSize = e.chats.length;
|
|
67840
67858
|
for (const el of e.chats || []) {
|
|
67841
67859
|
this.waitingListChats.push({
|
|
67842
67860
|
chat: el.communication.chat || "",
|
|
@@ -67862,7 +67880,8 @@ var Agent = class {
|
|
|
67862
67880
|
deleteWaitingAttempt(e) {
|
|
67863
67881
|
if (e) {
|
|
67864
67882
|
const attemptId = e.attempt_id;
|
|
67865
|
-
if (
|
|
67883
|
+
if (removeWaitingList(this.waitingListCalls, attemptId)) return;
|
|
67884
|
+
if (removeWaitingList(this.waitingListChats, attemptId)) this._waitingChatsSize--;
|
|
67866
67885
|
}
|
|
67867
67886
|
}
|
|
67868
67887
|
/**
|
|
@@ -68066,6 +68085,7 @@ var Agent = class {
|
|
|
68066
68085
|
} else {
|
|
68067
68086
|
this.waitingListCalls.length = 0;
|
|
68068
68087
|
this.waitingListChats.length = 0;
|
|
68088
|
+
this._waitingChatsSize = 0;
|
|
68069
68089
|
}
|
|
68070
68090
|
this.info.online_status = formatStatusPreset(e.status_preset);
|
|
68071
68091
|
this.info.status = e.status;
|
|
@@ -70323,6 +70343,7 @@ var Client = class extends EventEmitter {
|
|
|
70323
70343
|
_defineProperty(this, "pingTimer", void 0);
|
|
70324
70344
|
_defineProperty(this, "toneTimer", void 0);
|
|
70325
70345
|
_defineProperty(this, "screenResolver", void 0);
|
|
70346
|
+
_defineProperty(this, "userAgent", void 0);
|
|
70326
70347
|
this.log = new Log(_config.logLvl);
|
|
70327
70348
|
this.eventHandler = new EventEmitter();
|
|
70328
70349
|
this.callStore = /* @__PURE__ */ new Map();
|
|
@@ -70335,6 +70356,7 @@ var Client = class extends EventEmitter {
|
|
|
70335
70356
|
this.lastError = null;
|
|
70336
70357
|
this.lastLatency = null;
|
|
70337
70358
|
this.screenResolver = _config.screenResolver || null;
|
|
70359
|
+
this.userAgent = _config.userAgent || `webitel-web-phone-sdk.${this.buildVersion}`;
|
|
70338
70360
|
}
|
|
70339
70361
|
async connect() {
|
|
70340
70362
|
await this.connectToSocket();
|
|
@@ -71035,7 +71057,8 @@ var Client = class extends EventEmitter {
|
|
|
71035
71057
|
noiseSuppression: this._config.noiseSuppression,
|
|
71036
71058
|
autoGainControl: this._config.autoGainControl
|
|
71037
71059
|
};
|
|
71038
|
-
|
|
71060
|
+
const sipOptions = { userAgent: this.userAgent };
|
|
71061
|
+
return this.registerCallClient(this.connectionInfo.b2bua ? new SipPhone$1(this, audioProcessing) : new SipPhone(this.instanceId, this._config.debug, audioProcessing, sipOptions));
|
|
71039
71062
|
}
|
|
71040
71063
|
async latency() {
|
|
71041
71064
|
const ack = {
|