Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(call): recording (#2558)

Will Hutchinsonee3b8f77a828
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts
index 0721f1da06..bf83046a14 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts
@@ -8,6 +8,7 @@ import type { CallRecordDurationMs } from './callRecordDurationMs';
import type { CallRecordEgressId } from './callRecordEgressId';
import type { CallRecordEndedAt } from './callRecordEndedAt';
import type { CallRecordParticipant } from './callRecordParticipant';
+import type { CallRecordRecordingUrl } from './callRecordRecordingUrl';
import type { CallRecordTranscriptSegment } from './callRecordTranscriptSegment';
/**
@@ -31,6 +32,8 @@ export interface CallRecord {
isActive: boolean;
/** Participants (both active and historic). */
participants: CallRecordParticipant[];
+ /** Presigned URL for the call recording, if available. */
+ recordingUrl?: CallRecordRecordingUrl;
/** The RTC room name. */
roomName: string;
/** When the call started (created_at for active, started_at for archived). */
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordRecordingUrl.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordRecordingUrl.ts
new file mode 100644
index 0000000000..03eff8263c
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordRecordingUrl.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Presigned URL for the call recording, if available.
+ */
+export type CallRecordRecordingUrl = string | null;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
index 46310fdde8..8bae896175 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
@@ -83,6 +83,7 @@ export * from './callRecordEgressId';
export * from './callRecordEndedAt';
export * from './callRecordParticipant';
export * from './callRecordParticipantLeftAt';
+export * from './callRecordRecordingUrl';
export * from './callRecordTranscriptSegment';
export * from './callRecordTranscriptSegmentEndedAt';
export * from './callRecordTranscriptSegmentSegmentId';
diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.ts
index 9510ef631d..463db6d540 100644
--- a/js/app/packages/service-clients/service-storage/generated/zod.ts
+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts
@@ -863,6 +863,10 @@ export const getCallRecordResponse = zod
)
)
.describe('Participants (both active and historic).'),
+ recordingUrl: zod
+ .string()
+ .nullish()
+ .describe('Presigned URL for the call recording, if available.'),
roomName: zod.string().describe('The RTC room name.'),
startedAt: zod
.string()
diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.json
index 808ca97162..a008233cee 100644
--- a/js/app/packages/service-clients/service-storage/openapi.json
+++ b/js/app/packages/service-clients/service-storage/openapi.json
@@ -5888,6 +5888,10 @@
},
"description": "Participants (both active and historic)."
},
+ "recordingUrl": {
+ "type": ["string", "null"],
+ "description": "Presigned URL for the call recording, if available."
+ },
"roomName": {
"type": "string",
"description": "The RTC room name."
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index 8873a9c554..d970906321 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -1741,12 +1741,14 @@ name = "call"
version = "0.1.0"
dependencies = [
"anyhow",
+ "aws-sdk-s3",
"axum",
"chrono",
"connection",
"entity_access",
"livekit-api",
"livekit-protocol",
+ "macro_aws_config",
"macro_db_migrator",
"macro_user_id",
"mockall",
diff --git a/rust/cloud-storage/call/.sqlx/query-828f0574782433d07de91f85db16dd61ef2d91b2073d68dcf116135bdbca3851.json b/rust/cloud-storage/call/.sqlx/query-0ea8abcb6adfa2a93579879f4bc537c13a9a4e4c313c115a83b0bc98c846db0f.json
similarity index 59%
rename from rust/cloud-storage/call/.sqlx/query-828f0574782433d07de91f85db16dd61ef2d91b2073d68dcf116135bdbca3851.json
rename to rust/cloud-storage/call/.sqlx/query-0ea8abcb6adfa2a93579879f4bc537c13a9a4e4c313c115a83b0bc98c846db0f.json
index 3f01c0deb5..ef18ac8a9f 100644
--- a/rust/cloud-storage/call/.sqlx/query-828f0574782433d07de91f85db16dd61ef2d91b2073d68dcf116135bdbca3851.json
+++ b/rust/cloud-storage/call/.sqlx/query-0ea8abcb6adfa2a93579879f4bc537c13a9a4e4c313c115a83b0bc98c846db0f.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n UPDATE call_records SET recording_url = $2 WHERE id = $1\n ",
+ "query": "\n UPDATE call_records SET recording_key = $2 WHERE id = $1\n ",
"describe": {
"columns": [],
"parameters": {
@@ -11,5 +11,5 @@
},
"nullable": []
},
- "hash": "828f0574782433d07de91f85db16dd61ef2d91b2073d68dcf116135bdbca3851"
+ "hash": "0ea8abcb6adfa2a93579879f4bc537c13a9a4e4c313c115a83b0bc98c846db0f"
}
diff --git a/rust/cloud-storage/call/.sqlx/query-56636a342b76ec92ee7adf0f779f6a8c14b8b0de4d40764362304046e3e48efd.json b/rust/cloud-storage/call/.sqlx/query-49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4.json
similarity index 78%
rename from rust/cloud-storage/call/.sqlx/query-56636a342b76ec92ee7adf0f779f6a8c14b8b0de4d40764362304046e3e48efd.json
rename to rust/cloud-storage/call/.sqlx/query-49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4.json
index 4c008e3566..d4bb853016 100644
--- a/rust/cloud-storage/call/.sqlx/query-56636a342b76ec92ee7adf0f779f6a8c14b8b0de4d40764362304046e3e48efd.json
+++ b/rust/cloud-storage/call/.sqlx/query-49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_url, share_permission_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\n ",
+ "query": "\n INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, share_permission_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\n ",
"describe": {
"columns": [],
"parameters": {
@@ -19,5 +19,5 @@
},
"nullable": []
},
- "hash": "56636a342b76ec92ee7adf0f779f6a8c14b8b0de4d40764362304046e3e48efd"
+ "hash": "49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4"
}
diff --git a/rust/cloud-storage/call/.sqlx/query-5764bc7a77e72625b9f348045d6ee0a3f1c0e1e6b81c50118f20fc7e6881eb9d.json b/rust/cloud-storage/call/.sqlx/query-5764bc7a77e72625b9f348045d6ee0a3f1c0e1e6b81c50118f20fc7e6881eb9d.json
new file mode 100644
index 0000000000..3ddc5f257c
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-5764bc7a77e72625b9f348045d6ee0a3f1c0e1e6b81c50118f20fc7e6881eb9d.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT user_id\n FROM call_record_participants\n WHERE call_record_id = $1\n ORDER BY joined_at ASC\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "user_id",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "5764bc7a77e72625b9f348045d6ee0a3f1c0e1e6b81c50118f20fc7e6881eb9d"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-58bbac52930eed32381004f41604e394292af9ad8de8d7ce3ed45358ad62adba.json b/rust/cloud-storage/call/.sqlx/query-58bbac52930eed32381004f41604e394292af9ad8de8d7ce3ed45358ad62adba.json
new file mode 100644
index 0000000000..5813d4c8ad
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-58bbac52930eed32381004f41604e394292af9ad8de8d7ce3ed45358ad62adba.json
@@ -0,0 +1,58 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms\n FROM call_records\n WHERE id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "channel_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "room_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "created_by",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "started_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "ended_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 6,
+ "name": "duration_ms",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "58bbac52930eed32381004f41604e394292af9ad8de8d7ce3ed45358ad62adba"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-740f552e0d43b70ba07c7826a01a2e03e915830607edfbc398dd1dbe2845d682.json b/rust/cloud-storage/call/.sqlx/query-740f552e0d43b70ba07c7826a01a2e03e915830607edfbc398dd1dbe2845d682.json
new file mode 100644
index 0000000000..d189f13652
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-740f552e0d43b70ba07c7826a01a2e03e915830607edfbc398dd1dbe2845d682.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT recording_key FROM call_records WHERE id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "recording_key",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ true
+ ]
+ },
+ "hash": "740f552e0d43b70ba07c7826a01a2e03e915830607edfbc398dd1dbe2845d682"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-79b6d9d4f6b3469253e2fe01fef337bec8f6d447731718573f170ff4fa24b88d.json b/rust/cloud-storage/call/.sqlx/query-79b6d9d4f6b3469253e2fe01fef337bec8f6d447731718573f170ff4fa24b88d.json
new file mode 100644
index 0000000000..3413c6dfbf
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-79b6d9d4f6b3469253e2fe01fef337bec8f6d447731718573f170ff4fa24b88d.json
@@ -0,0 +1,34 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT speaker_id, content, sequence_num\n FROM call_transcripts\n WHERE call_id = $1\n ORDER BY sequence_num ASC\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "speaker_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "content",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "sequence_num",
+ "type_info": "Int4"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "79b6d9d4f6b3469253e2fe01fef337bec8f6d447731718573f170ff4fa24b88d"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-10b3ac43bb525d0d54de6c42289ed199b07431041f53b39f733746304bcf50b7.json b/rust/cloud-storage/call/.sqlx/query-886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5.json
similarity index 74%
rename from rust/cloud-storage/call/.sqlx/query-10b3ac43bb525d0d54de6c42289ed199b07431041f53b39f733746304bcf50b7.json
rename to rust/cloud-storage/call/.sqlx/query-886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5.json
index 081e733a50..714cf48238 100644
--- a/rust/cloud-storage/call/.sqlx/query-10b3ac43bb525d0d54de6c42289ed199b07431041f53b39f733746304bcf50b7.json
+++ b/rust/cloud-storage/call/.sqlx/query-886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id\n FROM calls\n WHERE id = $1\n ",
+ "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key\n FROM calls\n WHERE id = $1\n ",
"describe": {
"columns": [
{
@@ -32,6 +32,11 @@
"ordinal": 5,
"name": "egress_id",
"type_info": "Text"
+ },
+ {
+ "ordinal": 6,
+ "name": "recording_key",
+ "type_info": "Text"
}
],
"parameters": {
@@ -45,8 +50,9 @@
false,
false,
false,
+ true,
true
]
},
- "hash": "10b3ac43bb525d0d54de6c42289ed199b07431041f53b39f733746304bcf50b7"
+ "hash": "886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5"
}
diff --git a/rust/cloud-storage/call/.sqlx/query-9b8eca330ae09809a79941d077aafafda5a2f65b86d94d3f517a34efa6d412a1.json b/rust/cloud-storage/call/.sqlx/query-9b8eca330ae09809a79941d077aafafda5a2f65b86d94d3f517a34efa6d412a1.json
new file mode 100644
index 0000000000..0280529c3b
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-9b8eca330ae09809a79941d077aafafda5a2f65b86d94d3f517a34efa6d412a1.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) as \"count!\" FROM call_transcripts WHERE call_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "9b8eca330ae09809a79941d077aafafda5a2f65b86d94d3f517a34efa6d412a1"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-a7baf370108371fedbc9eec0287181a1581a3cc2c483b49f0b7579dd7338bd22.json b/rust/cloud-storage/call/.sqlx/query-a7baf370108371fedbc9eec0287181a1581a3cc2c483b49f0b7579dd7338bd22.json
new file mode 100644
index 0000000000..90d0e8b42c
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-a7baf370108371fedbc9eec0287181a1581a3cc2c483b49f0b7579dd7338bd22.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT share_permission_id FROM call_records WHERE id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "share_permission_id",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "a7baf370108371fedbc9eec0287181a1581a3cc2c483b49f0b7579dd7338bd22"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-39fb4a71810075749c01ca721695f3f5743a32053277017489892c8253bd6f99.json b/rust/cloud-storage/call/.sqlx/query-b99dfcbe1b18c53fa05a0c44669f6579456c3d49bea87fccdcb9962565543002.json
similarity index 59%
rename from rust/cloud-storage/call/.sqlx/query-39fb4a71810075749c01ca721695f3f5743a32053277017489892c8253bd6f99.json
rename to rust/cloud-storage/call/.sqlx/query-b99dfcbe1b18c53fa05a0c44669f6579456c3d49bea87fccdcb9962565543002.json
index 9e6af2373c..dd9710e57d 100644
--- a/rust/cloud-storage/call/.sqlx/query-39fb4a71810075749c01ca721695f3f5743a32053277017489892c8253bd6f99.json
+++ b/rust/cloud-storage/call/.sqlx/query-b99dfcbe1b18c53fa05a0c44669f6579456c3d49bea87fccdcb9962565543002.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n UPDATE calls SET recording_url = $2 WHERE egress_id = $1\n ",
+ "query": "\n UPDATE calls SET recording_key = $2 WHERE egress_id = $1\n ",
"describe": {
"columns": [],
"parameters": {
@@ -11,5 +11,5 @@
},
"nullable": []
},
- "hash": "39fb4a71810075749c01ca721695f3f5743a32053277017489892c8253bd6f99"
+ "hash": "b99dfcbe1b18c53fa05a0c44669f6579456c3d49bea87fccdcb9962565543002"
}
diff --git a/rust/cloud-storage/call/.sqlx/query-ca2128680337c450ace5d58cbbf31cc419b098d4396b83e0ef1e8798e4f83050.json b/rust/cloud-storage/call/.sqlx/query-bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646.json
similarity index 77%
rename from rust/cloud-storage/call/.sqlx/query-ca2128680337c450ace5d58cbbf31cc419b098d4396b83e0ef1e8798e4f83050.json
rename to rust/cloud-storage/call/.sqlx/query-bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646.json
index d645c4a142..ca7ef24f72 100644
--- a/rust/cloud-storage/call/.sqlx/query-ca2128680337c450ace5d58cbbf31cc419b098d4396b83e0ef1e8798e4f83050.json
+++ b/rust/cloud-storage/call/.sqlx/query-bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id\n FROM call_records\n WHERE id = $1\n ",
+ "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key\n FROM call_records\n WHERE id = $1\n ",
"describe": {
"columns": [
{
@@ -42,6 +42,11 @@
"ordinal": 7,
"name": "egress_id",
"type_info": "Text"
+ },
+ {
+ "ordinal": 8,
+ "name": "recording_key",
+ "type_info": "Text"
}
],
"parameters": {
@@ -57,8 +62,9 @@
false,
false,
false,
+ true,
true
]
},
- "hash": "ca2128680337c450ace5d58cbbf31cc419b098d4396b83e0ef1e8798e4f83050"
+ "hash": "bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646"
}
diff --git a/rust/cloud-storage/call/.sqlx/query-cd19706a12766971babf411d05ea10a1fe2cfc2898a8043d9d648c177ef9cb37.json b/rust/cloud-storage/call/.sqlx/query-cd19706a12766971babf411d05ea10a1fe2cfc2898a8043d9d648c177ef9cb37.json
new file mode 100644
index 0000000000..289093af9d
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-cd19706a12766971babf411d05ea10a1fe2cfc2898a8043d9d648c177ef9cb37.json
@@ -0,0 +1,28 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT user_id, left_at\n FROM call_record_participants\n WHERE call_record_id = $1\n ORDER BY joined_at ASC\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "user_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "left_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ true
+ ]
+ },
+ "hash": "cd19706a12766971babf411d05ea10a1fe2cfc2898a8043d9d648c177ef9cb37"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-e233b0f2888b75bd70f9b6ecc11593c8be6cf5d43c234873dbc6f3b3296c8f00.json b/rust/cloud-storage/call/.sqlx/query-e233b0f2888b75bd70f9b6ecc11593c8be6cf5d43c234873dbc6f3b3296c8f00.json
new file mode 100644
index 0000000000..a9fc472b29
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-e233b0f2888b75bd70f9b6ecc11593c8be6cf5d43c234873dbc6f3b3296c8f00.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT share_permission_id FROM calls WHERE id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "share_permission_id",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "e233b0f2888b75bd70f9b6ecc11593c8be6cf5d43c234873dbc6f3b3296c8f00"
+}
diff --git a/rust/cloud-storage/call/.sqlx/query-366e841724500ab94e0ba963e65a3bf35b96899f6b85e9420fae5445c0164cf5.json b/rust/cloud-storage/call/.sqlx/query-eb38775373a5ee3fdb942593936a3231b9303a5cc2fd2198b3ac132cae45024a.json
similarity index 87%
rename from rust/cloud-storage/call/.sqlx/query-366e841724500ab94e0ba963e65a3bf35b96899f6b85e9420fae5445c0164cf5.json
rename to rust/cloud-storage/call/.sqlx/query-eb38775373a5ee3fdb942593936a3231b9303a5cc2fd2198b3ac132cae45024a.json
index e3e8960ef0..20c138ce78 100644
--- a/rust/cloud-storage/call/.sqlx/query-366e841724500ab94e0ba963e65a3bf35b96899f6b85e9420fae5445c0164cf5.json
+++ b/rust/cloud-storage/call/.sqlx/query-eb38775373a5ee3fdb942593936a3231b9303a5cc2fd2198b3ac132cae45024a.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_url, share_permission_id\n FROM calls\n WHERE id = $1\n FOR UPDATE\n ",
+ "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, share_permission_id\n FROM calls\n WHERE id = $1\n FOR UPDATE\n ",
"describe": {
"columns": [
{
@@ -35,7 +35,7 @@
},
{
"ordinal": 6,
- "name": "recording_url",
+ "name": "recording_key",
"type_info": "Text"
},
{
@@ -60,5 +60,5 @@
false
]
},
- "hash": "366e841724500ab94e0ba963e65a3bf35b96899f6b85e9420fae5445c0164cf5"
+ "hash": "eb38775373a5ee3fdb942593936a3231b9303a5cc2fd2198b3ac132cae45024a"
}
diff --git a/rust/cloud-storage/call/.sqlx/query-fdce21902ca26481495bd105b110b6da30dde18159813f92012d47c820b1c5a5.json b/rust/cloud-storage/call/.sqlx/query-fdce21902ca26481495bd105b110b6da30dde18159813f92012d47c820b1c5a5.json
new file mode 100644
index 0000000000..2f7d64c92f
--- /dev/null
+++ b/rust/cloud-storage/call/.sqlx/query-fdce21902ca26481495bd105b110b6da30dde18159813f92012d47c820b1c5a5.json
@@ -0,0 +1,34 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT speaker_id, content, sequence_num\n FROM call_record_transcripts\n WHERE call_record_id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "speaker_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "content",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "sequence_num",
+ "type_info": "Int4"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "fdce21902ca26481495bd105b110b6da30dde18159813f92012d47c820b1c5a5"
+}
diff --git a/rust/cloud-storage/call/Cargo.toml b/rust/cloud-storage/call/Cargo.toml
index 4f156ff186..3ff681d17a 100644
--- a/rust/cloud-storage/call/Cargo.toml
+++ b/rust/cloud-storage/call/Cargo.toml
@@ -15,6 +15,8 @@ inbound = [
"ports",
]
outbound = [
+ "dep:aws-sdk-s3",
+ "dep:macro_aws_config",
"dep:livekit-api",
"dep:livekit-protocol",
"dep:models_permissions",
@@ -25,6 +27,7 @@ ports = ["dep:entity_access", "dep:tokio"]
[dependencies]
anyhow = { workspace = true }
+aws-sdk-s3 = { workspace = true, optional = true }
axum = { workspace = true, optional = true }
chrono = { workspace = true }
connection = { path = "../connection", default-features = false, features = [
@@ -35,6 +38,7 @@ entity_access = { path = "../entity_access", optional = true, default-features =
] }
livekit-api = { workspace = true, optional = true }
livekit-protocol = { workspace = true, optional = true }
+macro_aws_config = { path = "../macro_aws_config", optional = true, features = ["s3"] }
macro_user_id = { path = "../macro_user_id" }
model-entity = { path = "../model-entity" }
model-error-response = { path = "../model-error-response", optional = true }
diff --git a/rust/cloud-storage/call/src/domain/models.rs b/rust/cloud-storage/call/src/domain/models.rs
index 0068d35590..edf110ff3f 100644
--- a/rust/cloud-storage/call/src/domain/models.rs
+++ b/rust/cloud-storage/call/src/domain/models.rs
@@ -191,6 +191,11 @@ pub struct CallRecord {
pub duration_ms: Option<i64>,
/// Recording egress ID, if any.
pub egress_id: Option<String>,
+ /// S3 object key for the call recording (internal, not serialized).
+ #[serde(skip_serializing)]
+ pub recording_key: Option<String>,
+ /// Presigned URL for the call recording, if available.
+ pub recording_url: Option<String>,
/// Whether the call is currently active (from `calls` table).
pub is_active: bool,
/// Participants (both active and historic).
diff --git a/rust/cloud-storage/call/src/domain/ports.rs b/rust/cloud-storage/call/src/domain/ports.rs
index fb249343d4..2b2cef8a22 100644
--- a/rust/cloud-storage/call/src/domain/ports.rs
+++ b/rust/cloud-storage/call/src/domain/ports.rs
@@ -96,11 +96,11 @@ pub trait CallRepository: Send + Sync + 'static {
/// Returns the new `call_records` id.
fn archive_call(&self, call_id: &Uuid) -> impl Future<Output = Result<Uuid, Self::Err>> + Send;
- /// Set the recording URL on an archived call record.
- fn set_recording_url(
+ /// Set the recording key on an archived call record.
+ fn set_recording_key(
&self,
call_record_id: &Uuid,
- recording_url: &str,
+ recording_key: &str,
) -> impl Future<Output = Result<(), Self::Err>> + Send;
/// Find a call record by its egress ID (for webhook handling).
@@ -109,14 +109,14 @@ pub trait CallRepository: Send + Sync + 'static {
egress_id: &str,
) -> impl Future<Output = Result<Option<Uuid>, Self::Err>> + Send;
- /// Set the recording URL on an active call (by egress ID).
+ /// Set the recording key on an active call (by egress ID).
///
/// Used when `egress_ended` arrives before the call is archived.
/// Returns `true` if a matching active call was found and updated.
- fn set_active_call_recording_url(
+ fn set_active_call_recording_key(
&self,
egress_id: &str,
- recording_url: &str,
+ recording_key: &str,
) -> impl Future<Output = Result<bool, Self::Err>> + Send;
/// Insert a transcript segment for an active call.
@@ -142,6 +142,28 @@ pub trait CallRepository: Send + Sync + 'static {
) -> impl Future<Output = Result<Option<CallRecord>, Self::Err>> + Send;
}
+/// Storage port for generating presigned recording URLs.
+pub trait RecordingStorage: Send + Sync + 'static {
+ /// Generate a presigned GET URL for a recording key.
+ ///
+ /// The key is in `UUID/TIMESTAMP.ext` format. Implementations must
+ /// prepend the appropriate prefix (e.g. `calls/`) when constructing
+ /// the full object key.
+ fn presign_recording_url(
+ &self,
+ recording_key: &str,
+ ) -> impl Future<Output = anyhow::Result<String>> + Send;
+}
+
+impl<T: RecordingStorage> RecordingStorage for Option<T> {
+ async fn presign_recording_url(&self, recording_key: &str) -> anyhow::Result<String> {
+ match self {
+ Some(inner) => inner.presign_recording_url(recording_key).await,
+ None => anyhow::bail!("recording storage not configured"),
+ }
+ }
+}
+
/// RTC client port for interacting with the real-time communication service (e.g., LiveKit).
#[cfg_attr(test, mockall::automock)]
pub trait CallRtcClient: Send + Sync + 'static {
diff --git a/rust/cloud-storage/call/src/domain/service.rs b/rust/cloud-storage/call/src/domain/service.rs
index 268ffeff29..faa6a3c3f6 100644
--- a/rust/cloud-storage/call/src/domain/service.rs
+++ b/rust/cloud-storage/call/src/domain/service.rs
@@ -1,5 +1,8 @@
//! Call service implementation.
+#[cfg(test)]
+mod test;
+
use connection::domain::ports::ConnectionService;
use entity_access::domain::models::{EntityAccessReceipt, EntityType, MemberParticipantRole};
use entity_access::domain::ports::EntityAccessService;
@@ -20,7 +23,7 @@ use super::models::{
CallActiveResponse, CallError, CallRecord, CallTokenResponse, EgressS3Config,
LeaveCallResponse, TranscriptSegmentRequest,
};
-use super::ports::{CallRepository, CallRtcClient, CallService};
+use super::ports::{CallRepository, CallRtcClient, CallService, RecordingStorage};
/// The concrete call service implementation.
pub struct CallServiceImpl<
@@ -29,12 +32,14 @@ pub struct CallServiceImpl<
Cn: ConnectionService,
E: EntityAccessService,
N: NotificationIngress,
+ S: RecordingStorage,
> {
repo: R,
rtc_client: C,
connection_service: Cn,
entity_access_service: E,
notification_ingress: N,
+ recording_storage: S,
server_url: String,
egress_s3_config: Option<EgressS3Config>,
internal_call_secret: Option<String>,
@@ -46,7 +51,8 @@ impl<
Cn: ConnectionService,
E: EntityAccessService,
N: NotificationIngress,
-> CallServiceImpl<R, C, Cn, E, N>
+ S: RecordingStorage,
+> CallServiceImpl<R, C, Cn, E, N, S>
{
/// Create a new call service.
pub fn new(
@@ -55,6 +61,7 @@ impl<
connection_service: Cn,
entity_access_service: E,
notification_ingress: N,
+ recording_storage: S,
server_url: impl Into<String>,
) -> Self {
Self {
@@ -63,6 +70,7 @@ impl<
connection_service,
entity_access_service,
notification_ingress,
+ recording_storage,
server_url: server_url.into(),
egress_s3_config: None,
internal_call_secret: None,
@@ -175,7 +183,8 @@ impl<
Cn: ConnectionService,
E: EntityAccessService,
N: NotificationIngress,
-> CallService for CallServiceImpl<R, C, Cn, E, N>
+ S: RecordingStorage,
+> CallService for CallServiceImpl<R, C, Cn, E, N, S>
{
fn validate_internal_call(&self, token: &str) -> bool {
self.internal_call_secret
@@ -538,9 +547,10 @@ impl<
return Ok(());
};
- tracing::info!(egress_id, file_url, "egress recording completed");
+ let recording_key = extract_recording_key(file_url);
+ tracing::info!(egress_id, recording_key, "egress recording completed");
- // Find the archived call record by egress_id and update the recording URL.
+ // Find the archived call record by egress_id and update the recording key.
if let Some(call_record_id) = self
.repo
.get_call_record_by_egress_id(egress_id)
@@ -548,7 +558,7 @@ impl<
.map_err(|e| CallError::Internal(e.into()))?
{
self.repo
- .set_recording_url(&call_record_id, file_url)
+ .set_recording_key(&call_record_id, recording_key)
.await
.map_err(|e| CallError::Internal(e.into()))?;
} else {
@@ -556,7 +566,7 @@ impl<
// archive_call can carry it forward.
let updated = self
.repo
- .set_active_call_recording_url(egress_id, file_url)
+ .set_active_call_recording_key(egress_id, recording_key)
.await
.map_err(|e| CallError::Internal(e.into()))?;
if !updated {
@@ -590,11 +600,23 @@ impl<
let call_id = Uuid::parse_str(&entity.entity_id)
.map_err(|_| CallError::Internal(anyhow::anyhow!("invalid call_id in receipt")))?;
- self.repo
+ let mut record = self
+ .repo
.get_call_record_by_call_id(&call_id)
.await
.map_err(|e| CallError::Internal(e.into()))?
- .ok_or_else(|| CallError::NotFound(call_id.to_string()))
+ .ok_or_else(|| CallError::NotFound(call_id.to_string()))?;
+
+ if let Some(recording_key) = &record.recording_key {
+ record.recording_url = self
+ .recording_storage
+ .presign_recording_url(recording_key)
+ .await
+ .inspect_err(|e| tracing::error!(error=?e, "failed to presign recording URL"))
+ .ok();
+ }
+
+ Ok(record)
}
#[tracing::instrument(err, skip(self, segment))]
@@ -622,3 +644,15 @@ impl<
Ok(())
}
}
+
+/// Extract the recording key from a full S3 URL.
+///
+/// Given `https://bucket.s3.amazonaws.com/calls/UUID/TIMESTAMP.mp4`,
+/// returns `UUID/TIMESTAMP.mp4`. Falls back to the full URL if it does
+/// not contain the `calls/` prefix.
+fn extract_recording_key(file_url: &str) -> &str {
+ file_url
+ .find("calls/")
+ .map(|idx| &file_url[idx + "calls/".len()..])
+ .unwrap_or(file_url)
+}
diff --git a/rust/cloud-storage/call/src/domain/service/test.rs b/rust/cloud-storage/call/src/domain/service/test.rs
new file mode 100644
index 0000000000..2baef8a01a
--- /dev/null
+++ b/rust/cloud-storage/call/src/domain/service/test.rs
@@ -0,0 +1,22 @@
+use super::extract_recording_key;
+
+#[test]
+fn extract_key_from_full_s3_url() {
+ let url = "https://macro-call-recording-prod.s3.amazonaws.com/calls/0195cea6-fc16-72f2-93b6-144df711f270/2026-04-10T210832.mp4";
+ assert_eq!(
+ extract_recording_key(url),
+ "0195cea6-fc16-72f2-93b6-144df711f270/2026-04-10T210832.mp4"
+ );
+}
+
+#[test]
+fn extract_key_fallback_when_no_calls_prefix() {
+ let url = "s3://bucket/some/other/path.mp4";
+ assert_eq!(extract_recording_key(url), url);
+}
+
+#[test]
+fn extract_key_from_bare_calls_path() {
+ let url = "calls/abc-123/recording.mp4";
+ assert_eq!(extract_recording_key(url), "abc-123/recording.mp4");
+}
diff --git a/rust/cloud-storage/call/src/outbound/mod.rs b/rust/cloud-storage/call/src/outbound/mod.rs
index ff5139d096..bc85d1b053 100644
--- a/rust/cloud-storage/call/src/outbound/mod.rs
+++ b/rust/cloud-storage/call/src/outbound/mod.rs
@@ -2,3 +2,5 @@
pub mod livekit_rtc_client;
/// Postgres-backed repository implementing [`CallRepository`](crate::domain::ports::CallRepository).
pub mod pg_call_repo;
+/// S3-backed recording storage implementing [`RecordingStorage`](crate::domain::ports::RecordingStorage).
+pub mod s3_recording_storage;
diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
index 27067fb9a9..b73eb0d0c9 100644
--- a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
@@ -326,7 +326,7 @@ impl CallRepository for PgCallRepo {
// Fetch and lock the active call so concurrent archive_call callers serialize.
let call = sqlx::query!(
r#"
- SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_url, share_permission_id
+ SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, share_permission_id
FROM calls
WHERE id = $1
FOR UPDATE
@@ -342,11 +342,11 @@ impl CallRepository for PgCallRepo {
.signed_duration_since(call.created_at)
.num_milliseconds()
.max(0);
- // Insert into call_records (including egress_id and any early recording_url).
+ // Insert into call_records (including egress_id and any early recording_key).
// The record keeps the same id as the original call.
sqlx::query!(
r#"
- INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_url, share_permission_id)
+ INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, share_permission_id)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
"#,
call_id,
@@ -357,7 +357,7 @@ impl CallRepository for PgCallRepo {
now,
duration_ms,
call.egress_id,
- call.recording_url,
+ call.recording_key,
&call.share_permission_id,
)
.execute(tx.as_mut())
@@ -406,17 +406,17 @@ impl CallRepository for PgCallRepo {
}
#[tracing::instrument(err, skip(self))]
- async fn set_recording_url(
+ async fn set_recording_key(
&self,
call_record_id: &Uuid,
- recording_url: &str,
+ recording_key: &str,
) -> Result<(), Self::Err> {
sqlx::query!(
r#"
- UPDATE call_records SET recording_url = $2 WHERE id = $1
+ UPDATE call_records SET recording_key = $2 WHERE id = $1
"#,
call_record_id,
- recording_url,
+ recording_key,
)
.execute(&self.pool)
.await?;
@@ -439,17 +439,17 @@ impl CallRepository for PgCallRepo {
}
#[tracing::instrument(err, skip(self))]
- async fn set_active_call_recording_url(
+ async fn set_active_call_recording_key(
&self,
egress_id: &str,
- recording_url: &str,
+ recording_key: &str,
) -> Result<bool, Self::Err> {
let result = sqlx::query!(
r#"
- UPDATE calls SET recording_url = $2 WHERE egress_id = $1
+ UPDATE calls SET recording_key = $2 WHERE egress_id = $1
"#,
egress_id,
- recording_url,
+ recording_key,
)
.execute(&self.pool)
.await?;
@@ -503,7 +503,7 @@ impl CallRepository for PgCallRepo {
// Try active `calls` first.
if let Some(active) = sqlx::query!(
r#"
- SELECT id, channel_id, room_name, created_by, created_at, egress_id
+ SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key
FROM calls
WHERE id = $1
"#,
@@ -563,6 +563,8 @@ impl CallRepository for PgCallRepo {
ended_at: None,
duration_ms: None,
egress_id: active.egress_id,
+ recording_key: active.recording_key,
+ recording_url: None,
is_active: true,
participants,
transcript,
@@ -572,7 +574,7 @@ impl CallRepository for PgCallRepo {
// Fall back to archived `call_records`.
let Some(archived) = sqlx::query!(
r#"
- SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id
+ SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key
FROM call_records
WHERE id = $1
"#,
@@ -636,6 +638,8 @@ impl CallRepository for PgCallRepo {
ended_at: Some(archived.ended_at),
duration_ms: Some(archived.duration_ms),
egress_id: archived.egress_id,
+ recording_key: archived.recording_key,
+ recording_url: None,
is_active: false,
participants,
transcript,
diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs
index 923c292059..dc9595628f 100644
--- a/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs
+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs
@@ -340,13 +340,13 @@ async fn archive_call_preserves_id_and_share_permission(
Ok(())
}
-// -- set_active_call_recording_url --------------------------------------------
+// -- set_active_call_recording_key --------------------------------------------
#[sqlx::test(
fixtures(path = "../../../fixtures", scripts("call_repo")),
migrator = "MACRO_DB_MIGRATIONS"
)]
-async fn set_active_call_recording_url_updates_matching_call(
+async fn set_active_call_recording_key_updates_matching_call(
pool: Pool<Postgres>,
) -> anyhow::Result<()> {
let repo = repo(pool.clone());
@@ -356,23 +356,29 @@ async fn set_active_call_recording_url_updates_matching_call(
// Should update and return true.
let updated = repo
- .set_active_call_recording_url("egress-123", "s3://bucket/recording.mp4")
+ .set_active_call_recording_key(
+ "egress-123",
+ "0195cea6-fc16-72f2-93b6-144df711f270/2026-04-10T210832.mp4",
+ )
.await?;
assert!(updated);
- // Verify the URL is on the active call.
+ // Verify the key is on the active call.
let call = repo.get_call_by_channel_id(&CH1).await?.unwrap();
assert_eq!(call.egress_id.as_deref(), Some("egress-123"));
- // Now archive and verify recording_url carries forward.
+ // Now archive and verify recording_key carries forward.
let record_id = repo.archive_call(&CALL1).await?;
- let url = sqlx::query_scalar!(
- r#"SELECT recording_url FROM call_records WHERE id = $1"#,
+ let key = sqlx::query_scalar!(
+ r#"SELECT recording_key FROM call_records WHERE id = $1"#,
record_id,
)
.fetch_one(&pool)
.await?;
- assert_eq!(url.as_deref(), Some("s3://bucket/recording.mp4"));
+ assert_eq!(
+ key.as_deref(),
+ Some("0195cea6-fc16-72f2-93b6-144df711f270/2026-04-10T210832.mp4")
+ );
Ok(())
}
@@ -381,13 +387,16 @@ async fn set_active_call_recording_url_updates_matching_call(
fixtures(path = "../../../fixtures", scripts("call_repo")),
migrator = "MACRO_DB_MIGRATIONS"
)]
-async fn set_active_call_recording_url_returns_false_when_no_match(
+async fn set_active_call_recording_key_returns_false_when_no_match(
pool: Pool<Postgres>,
) -> anyhow::Result<()> {
let repo = repo(pool);
let updated = repo
- .set_active_call_recording_url("nonexistent-egress", "s3://bucket/recording.mp4")
+ .set_active_call_recording_key(
+ "nonexistent-egress",
+ "0195cea6-fc16-72f2-93b6-144df711f270/2026-04-10T210832.mp4",
+ )
.await?;
assert!(!updated);
diff --git a/rust/cloud-storage/call/src/outbound/s3_recording_storage.rs b/rust/cloud-storage/call/src/outbound/s3_recording_storage.rs
new file mode 100644
index 0000000000..1e4f989963
--- /dev/null
+++ b/rust/cloud-storage/call/src/outbound/s3_recording_storage.rs
@@ -0,0 +1,38 @@
+//! S3-backed implementation of [`RecordingStorage`](crate::domain::ports::RecordingStorage).
+
+use std::time::Duration;
+
+use crate::domain::ports::RecordingStorage;
+
+/// Presigned-URL generator backed by an S3 client from [`macro_aws_config`].
+pub struct S3RecordingStorage {
+ client: aws_sdk_s3::Client,
+ bucket: String,
+}
+
+impl S3RecordingStorage {
+ /// Build using the shared AWS config from [`macro_aws_config`] and
+ /// the bucket name from the egress configuration.
+ pub async fn new(bucket: String) -> Self {
+ let client = macro_aws_config::s3_client().await;
+ Self { client, bucket }
+ }
+}
+
+impl RecordingStorage for S3RecordingStorage {
+ async fn presign_recording_url(&self, recording_key: &str) -> anyhow::Result<String> {
+ let full_key = format!("calls/{recording_key}");
+ let presigning_config =
+ aws_sdk_s3::presigning::PresigningConfig::expires_in(Duration::from_secs(3600))?;
+
+ let presigned = self
+ .client
+ .get_object()
+ .bucket(&self.bucket)
+ .key(&full_key)
+ .presigned(presigning_config)
+ .await?;
+
+ Ok(macro_aws_config::transform_aws_url(presigned.uri()))
+ }
+}
diff --git a/rust/cloud-storage/document_storage_service/src/api/context.rs b/rust/cloud-storage/document_storage_service/src/api/context.rs
index a2f0719e28..afcf281bbe 100644
--- a/rust/cloud-storage/document_storage_service/src/api/context.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/context.rs
@@ -182,6 +182,7 @@ pub(crate) type DssCallService = CallServiceImpl<
CallConnectionService,
EntityAccessService,
NotificationIngressType,
+ Option<call::outbound::s3_recording_storage::S3RecordingStorage>,
>;
/// Type alias for the call router state.
diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rs
index 305b824a26..45a0789a63 100644
--- a/rust/cloud-storage/document_storage_service/src/main.rs
+++ b/rust/cloud-storage/document_storage_service/src/main.rs
@@ -368,31 +368,44 @@ async fn main() -> anyhow::Result<()> {
let call_connection_service =
ConnectionServiceImpl::new(entity_access_service.clone(), connection_gateway.clone());
let call_repo = PgCallRepo::new(db.clone());
+ let egress_config = match (
+ config::CallRecordingS3Bucket::new(),
+ config::CallRecordingS3Region::new(),
+ config::CallRecordingS3AccessKey::new(),
+ config::CallRecordingS3Secret::new(),
+ ) {
+ (Some(bucket), Some(region), Some(access_key), Some(secret)) => {
+ tracing::info!(bucket = bucket.as_ref(), "call recording enabled");
+ Some(call::domain::models::EgressS3Config {
+ bucket: bucket.as_ref().to_string(),
+ region: region.as_ref().to_string(),
+ access_key: access_key.as_ref().to_string(),
+ secret: secret.as_ref().to_string(),
+ })
+ }
+ _ => None,
+ };
+ let recording_storage = match &egress_config {
+ Some(config) => Some(
+ call::outbound::s3_recording_storage::S3RecordingStorage::new(config.bucket.clone())
+ .await,
+ ),
+ None => None,
+ };
let mut call_service_builder = CallServiceImpl::new(
call_repo,
livekit_rtc_client,
call_connection_service,
(*entity_access_service).clone(),
(*notification_ingress_service).clone(),
+ recording_storage,
config.vars.livekit_server_url.as_ref(),
);
if let Some(secret) = internal_call_secret {
call_service_builder = call_service_builder.with_internal_call_secret(secret);
}
- if let (Some(bucket), Some(region), Some(access_key), Some(secret)) = (
- config::CallRecordingS3Bucket::new(),
- config::CallRecordingS3Region::new(),
- config::CallRecordingS3AccessKey::new(),
- config::CallRecordingS3Secret::new(),
- ) {
- tracing::info!(bucket = bucket.as_ref(), "call recording enabled");
- call_service_builder =
- call_service_builder.with_egress(call::domain::models::EgressS3Config {
- bucket: bucket.as_ref().to_string(),
- region: region.as_ref().to_string(),
- access_key: access_key.as_ref().to_string(),
- secret: secret.as_ref().to_string(),
- });
+ if let Some(config) = egress_config {
+ call_service_builder = call_service_builder.with_egress(config);
}
let call_service = Arc::new(call_service_builder);
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260414120000_call_recording_key.sql b/rust/cloud-storage/macro_db_client/migrations/20260414120000_call_recording_key.sql
new file mode 100644
index 0000000000..342379a335
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260414120000_call_recording_key.sql
@@ -0,0 +1,13 @@
+-- Replace recording_url with recording_key on both calls and call_records.
+-- Existing URLs are transformed by stripping everything up to and including `calls/`,
+-- leaving just the S3 object key (e.g. `UUID/TIMESTAMP.mp4`).
+
+ALTER TABLE calls ADD COLUMN recording_key TEXT;
+UPDATE calls SET recording_key = regexp_replace(recording_url, '^.*/calls/', '')
+ WHERE recording_url IS NOT NULL;
+ALTER TABLE calls DROP COLUMN recording_url;
+
+ALTER TABLE call_records ADD COLUMN recording_key TEXT;
+UPDATE call_records SET recording_key = regexp_replace(recording_url, '^.*/calls/', '')
+ WHERE recording_url IS NOT NULL;
+ALTER TABLE call_records DROP COLUMN recording_url;