From bcac386b6baa039b23f2281a1f7df0c633af035f Mon Sep 17 00:00:00 2001
From: Santhosh Vaiyapuri <3846977+santhoshvai@users.noreply.github.com>
Date: Thu, 14 Nov 2024 14:32:09 +0100
Subject: [PATCH] chore: add reason for cancel call click button (#1577)
Note: Ideally `CancelCallButton` should have been named generically as
`HangupCallButton`, but would be a breaking change so I did not do it
here
---
.../src/components/RingingCall/RingingCallControls.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/react-sdk/src/components/RingingCall/RingingCallControls.tsx b/packages/react-sdk/src/components/RingingCall/RingingCallControls.tsx
index 8e1633406b..93cb33c897 100644
--- a/packages/react-sdk/src/components/RingingCall/RingingCallControls.tsx
+++ b/packages/react-sdk/src/components/RingingCall/RingingCallControls.tsx
@@ -18,7 +18,10 @@ export const RingingCallControls = () => {
<>
call.leave({ reject: true })}
+ onClick={() => {
+ const reason = call.isCreatedByMe ? 'cancel' : 'decline';
+ call.leave({ reject: true, reason });
+ }}
disabled={buttonsDisabled}
/>
>