Skip to content
Snippets Groups Projects
Unverified Commit cded5b8e authored by Martin Schoeler's avatar Martin Schoeler Committed by GitHub
Browse files

Regression: Call doesn't stop ringing after agent unregistration (#24908)

parent f79e7eb5
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ import { Sidebar } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import React, { ReactElement, useEffect, useState } from 'react';
import { useCallClient, useCallerInfo } from '../../../contexts/CallContext';
import { useCallClient, useCallerInfo, useCallActions } from '../../../contexts/CallContext';
import { useTranslation } from '../../../contexts/TranslationContext';
export const OmnichannelCallToggleReady = (): ReactElement => {
......@@ -12,6 +12,7 @@ export const OmnichannelCallToggleReady = (): ReactElement => {
const voipClient = useCallClient();
const [onCall, setOnCall] = useState(false);
const callerInfo = useCallerInfo();
const callActions = useCallActions();
const getTooltip = (): string => {
if (!registered) {
......@@ -54,6 +55,7 @@ export const OmnichannelCallToggleReady = (): ReactElement => {
// TODO: backend set voip call status
// voipClient.setVoipCallStatus(!registered);
if (agentEnabled) {
callerInfo.state === 'OFFER_RECEIVED' && callActions.reject();
setAgentEnabled(false);
voipClient.unregister();
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment