diff --git a/lib/history.ts b/lib/history.ts
index 15683733..1f00df14 100644
--- a/lib/history.ts
+++ b/lib/history.ts
@@ -238,6 +238,38 @@ export const getLastCalls = async (
}
}
+export const downloadCallRec = async (idRecording: string) => {
+ try {
+ const requestUrl = `${getHistoryUrl()}/webrest/historycall/down_callrec/${idRecording}`
+ const { data, status } = await axios.get(requestUrl)
+
+ if (status === 200) {
+ return data
+ } else {
+ throw 'Error retrieving recording'
+ }
+ } catch (error) {
+ handleNetworkError(error)
+ throw error
+ }
+}
+
+export const deleteRec = async (idRecording: string) => {
+ try {
+ const requestUrl = `${getHistoryUrl()}/webrest/historycall/delete_callrec`
+ const { data, status } = await axios.post(requestUrl, { id: idRecording })
+
+ if (status === 200) {
+ return data
+ } else {
+ throw 'Error removing recording'
+ }
+ } catch (error) {
+ handleNetworkError(error)
+ throw error
+ }
+}
+
export interface CallTypes {
time: number
channel: string
diff --git a/pages/history.tsx b/pages/history.tsx
index 767653fc..19ea35d7 100644
--- a/pages/history.tsx
+++ b/pages/history.tsx
@@ -3,9 +3,9 @@
import type { NextPage } from 'next'
import { Filter } from '../components/history/Filter'
-import { Button, EmptyState, InlineNotification } from '../components/common'
+import { Button, Dropdown, EmptyState, InlineNotification } from '../components/common'
import { useState, useEffect, useMemo } from 'react'
-import { search, PAGE_SIZE, openDrawerHistory } from '../lib/history'
+import { search, PAGE_SIZE, openDrawerHistory, downloadCallRec, deleteRec } from '../lib/history'
import { RootState } from '../store'
import { useSelector } from 'react-redux'
import { debounce } from 'lodash'
@@ -22,11 +22,15 @@ import {
faVoicemail,
faPhone,
faArrowUpRightFromSquare,
+ faEllipsisVertical,
+ faFileImport,
+ faTrash,
+ faDownload,
} from '@fortawesome/free-solid-svg-icons'
import { formatDateLoc } from '../lib/dateTime'
import { subDays, startOfDay } from 'date-fns'
import { useTranslation } from 'react-i18next'
-import { getApiScheme, getApiVoiceEndpoint, playFileAudio } from '../lib/utils'
+import { getApiEndpoint, getApiScheme, getApiVoiceEndpoint, playFileAudio } from '../lib/utils'
import { Tooltip } from 'react-tooltip'
import { CallsDate } from '../components/history/CallsDate'
import { MissingPermission } from '../components/common/MissingPermissionsPage'
@@ -567,8 +571,53 @@ const History: NextPage = () => {
const apiVoiceEnpoint = getApiVoiceEndpoint()
const apiScheme = getApiScheme()
+ const apiEndpoint = getApiEndpoint()
//report page link
const pbxReportUrl = apiScheme + apiVoiceEnpoint + '/pbx-report/'
+ // URL for the recording file
+ const recordingUrlPath = apiScheme + apiEndpoint + '/webrest/static/'
+
+ // Dropdown actions for the recording file
+ const getRecordingActions = (callId: string) => (
+ <>
+