diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index 4a30c06..7305c90 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -20,6 +20,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { ev, authState, ws, + query, processingMutex, upsertMessage, resyncAppState, @@ -65,28 +66,26 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { await sendNode(stanza) } - const rejectCall = async(call_id: string) => { - const _call_offer = (call_id ? callOfferData[call_id] : callOfferData[Object.keys(callOfferData)[0]]); - const stanza: BinaryNode = { + const rejectCall = async(callId: string) => { + const callOffer = callOfferData[callId]: WACallEvent; + const stanza: BinaryNode = ({ tag: 'call', attrs: { from: authState.creds.me!.id, - to: _call_offer.from, + to: callOffer.from, id: (new Date().getTime() / 1000).toString().replace('.', '-'), }, content: [{ tag: 'reject', attrs: { - 'call-id': call_id, - 'call-creator': _call_offer.from, + 'call-id': callId, + 'call-creator': callOffer.from, count: '0', }, content: undefined, }], - } - - logger.debug({ call_id, caller: _call_offer.from, me: authState.creds.me!.id, }, 'rejecting call') - await sendNode(stanza) + }); + await query(stanza) } const sendRetryRequest = async(node: BinaryNode, forceIncludeKeys = false) => {