feat(voice): allow joining a call from the conversation timeline bubble

Agents who refresh or dismiss the floating widget can now click a Join /
Rejoin action on the voice_call bubble to (re)connect to a ringing or
in-progress call. The CTA respects the same visibility rules as the
floating widget — outbound calls only surface for the initiator, and
inbound assigned calls only surface for the assignee.

useCallSession gains a manageSessionState option so the bubble can reuse
joinCall/activeCall without registering duplicate Twilio listeners or
running its own duration timer.

Closes PLA-117
This commit is contained in:
Muhsin
2026-04-30 18:46:09 +04:00
parent 353089473e
commit e415b0576a
4 changed files with 122 additions and 28 deletions
+18
View File
@@ -45,6 +45,24 @@ const shouldShowCall = ({
return !isAssignedToAnotherAgent(assigneeId, currentUserId);
};
// Whether the current user is allowed to take over / join an existing call.
// Mirrors the floating-widget visibility rules so the bubble's join action
// stays in sync.
export const canCurrentUserJoinCall = ({
call,
conversation,
senderId,
currentUserId,
}) => {
if (!call) return false;
return shouldShowCall({
callDirection: call.direction === 'outgoing' ? 'outbound' : 'inbound',
senderId,
assigneeId: extractAssigneeId(conversation),
currentUserId,
});
};
function extractCallData(message) {
const call = message?.call || {};
return {