Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW][ENTERPRISE] Maximum waiting time for chats in Omnichannel queue #22955

Merged
merged 16 commits into from
Aug 20, 2021

Conversation

KevLehman
Copy link
Contributor

Proposed changes (including videos or screenshots)

  • Add new settings to support closing chats that have been too long on waiting queue
  • Moved old settings to new "Queue Management" section
  • Fix issue when closing a livechat room that caused client to not to know if room was open or not

Issue(s)

Steps to test or reproduce

Further comments

ee/app/livechat-enterprise/server/settings.js Show resolved Hide resolved
ee/app/livechat-enterprise/server/settings.js Show resolved Hide resolved
ee/app/livechat-enterprise/server/settings.js Outdated Show resolved Hide resolved
ee/app/livechat-enterprise/server/settings.js Outdated Show resolved Hide resolved
app/livechat/server/lib/Helper.js Outdated Show resolved Hide resolved
ee/app/livechat-enterprise/server/startup.js Show resolved Hide resolved
ee/app/livechat-enterprise/server/startup.js Outdated Show resolved Hide resolved
return;
}
const timer = settings.get('Livechat_max_queue_wait_time');
callbacks.add('livechat:afterReturnRoomAsInquiry', setQueueTimer(timer), callbacks.priority.HIGH, 'livechat-after-return-room-as-inquiry-set-queue-timer');
Copy link
Contributor

@renatobecker renatobecker Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't rely only on this callback to update the estimated Inactivity close time because this callback is only called when the routing system algorithm is Manual Selection, but Inquiries are queued in all algorithms, so we need to rely on a more consist solution that will cover all use cases.

So, we need to track this method -> LivechatInquiry.queueInquiry. As far as I know, the method is called twice in the code, so rather than calling LivechatInquiry.queueInquiry directly, we could maybe create a new method that would be called and inside the new method you'd call -> LivechatInquiry.queueInquiry and, also, run a new callback method right away, so rather than implementing this logic here, you could implement the logic for the new callback I just mentioned, something like: livechat:afterQueueInquiry, WDYT?

You could, even, improve the signature of the method Livechat.queueInquiry and support additional data, so you could also pass along the new value of estimatedInactivityCloseTimeAt and update the document at once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey but this callback is called only on returnRoomAsInquiry method, this callback should just set the value again when the user returns the chat to the queue, and as far as i can see on app/livechat/server/lib/Livechat.js L663 this should happen disregards of the routing algorithm.

The callback that sets the value when the chat first comes is on the createLivechatInquiry method (using the livechat.beforeInquiry cb) and that should also run on all routing algos, since it happens before queueing the inquiry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding returnRoomAsInquiry:

  • The method is called when a user returns the chat to the queue manually(Only available on Manual Selection)
  • The method is called when the agent didn't reply and the chat is auto-transferred, however, there's a condition: RoutingManager.getConfig().autoAssignAgent ==== Manual Selection.

Apart from that, the chat can be queued in other places, such as here:

if (chatQueued) {
LivechatInquiry.readyInquiry(inquiry._id);
const newInquiry = LivechatInquiry.findOneById(inquiry._id);
await queueInquiry(room, newInquiry);

So, as you can see, the chat will be queued, but the estimatedInactivityCloseTimeAt won't be set, that's the reason we should implement a more centralized solution that would cover all cases and would reduce complexity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting to know. What about using the livechat.beforeRouteChat to set that value then? (or create another callback def at the same place as this) to avoid having to modify multiple files by changing the function signature?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO we should wrap the method LivechatInquiry.queueInquiry(called twice in the codebase) in a new method that, as the last step, would call a new callback, perhaps -> livechat:afterQueueInquired and, then, implement the logic for the new callback.
In this case, we wouldn't need to implement callbacks for livechat.beforeInquiry nor livechat:afterReturnRoomAsInquiry, just one single callback method would do the trick.

@renatobecker renatobecker changed the title Improve/close abandoned queued chats [NEW][ENTERPRISE] Maximum waiting time for chats in the Omnichannel queue Aug 20, 2021
@renatobecker renatobecker changed the title [NEW][ENTERPRISE] Maximum waiting time for chats in the Omnichannel queue [NEW][ENTERPRISE] Maximum waiting time for chats in Omnichannel queue Aug 20, 2021
@KevLehman KevLehman merged commit 94ee74e into develop Aug 20, 2021
@KevLehman KevLehman deleted the improve/close-abandoned-queued-chats branch August 20, 2021 15:24
@sampaiodiego sampaiodiego mentioned this pull request Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants