feat: adiciona controlador de chamadas

Adiciona o controlador de chamadas para oferecer chamadas falsas.

- Adiciona o arquivo `call.controller.ts` com a classe `CallController` que possui o método `offerCall` para oferecer chamadas falsas.
- Adiciona o arquivo `call.dto.ts` com as classes `Metadata` e `OfferCallDto` para definir os dados da chamada.
- Atualiza o arquivo `sendMessage.dto.ts` removendo a classe `OfferCallDto`.
- Atualiza o arquivo `whatsapp.baileys.service.ts` importando a classe `OfferCallDto` corretamente e atualizando o método `offerCall` para receber os parâmetros corretos.
- Adiciona o arquivo `call.router.ts` com a classe `CallRouter` para lidar com as rotas relacionadas a chamadas.
- Atualiza o arquivo `index.router.ts` para incluir as rotas relacionadas a chamadas.
This commit is contained in:
Felipe Medeiros
2024-10-07 10:49:51 -03:00
parent 0af00582f0
commit bcf59a2015
7 changed files with 50 additions and 23 deletions

View File

@@ -1,3 +1,4 @@
import { OfferCallDto } from '@api/dto/call.dto';
import {
ArchiveChatDto,
BlockUserDto,
@@ -32,7 +33,6 @@ import { HandleLabelDto, LabelDto } from '@api/dto/label.dto';
import {
ContactMessage,
MediaMessage,
OfferCallDto,
Options,
SendAudioDto,
SendContactDto,
@@ -1671,14 +1671,12 @@ export class BaileysStartupService extends ChannelStartupService {
}
}
public async offerCall({ number, callDuration }: OfferCallDto) {
public async offerCall({ number, isVideo, callDuration }: OfferCallDto) {
const jid = this.createJid(number);
try {
const call = await this.client.offerCall(jid);
if (callDuration) {
setTimeout(() => this.client.terminateCall(call.id, call.to), callDuration * 1000);
}
const call = await this.client.offerCall(jid, isVideo);
setTimeout(() => this.client.terminateCall(call.id, call.to), callDuration * 1000);
return call;
} catch (error) {