mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 04:12:23 -06:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user