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