[BUG] msgCall quebra com TypeError quando quem liga chega como @lid, e o erro engole o webhook CALL do offer
Maintainer antworten meist innerhalb von 4 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- backend-api-design
Rechercherichtung
Read src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts around lines 1886–1899 in tag 2.3.7, focusing on the call offer handler, LID mapping, sendMessage, and sendDataWebhook. Trace what happens when getPNForLID() returns undefined and check how an error affects the remaining event handlers. Done means an unmapped LID cannot suppress the CALL offer webhook or abort unrelated events, while the webhook retains the original caller JID.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bem-vindo!
- Sim, pesquisei problemas semelhantes no GitHub e não encontrei nenhum.
O que você fez?
Tenho instâncias Baileys numa Evolution 2.3.7, algumas delas com recusa automática de chamada ligada:
{ "rejectCall": true, "msgCall": "📵 Desculpe, esse número não recebe chamadas; envie uma mensagem!" }
Comparando o que acontece quando alguém liga para essas instâncias, encontrei dois comportamentos diferentes, dependendo apenas do formato do JID de quem liga:
| Quem ligou chegou como | Chamada recusada | msgCall enviada |
|---|---|---|
5511xxxxxxxxx:[email protected] |
sim | sim |
2148301202187xx@lid |
sim | não — estoura TypeError |
O que você esperava?
Que a mensagem do msgCall fosse enviada em qualquer um dos dois casos, e que uma falha nesse envio não afetasse mais nada.
O que vc observou ao invés do que esperava?
Quando quem liga chega como @lid, a chamada é recusada (o servidor confirma com CB:ack, class: 'call', type: 'reject'), mas o envio da mensagem quebra:
[Evolution API] [<instancia>] v2.3.7 - ERROR [ChannelStartupService]
TypeError: Cannot destructure property 'user' of 'jidDecode(...)' as it is undefined.
at relayMessage (file:///evolution/node_modules/baileys/lib/Socket/messages-send.js:408:17)
at Object.sendMessage (file:///evolution/node_modules/baileys/lib/Socket/messages-send.js:957:23)
at async /evolution/dist/main.js:263:3482
Causa, em src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts (linhas 1886–1899 na tag 2.3.7):
if (settings?.rejectCall && call.status == 'offer') {
this.client.rejectCall(call.id, call.from);
}
if (settings?.msgCall?.trim().length > 0 && call.status == 'offer') {
if (call.from.endsWith('@lid')) {
call.from = await this.client.signalRepository.lidMapping.getPNForLID(call.from as string);
}
const msg = await this.client.sendMessage(call.from, { text: settings.msgCall });
this.client.ev.emit('messages.upsert', { messages: [msg], type: 'notify' });
}
this.sendDataWebhook(Events.CALL, call);
Quando o LID de quem liga ainda não tem mapeamento para telefone — caso comum de alguém que nunca conversou com o número —, getPNForLID() devolve undefined. O valor é escrito de volta em call.from, e o sendMessage(undefined, …) cai no jidDecode(undefined) dentro do Baileys.
Três consequências, em ordem de gravidade:
- A exceção aborta o restante do lote de eventos. O
tryque envolve esse trecho cobre tambémconnection.update,messages.upsert,creds.updatee os demais handlers do mesmo lote doev.process. Uma chamada perdida pode, portanto, descartar eventos que nada têm a ver com chamada. - O webhook
CALLdooffernunca é entregue, porquesendDataWebhook()vem depois do envio. Confirmado aqui comparando duas instâncias com a mesma configuração: na que o envio funcionou, o webhook recebeustatus: "offer"e depois osringing; na que estourou, só chegaram osringing— oofferdesapareceu. Quem integra perde justamente o evento que indica a chamada entrando. call.fromé modificado antes do webhook. Quando o mapeamento funciona, o payload doCALLsai com o telefone no lugar do@lidoriginal, ou seja, o mesmo campo tem significado diferente dependendo de o mapeamento existir ou não.
Como reproduzir
- Instância Baileys com
rejectCall: trueemsgCallpreenchido. - Ligar para o número a partir de uma conta que nunca trocou mensagem com ele (para não haver mapeamento LID→telefone).
- A chamada é cortada, a mensagem não chega e o log mostra o TypeError acima. O webhook não recebe o evento com
status: "offer".
Capturas de Tela/Vídeos
Sem resposta
Qual versão da API você está usando?
v2.3.7 (evoapicloud/evolution-api:latest, baileys 7.0.0-rc.9)
Qual é o seu ambiente?
Docker
Outras especificações do ambiente
Docker Swarm, Postgres 14, Redis, instâncias Baileys atrás de proxy HTTP.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 10.2k
- Forks
- 7.5k
- Ø Merge
- 6 T. 19 Std.
- Gemergte PRs (30 T.)
- 4
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus evolution-foundation/evolution-api
-
[BUG] /chat/findMessages ignores where.key.fromMe when value is falseEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
evolution-foundation/evolution-api#2796 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
evolution-foundation/evolution-api#2795 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
evolution-foundation/evolution-api#2782 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
evolution-foundation/evolution-api#2723 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
evolution-foundation/evolution-api#2704 ·
Maintainer antworten meist innerhalb von 4 Tagen
Alle Issues in evolution-foundation/evolution-api
Ähnliche Issues
-
foreground-up-signals-live: delivery-repair cell expects a spawn suggestion status no longer printsOffenbug triage:owned
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
e2e-failure ready-to-code
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
redhat-developer/rhdh-plugin-export-overlays#4905 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
directus/directus#28558 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
review: medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
1lck/Lithe-IDEA#2432 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
cloudflare/workers-sdk#17189 ·
Maintainer antworten meist innerhalb von 1 Tag