mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 12:22:21 -06:00
feat: adiciona a funcionalidade de fake call
This commit is contained in:
@@ -555,6 +555,9 @@ export class EvolutionStartupService extends ChannelStartupService {
|
||||
public async fetchProfile() {
|
||||
throw new BadRequestException('Method not available on Evolution Channel');
|
||||
}
|
||||
public async offerCall() {
|
||||
throw new BadRequestException('Method not available on WhatsApp Business API');
|
||||
}
|
||||
public async sendPresence() {
|
||||
throw new BadRequestException('Method not available on Evolution Channel');
|
||||
}
|
||||
|
||||
@@ -1359,6 +1359,9 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
public async fetchProfile() {
|
||||
throw new BadRequestException('Method not available on WhatsApp Business API');
|
||||
}
|
||||
public async offerCall() {
|
||||
throw new BadRequestException('Method not available on WhatsApp Business API');
|
||||
}
|
||||
public async sendPresence() {
|
||||
throw new BadRequestException('Method not available on WhatsApp Business API');
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import { HandleLabelDto, LabelDto } from '@api/dto/label.dto';
|
||||
import {
|
||||
ContactMessage,
|
||||
MediaMessage,
|
||||
OfferCallDto,
|
||||
Options,
|
||||
SendAudioDto,
|
||||
SendContactDto,
|
||||
@@ -1670,6 +1671,25 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
public async offerCall({ number, callDuration }: OfferCallDto) {
|
||||
const jid = this.createJid(number);
|
||||
|
||||
try {
|
||||
const call = await this.client.offerCall(jid);
|
||||
if (callDuration) {
|
||||
setTimeout(async () => {
|
||||
console.log('Terminating call');
|
||||
const aaa = await this.client.terminateCall(call.id, call.to);
|
||||
console.log(aaa);
|
||||
}, callDuration * 1000);
|
||||
}
|
||||
|
||||
return call;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
private async sendMessage(
|
||||
sender: string,
|
||||
message: any,
|
||||
|
||||
Reference in New Issue
Block a user