From 2d49c73023fa65bfc6b0f4974cedce5b49dfea80 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Fri, 14 Jun 2024 09:45:02 -0300 Subject: [PATCH] fix: add validation to prevent group calls in whatsapp.baileys.service.ts Added a check to prevent group calls by throwing a BadRequestException when a group JID is detected. This change ensures that only individual calls are processed, preventing unsupported group call attempts and improving error handling. --- src/api/services/channels/whatsapp.baileys.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/services/channels/whatsapp.baileys.service.ts b/src/api/services/channels/whatsapp.baileys.service.ts index 388dd6e6..968fa0e2 100644 --- a/src/api/services/channels/whatsapp.baileys.service.ts +++ b/src/api/services/channels/whatsapp.baileys.service.ts @@ -3438,6 +3438,11 @@ export class BaileysStartupService extends ChannelStartupService { public async fakeCall(data: FakeCallDto) { try { const number = this.createJid(data.number); + + if (number.includes('@g.us')) { + throw new BadRequestException('Group calls are not supported'); + } + const mdDelay = data.delay ?? 0; const call = await this.client.offerCall(number);