From 7c859f23d9c666a6c2187fe2e93af50140991ba1 Mon Sep 17 00:00:00 2001 From: Lucas Pelegrino Date: Tue, 30 Dec 2025 17:46:09 -0300 Subject: [PATCH 1/4] fix: attempts to fix transfer room issue for non-client calls --- apps/meteor/app/livechat/server/lib/Helper.ts | 5 ++--- apps/meteor/app/livechat/server/lib/RoutingManager.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/meteor/app/livechat/server/lib/Helper.ts b/apps/meteor/app/livechat/server/lib/Helper.ts index 440b77a934a31..3278acef76757 100644 --- a/apps/meteor/app/livechat/server/lib/Helper.ts +++ b/apps/meteor/app/livechat/server/lib/Helper.ts @@ -505,12 +505,11 @@ export const forwardRoomToAgent = async (room: IOmnichannelRoom, transferData: T // There are some Enterprise features that may interrupt the forwarding process // Due to that we need to check whether the agent has been changed or not logger.debug(`Forwarding inquiry ${inquiry._id} to agent ${agent.agentId}`); + const options = typeof clientAction !== 'undefined' ? { clientAction } : undefined; const roomTaken = await RoutingManager.takeInquiry( inquiry, agent, - { - ...(clientAction && { clientAction }), - }, + options, room, ); if (!roomTaken) { diff --git a/apps/meteor/app/livechat/server/lib/RoutingManager.ts b/apps/meteor/app/livechat/server/lib/RoutingManager.ts index 20f7a82e4c664..308b3bcfd9eb4 100644 --- a/apps/meteor/app/livechat/server/lib/RoutingManager.ts +++ b/apps/meteor/app/livechat/server/lib/RoutingManager.ts @@ -60,7 +60,7 @@ type Routing = { 'estimatedInactivityCloseTimeAt' | 'message' | 't' | 'source' | 'estimatedWaitingTimeQueue' | 'priorityWeight' | '_updatedAt' >, agent: SelectedAgent | null, - options: { clientAction?: boolean; forwardingToDepartment?: { oldDepartmentId?: string; transferData?: any } }, + options: { clientAction?: boolean; forwardingToDepartment?: { oldDepartmentId?: string; transferData?: any } } | undefined, room: IOmnichannelRoom, ): Promise; transferRoom(room: IOmnichannelRoom, guest: ILivechatVisitor, transferData: TransferData): Promise; From 04ac72498afb7d5d7d61db6e6dc498c87406d481 Mon Sep 17 00:00:00 2001 From: Lucas Pelegrino Date: Wed, 31 Dec 2025 13:50:45 -0300 Subject: [PATCH 2/4] chore: fix prettier error --- apps/meteor/app/livechat/server/lib/Helper.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/meteor/app/livechat/server/lib/Helper.ts b/apps/meteor/app/livechat/server/lib/Helper.ts index 3278acef76757..e0445024dea0c 100644 --- a/apps/meteor/app/livechat/server/lib/Helper.ts +++ b/apps/meteor/app/livechat/server/lib/Helper.ts @@ -506,12 +506,7 @@ export const forwardRoomToAgent = async (room: IOmnichannelRoom, transferData: T // Due to that we need to check whether the agent has been changed or not logger.debug(`Forwarding inquiry ${inquiry._id} to agent ${agent.agentId}`); const options = typeof clientAction !== 'undefined' ? { clientAction } : undefined; - const roomTaken = await RoutingManager.takeInquiry( - inquiry, - agent, - options, - room, - ); +const roomTaken = await RoutingManager.takeInquiry(inquiry, agent, options, room); if (!roomTaken) { logger.debug(`Cannot forward inquiry ${inquiry._id}`); return false; From 6c6b294265020d33989c03e1de2584440a3127d2 Mon Sep 17 00:00:00 2001 From: Lucas Pelegrino Date: Fri, 2 Jan 2026 13:05:59 -0300 Subject: [PATCH 3/4] chore: fix prettier errors --- apps/meteor/app/livechat/server/lib/Helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/livechat/server/lib/Helper.ts b/apps/meteor/app/livechat/server/lib/Helper.ts index e0445024dea0c..2ec16f92a6347 100644 --- a/apps/meteor/app/livechat/server/lib/Helper.ts +++ b/apps/meteor/app/livechat/server/lib/Helper.ts @@ -506,7 +506,7 @@ export const forwardRoomToAgent = async (room: IOmnichannelRoom, transferData: T // Due to that we need to check whether the agent has been changed or not logger.debug(`Forwarding inquiry ${inquiry._id} to agent ${agent.agentId}`); const options = typeof clientAction !== 'undefined' ? { clientAction } : undefined; -const roomTaken = await RoutingManager.takeInquiry(inquiry, agent, options, room); + const roomTaken = await RoutingManager.takeInquiry(inquiry, agent, options, room); if (!roomTaken) { logger.debug(`Cannot forward inquiry ${inquiry._id}`); return false; From 1b70ad5b182bc5079b888b373d4e7e0c72de0656 Mon Sep 17 00:00:00 2001 From: Lucas Pelegrino Date: Fri, 2 Jan 2026 17:04:27 -0300 Subject: [PATCH 4/4] chore: improves callback room validation and return --- apps/meteor/app/livechat/server/lib/RoutingManager.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/livechat/server/lib/RoutingManager.ts b/apps/meteor/app/livechat/server/lib/RoutingManager.ts index 308b3bcfd9eb4..ee55129957e21 100644 --- a/apps/meteor/app/livechat/server/lib/RoutingManager.ts +++ b/apps/meteor/app/livechat/server/lib/RoutingManager.ts @@ -266,7 +266,12 @@ export const RoutingManager: Routing = { inquiry, options, }); - return cbRoom; + + if (cbRoom && cbRoom.chatQueued) { + return cbRoom; + } + + return; } const result = await LivechatInquiry.takeInquiry(_id, inquiry.lockedAt);