Implement proper WebRTC call management

This is a big CR that implements the whole proper call logic.

-- Other Contributors --

This CR was created in pair programming with:

-  Charlie Duquette <charlie_duquette@hotmail.fr>

-- New files --

- `ConversationProvider`: Provides the conversation object to its children. Also contains the function to begin a call (first step in the flow) which sends the `BeginCall` event.
- `CallProvider`: Contains the call logic that was previously in WebRTCProvider. From now on, WebRTCProvider contains only the WebRTC logic, while CallProvider
  contains everything related to the call (get the media devices, start/accept calls...)
- `NotificationManager`: Wrapper component to bind the WebSocket CallBegin event listener. That listener will fire when a `BeginCall` event is received and will then redirect the user to the call receiving page.

-- New routes --

When a `conversationId` is included in the URL, all pages are inside a `<ConversationProvider />`.

When starting a call, the caller is redirected to:

> http://localhost:3000/conversation/:conversationId/call?role=caller

When receiving a call, the receiver is redirected to:

> http://localhost:3000/conversation/:conversationId/call?role=receiver&hostId={HOST_ID}

When the user is in a `.../call` route, the `WebRTCContext` and
`CallContext` are provided

The `hostId` is the account URI of the caller. It's used when the receiver wants to send their answer back to the caller.

```
/
|-- login: <Welcome />
|-- settings: <AccountSettings />
|-- ...
`-- conversation: <Messenger />
    |-- add-contact/:contactId
    `-- :conversationId: <ConversationProvider />
        |-- /: <ConversationView />
        `-- /call: <WebRTCProvider>
                     <CallProvider>
                       <CallInterface />
                     </CallProvider>
                    </WebRTCProvider>
