Allow multiple transcript rows for the same Asterisk uniqueid#47
Merged
tommaso-ascani merged 7 commits intofix_transcriptionsfrom May 4, 2026
Merged
Allow multiple transcript rows for the same Asterisk uniqueid#47tommaso-ascani merged 7 commits intofix_transcriptionsfrom
tommaso-ascani merged 7 commits intofix_transcriptionsfrom
Conversation
Collaborator
Author
|
nethcti-middleware Regressions And Fixes
|
There was a problem hiding this comment.
Pull request overview
This PR updates the transcription persistence flow so Satellite can store multiple transcript fragments that share the same Asterisk uniqueid, which is needed for transferred/multi-leg calls after the related ns8-nethvoice changes.
Changes:
- Removes the database uniqueness assumption on
transcripts.uniqueidand migrates existing schemas to a non-unique indexed column. - Switches persistence/state tracking to use the transcript row’s internal
id, while also storing optionallinkedid,src_number, anddst_number. - Expands tests and README coverage for the new persistence behavior, including silent-audio handling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
db.py |
Updates schema bootstrap/migration and changes transcript persistence/state helpers to work with row IDs instead of assuming uniqueid uniqueness. |
api.py |
Passes new participant fields through the transcription endpoint, initializes a transcript row up front, and adds empty-audio handling. |
tests/test_db.py |
Adds coverage for schema migration, new participant columns, insert/update-by-id behavior, and latest-row state updates. |
tests/test_api.py |
Adds endpoint tests for persisted transcript IDs, linked/participant field forwarding, and silent-audio success handling. |
README.md |
Documents the non-unique uniqueid model, new optional persisted fields, and the silent-audio behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change removes the UNIQUE constraint from
transcripts.uniqueidand updates the persistence flow to track each stored transcript by its internalid.Why
With recent ns8-nethvoice changes for transferred calls (
nethesis/ns8-nethvoice#803), a single Asterisk call can produce multiple recording fragments that share the sameuniqueidbut belong to different call legs. The previous schema and write path assumed one row peruniqueid, so Satellite would either overwrite fragments throughON CONFLICT (uniqueid)or lose correct state tracking.What changed
transcripts.uniqueidis now non-unique and remains indexed.POST /api/get_transcriptioncreates one transcript row per persisted request.transcript_id, not byuniqueid.Impact
This preserves all transferred-call fragments, prevents transcript/state corruption when multiple uploads share the same
uniqueid, and keeps AI enrichment tied to the correct stored fragment. No HTTP or MQTT payloads changed.