webitel-sdk 0.1.91 → 0.1.92

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.
@@ -25164,6 +25164,7 @@
25164
25164
  this.offeringAt = 0;
25165
25165
  this.answeredAt = 0;
25166
25166
  this.bridgedAt = 0;
25167
+ this.reportedAt = 0;
25167
25168
  this.startProcessingAt = 0;
25168
25169
  this.stopAt = 0;
25169
25170
  this.closedAt = 0;
@@ -25266,7 +25267,7 @@
25266
25267
  this.startProcessingAt = Date.now();
25267
25268
  }
25268
25269
  if (p.sec) {
25269
- p.timeout = Date.now() + p.sec * 1000; // bug
25270
+ p.timeout = this.startProcessingAt + p.sec * 1000; // bug
25270
25271
  }
25271
25272
  this._processing = p;
25272
25273
  };
@@ -25343,8 +25344,15 @@
25343
25344
  };
25344
25345
  Task.prototype.reporting = function (reporting) {
25345
25346
  return tslib.__awaiter(this, void 0, void 0, function () {
25347
+ var res;
25346
25348
  return tslib.__generator(this, function (_a) {
25347
- return [2 /*return*/, this.client.request('cc_reporting', tslib.__assign({ attempt_id: this.id }, reporting))];
25349
+ switch (_a.label) {
25350
+ case 0: return [4 /*yield*/, this.client.request('cc_reporting', tslib.__assign({ attempt_id: this.id }, reporting))];
25351
+ case 1:
25352
+ res = _a.sent();
25353
+ this.reportedAt = Date.now();
25354
+ return [2 /*return*/, res];
25355
+ }
25348
25356
  });
25349
25357
  });
25350
25358
  };
@@ -26724,7 +26732,7 @@
26724
26732
  call.answeredAt = c.answered_at || 0;
26725
26733
  call.bridgedAt = c.bridged_at || 0;
26726
26734
  call.hangupAt = c.hangup_at || 0;
26727
- call.reportingAt = c.reporting_at || 0;
26735
+ // call.reportingAt = c.reporting_at || 0
26728
26736
  if (c.task) {
26729
26737
  call.task = new Task(this, {
26730
26738
  attempt_id: c.task.attempt_id,
@@ -26734,6 +26742,14 @@
26734
26742
  }, c.task // todo add app_id
26735
26743
  );
26736
26744
  call.queue.reporting = 'true';
26745
+ if (c.leaving_at && c.task.processing_sec) {
26746
+ call.task.startProcessingAt = c.leaving_at;
26747
+ call.task.setProcessing({
26748
+ sec: c.task.processing_sec || 0,
26749
+ timeout: Date.now() - c.leaving_at + (c.task.processing_sec || 0) * 1000,
26750
+ renewal_sec: c.task.processing_renewal_sec || 0,
26751
+ });
26752
+ }
26737
26753
  }
26738
26754
  this.callStore.set(call.id, call);
26739
26755
  }
@@ -26758,6 +26774,26 @@
26758
26774
  messages = conv.messages.reverse();
26759
26775
  c = new Conversation(this, conv.id, conv.title, conv.members, messages, conv.variables);
26760
26776
  c.createdAt = conv.created_at;
26777
+ c.closedAt = conv.closed_at;
26778
+ if (conv.task) {
26779
+ c.task = new Task(this, {
26780
+ attempt_id: conv.task.attempt_id,
26781
+ channel: conv.task.channel,
26782
+ status: conv.task.status,
26783
+ timestamp: Date.now(),
26784
+ }, conv.task // todo add app_id
26785
+ );
26786
+ if (conv.leaving_at && conv.task.processing_sec) {
26787
+ c.task.startProcessingAt = conv.leaving_at;
26788
+ c.task.setProcessing({
26789
+ sec: conv.task.processing_sec || 0,
26790
+ timeout: Date.now() -
26791
+ conv.leaving_at +
26792
+ (conv.task.processing_sec || 0) * 1000,
26793
+ renewal_sec: conv.task.processing_renewal_sec || 0,
26794
+ });
26795
+ }
26796
+ }
26761
26797
  if (conv.invite_id) {
26762
26798
  c.setInvite(conv.invite_id, conv.created_at);
26763
26799
  }