From c113e683e74e8b86b7bcd9c2186ed20a3c29ce87 Mon Sep 17 00:00:00 2001 From: Rahul Kasireddy <66378906+RahulKasireddy@users.noreply.github.com> Date: Sun, 14 Aug 2022 12:04:24 +0530 Subject: [PATCH] Update messages-recv.ts --- src/Socket/messages-recv.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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) => {