Skip to content

Commit

Permalink
remove duplicated call reject event / add terminate tag (#1031)
Browse files Browse the repository at this point in the history
* initial commit

* add terminate tag

* lint

* lint 2

* Update src/Socket/messages-recv.ts

* chore: linting

---------

Co-authored-by: Rajeh Taher <[email protected]>
  • Loading branch information
vinikjkkj and PurpShell authored Sep 22, 2024
1 parent 70f0321 commit ed00a57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Socket/messages-recv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/Types/Call.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Utils/generics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed00a57

Please sign in to comment.