Fix call offer from lid call (#1670)

* Fix call offer from lid call

* check prettier
This commit is contained in:
Renato Freitas
2025-08-06 19:21:20 -03:00
committed by GitHub
parent 812e53e4eb
commit 260311e6a2
+22 -1
View File
@@ -10,6 +10,7 @@ import type {
MessageUserReceipt,
SocketConfig,
WACallEvent,
WACallUpdateType,
WAMessageKey,
WAPatchName
} from '../Types'
@@ -50,6 +51,7 @@ import {
isJidGroup,
isJidStatusBroadcast,
isJidUser,
isLidUser,
jidDecode,
jidNormalizedUser,
S_WHATSAPP_NET
@@ -935,15 +937,34 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}
const handleCall = async (node: BinaryNode) => {
let status: WACallUpdateType
const { attrs } = node
const [infoChild] = getAllBinaryNodeChildren(node)
if (!infoChild) {
throw new Boom('Missing call info in call node')
}
const callId = infoChild.attrs['call-id']!
const from = infoChild.attrs.from! || infoChild.attrs['call-creator']!
const status = getCallStatusFromNode(infoChild)
status = getCallStatusFromNode(infoChild)
if (isLidUser(from) && infoChild.tag === 'relaylatency') {
const verify = callOfferCache.get(callId)
if (!verify) {
status = 'offer'
const callLid: WACallEvent = {
chatId: attrs.from!,
from,
id: callId,
date: new Date(+attrs.t! * 1000),
offline: !!attrs.offline,
status
}
callOfferCache.set(callId, callLid)
}
}
const call: WACallEvent = {
chatId: attrs.from!,
from,