mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-27 15:47:45 -06:00
- Added `wavoipToken` field to `Setting` model in both MySQL and PostgreSQL schemas. - Updated `package.json` and `package-lock.json` to include `mime-types` and `socket.io-client` dependencies. - Introduced `BaileysController` and `BaileysRouter` for handling WhatsApp interactions. - Refactored media type handling to use `mime-types` instead of `mime` across various services. - Updated DTOs and validation schemas to accommodate the new `wavoipToken` field. - Implemented voice call functionalities using the Wavoip service in the Baileys integration. - Enhanced event handling in the WebSocket controller to support new features.
61 lines
2.1 KiB
TypeScript
61 lines
2.1 KiB
TypeScript
import { InstanceDto } from '@api/dto/instance.dto';
|
|
import { WAMonitoringService } from '@api/services/monitor.service';
|
|
|
|
export class BaileysController {
|
|
constructor(private readonly waMonitor: WAMonitoringService) {}
|
|
|
|
public async onWhatsapp({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysOnWhatsapp(body?.jid);
|
|
}
|
|
|
|
public async profilePictureUrl({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysProfilePictureUrl(body?.jid, body?.type, body?.timeoutMs);
|
|
}
|
|
|
|
public async assertSessions({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysAssertSessions(body?.jids, body?.force);
|
|
}
|
|
|
|
public async createParticipantNodes({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysCreateParticipantNodes(body?.jids, body?.message, body?.extraAttrs);
|
|
}
|
|
|
|
public async getUSyncDevices({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysGetUSyncDevices(body?.jids, body?.useCache, body?.ignoreZeroDevices);
|
|
}
|
|
|
|
public async generateMessageTag({ instanceName }: InstanceDto) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysGenerateMessageTag();
|
|
}
|
|
|
|
public async sendNode({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysSendNode(body?.stanza);
|
|
}
|
|
|
|
public async signalRepositoryDecryptMessage({ instanceName }: InstanceDto, body: any) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysSignalRepositoryDecryptMessage(body?.jid, body?.type, body?.ciphertext);
|
|
}
|
|
|
|
public async getAuthState({ instanceName }: InstanceDto) {
|
|
const instance = this.waMonitor.waInstances[instanceName];
|
|
|
|
return instance.baileysGetAuthState();
|
|
}
|
|
}
|