```

-- Call flow --

1. Caller:

- Clicks "Call" button
- Sends `BeginCall` event
- Redirects to call page `/call?role=caller`
- Sets `callStatus` to "Ringing"

2. Receiver:

- Receieves `BeginCall` event
- The callback in `NotificationManager` is called
- Redirects to the call receiving page `/conversation/{CONVERSATION_ID}/call?role=receiver`

3. Receiver:

- Clicks the "Answer call" button
- Sends a `CallAccept` event
- Sets `callStatus` to "Connecting"

4. Caller:

- Receives `CallAccept` event
- The callback in `CallProvider` is called
- Sets `callStatus` to "Connecting"
- Creates WebRTC Offer
- Sends `WebRTCOffer` event containing the offer SDP

5. Receiver:

- Receives `WebRTCOffer` event
- The callback in `WebRTCProvider` is called
- Sets WebRTC remote description.
- WebRTC `icecandidate` event fired. Sends `IceCandidate` WebSocket event
- Creates WebRTC answer
- Sends `WebRTCAnswer` event
- Sets WebRTC local description
- Sets connected status to true. Call page now shows the call interface

6. Caller:

- Receives `WebRTCAnswer` event
- Sets WebRTC local description
- Sets WebRTC remote description
- WebRTC `icecandidate` event fired. Sends `IceCandidate` WebSocket event
- Sets connected status to true. Call page now shows the call interface

-- Misc Changes --

- Improve CallPending and CallInterface UI
- Move `useUrlParams` hook from the (now deleted) `client/src/utils/hooks.ts` file to `client/src/hooks/useUrlParams.ts`
- Disable StrictMode. This was causing issues, because some event would be sent twice. There is a TODO comment to fix the problem and reenable it.
- Improvements in server `webrtc-handler.ts`. This is still a WIP
- Rename dash-case client files to camelCase

GitLab: #70
Change-Id: I6c75f6b867e8acb9ccaaa118b0123bba30431f78
diff --git a/client/src/pages/CallPending.tsx b/client/src/pages/CallPending.tsx
index 573418a..6c0fc06 100644
--- a/client/src/pages/CallPending.tsx
+++ b/client/src/pages/CallPending.tsx
@@ -16,13 +16,14 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-import { Box, CircularProgress, Grid, Stack, Typography } from '@mui/material';
+import { Box, CircularProgress, Grid, IconButtonProps, Stack, Typography } from '@mui/material';
+import { ComponentType, ReactNode } from 'react';
 import { useTranslation } from 'react-i18next';
 
 import {
   CallingAnswerAudioButton,
   CallingAnswerVideoButton,
-  CallingEndButton,
+  CallingCancelButton,
   CallingRefuseButton,
 } from '../components/CallButtons';
 
@@ -36,21 +37,6 @@
 type CallerStatus = 'calling' | 'connecting';
 type CommunicationMedium = 'audio' | 'video';
 
-const RECEIVER_BUTTONS = [
-  {
-    ButtonComponent: CallingRefuseButton,
-    translationKey: 'refuse_call',
-  },
-  {
-    ButtonComponent: CallingAnswerAudioButton,
-    translationKey: 'accept_call_audio',
-  },
-  {
-    ButtonComponent: CallingAnswerVideoButton,
-    translationKey: 'accept_call_video',
-  },
-];
-
 export const CallPending = (props: CallPendingProps) => {
   return (
     <Stack
@@ -92,6 +78,7 @@
           />
           <img
             // TODO: Insert incoming caller icon here
+            alt="contact profile picture"
             style={{
               position: 'absolute',
               objectFit: 'cover',
@@ -113,62 +100,93 @@
   );
 };
 
-export const CallPendingCallerInterface = ({ caller }: CallPendingProps) => {
-  const { t } = useTranslation();
-  // TODO: Remove the dummy name
-  const defaultName = 'Alex Thérieur';
+const CallPendingDetails = ({
+  title,
+  buttons,
+}: {
+  title: ReactNode;
+  buttons: {
+    ButtonComponent: ComponentType<IconButtonProps>;
+    title: ReactNode;
+  }[];
+}) => {
   return (
     <>
       <Typography variant="h1" color="white">
-        {defaultName}
-      </Typography>
-      <Typography variant="h3" color="white">
-        {caller === 'calling' ? t('calling') : t('connecting')}
-      </Typography>
-
-      <Stack alignItems="center" spacing={1} width="100%">
-        <CallingEndButton size="large" />
-        <Typography variant="body2" color="white">
-          {t('end_call')}
-        </Typography>
-      </Stack>
-    </>
-  );
-};
-
-export const CallPendingReceiverInterface = ({ medium }: CallPendingProps) => {
-  const { t } = useTranslation();
-  // TODO: Remove the dummy name
-  const defaultName = 'Alain Thérieur';
-  return (
-    <>
-      <Typography variant="h1" color="white">
-        {t('incoming_call', {
-          context: medium,
-          member0: defaultName,
-        })}
+        {title}
       </Typography>
       <Box width="50%">
-        <ReceiverButtons />
+        <Grid container justifyContent="center">
+          {buttons.map(({ ButtonComponent, title: buttonTitle }, i) => (
+            <Grid item key={i} xs={4}>
+              <Stack direction="column" alignItems="center" spacing={1} sx={{}}>
+                <ButtonComponent color="inherit" size="large" />
+                <Typography variant="body2" color="white" sx={{ opacity: 0.75 }}>
+                  {buttonTitle}
+                </Typography>
+              </Stack>
+            </Grid>
+          ))}
+        </Grid>
       </Box>
     </>
   );
 };
 
-const ReceiverButtons = () => {
+export const CallPendingCallerInterface = ({ caller }: CallPendingProps) => {
   const { t } = useTranslation();
+
+  // TODO: Remove the dummy name
+  const defaultName = 'Alex Thérieur';
   return (
-    <Grid container spacing={2}>
-      {RECEIVER_BUTTONS.map(({ ButtonComponent, translationKey }, i) => (
-        <Grid item xs={4} key={i}>
-          <Stack alignItems="center" spacing={1}>
-            <ButtonComponent color="inherit" size="large" />
-            <Typography variant="body2" color="white" sx={{ opacity: 0.75 }}>
-              {t(translationKey)}
-            </Typography>
-          </Stack>
-        </Grid>
-      ))}
-    </Grid>
+    <CallPendingDetails
+      title={
+        caller === 'calling'
+          ? t('calling', {
+              member0: defaultName,
+            })
+          : t('connecting')
+      }
+      buttons={[
+        {
+          ButtonComponent: CallingCancelButton,
+          title: t('end_call'),
+        },
+      ]}
+    />
+  );
+};
+
+export const CallPendingReceiverInterface = ({ medium, caller }: CallPendingProps) => {
+  const { t } = useTranslation();
+
+  // TODO: Remove the dummy name
+  const defaultName = 'Alain Thérieur';
+
+  return (
+    <CallPendingDetails
+      title={
+        caller === 'connecting'
+          ? t('connecting')
+          : t('incoming_call', {
+              context: medium,
+              member0: defaultName,
+            })
+      }
+      buttons={[
+        {
+          ButtonComponent: CallingRefuseButton,
+          title: t('refuse_call'),
+        },
+        {
+          ButtonComponent: CallingAnswerAudioButton,
+          title: t('accept_call_audio'),
+        },
+        {
+          ButtonComponent: CallingAnswerVideoButton,
+          title: t('accept_call_video'),
+        },
+      ]}
+    />
   );
 };