From ed00a57c843695e5af05344edb3bebc893537fd5 Mon Sep 17 00:00:00 2001 From: vini <91087061+vinikjkkj@users.noreply.github.com> Date: Sun, 22 Sep 2024 08:34:29 -0300 Subject: [PATCH] remove duplicated call reject event / add terminate tag (#1031) * initial commit * add terminate tag * lint * lint 2 * Update src/Socket/messages-recv.ts * chore: linting --------- Co-authored-by: Rajeh Taher --- src/Socket/messages-recv.ts | 2 +- src/Types/Call.ts | 2 +- src/Utils/generics.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index 79c2cdf..a7b142e 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -909,7 +909,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { } // delete data once call has ended - if(status === 'reject' || status === 'accept' || status === 'timeout') { + if(status === 'reject' || status === 'accept' || status === 'timeout' || status === 'terminate') { callOfferCache.del(call.id) } diff --git a/src/Types/Call.ts b/src/Types/Call.ts index 06f3b1f..a5dbe1a 100644 --- a/src/Types/Call.ts +++ b/src/Types/Call.ts @@ -1,5 +1,5 @@ -export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' +export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' | 'terminate' export type WACallEvent = { chatId: string diff --git a/src/Utils/generics.ts b/src/Utils/generics.ts index c99dbb4..06ea2bb 100644 --- a/src/Utils/generics.ts +++ b/src/Utils/generics.ts @@ -364,7 +364,8 @@ export const getCallStatusFromNode = ({ tag, attrs }: BinaryNode) => { if(attrs.reason === 'timeout') { status = 'timeout' } else { - status = 'reject' + //fired when accepted/rejected/timeout/caller hangs up + status = 'terminate' } break