webitel-sdk 23.7.15 → 23.7.17

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.
@@ -43152,42 +43152,36 @@ class Agent {
43152
43152
  get stateDuration() {
43153
43153
  return Math.round((Date.now() - this.lastStatusChange) / 1000);
43154
43154
  }
43155
- // todo need refactor
43156
43155
  setWaitingList(e) {
43157
43156
  if (e) {
43158
- const list = e.list;
43159
43157
  this.waitingListCalls.length = 0;
43160
43158
  this.waitingListChats.length = 0;
43161
- for (const el of list) {
43162
- switch (el.channel) {
43163
- case ChannelType.Call:
43164
- this.waitingListCalls.push({
43165
- displayName: el.communication.name || '',
43166
- displayNumber: el.communication.destination || '',
43167
- attemptId: el.attempt_id,
43168
- sessionId: el.session_id,
43169
- deadline: el.deadline,
43170
- position: el.position,
43171
- queue: el.queue,
43172
- wait: el.wait,
43173
- });
43174
- break;
43175
- case ChannelType.Chat:
43176
- this.waitingListChats.push({
43177
- chat: el.communication.chat || '',
43178
- displayName: el.communication.name || '',
43179
- message: el.communication.msg || '',
43180
- peer: el.communication.destination || '',
43181
- attemptId: el.attempt_id,
43182
- sessionId: el.session_id,
43183
- deadline: el.deadline,
43184
- position: el.position,
43185
- queue: el.queue,
43186
- wait: el.wait,
43187
- });
43188
- break;
43189
- default:
43190
- }
43159
+ if (this.status !== AgentStatus.Online) {
43160
+ return;
43161
+ }
43162
+ for (const el of (e.calls || [])) {
43163
+ this.waitingListCalls.push({
43164
+ displayName: el.communication.name || '',
43165
+ displayNumber: el.communication.destination || '',
43166
+ attemptId: el.attempt_id,
43167
+ sessionId: el.session_id,
43168
+ deadline: el.deadline,
43169
+ queue: el.queue,
43170
+ wait: el.wait,
43171
+ });
43172
+ }
43173
+ for (const el of (e.chats || [])) {
43174
+ this.waitingListChats.push({
43175
+ chat: el.communication.chat || '',
43176
+ displayName: el.communication.name || '',
43177
+ message: el.communication.msg || '',
43178
+ peer: el.communication.destination || '',
43179
+ attemptId: el.attempt_id,
43180
+ sessionId: el.session_id,
43181
+ deadline: el.deadline,
43182
+ queue: el.queue,
43183
+ wait: el.wait,
43184
+ });
43191
43185
  }
43192
43186
  }
43193
43187
  }
@@ -43360,6 +43354,10 @@ class Agent {
43360
43354
  this.info.on_demand = e.on_demand || false;
43361
43355
  this.initChannels(e.channels);
43362
43356
  }
43357
+ else {
43358
+ this.waitingListCalls.length = 0;
43359
+ this.waitingListChats.length = 0;
43360
+ }
43363
43361
  this.info.status = e.status;
43364
43362
  this.info.status_payload = e.status_payload ? e.status_payload : null;
43365
43363
  this.lastStatusChange = Date.now();