Skip to content

Commit

Permalink
fix: add validation to prevent group calls in whatsapp.baileys.servic…
Browse files Browse the repository at this point in the history
…e.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.
  • Loading branch information
DavidsonGomes committed Jun 14, 2024
1 parent 92a0d8c commit 2d49c73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/services/channels/whatsapp.baileys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2d49c73

Please sign in to comment.