Skip to content

Commit 0ef3837

Browse files
author
Hamza Shahid
committed
fix: ensure stateConnection is initialized before connecting
1 parent b652070 commit 0ef3837

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,14 @@ export class BaileysStartupService extends ChannelStartupService {
695695

696696
this.endSession = false;
697697

698+
// Ensure stateConnection is initialized
699+
if (!this.stateConnection) {
700+
this.stateConnection = { state: 'close' };
701+
}
702+
698703
this.client = makeWASocket(socketConfig);
699704

700-
if (this.localSettings.wavoipToken && this.localSettings.wavoipToken.length > 0) {
705+
if (this.localSettings.wavoipToken && this.localSettings.wavoipToken.length > 0 && this.connectionStatus?.state) {
701706
useVoiceCallsBaileys(this.localSettings.wavoipToken, this.client, this.connectionStatus.state as any, true);
702707
}
703708

0 commit comments

Comments
 (0)