TELCORE-304: FST coverage for mod_lumenvox CPA/AMD - #632
Open
dev-ryanc wants to merge 4 commits into
Open
Conversation
…imer Adds FST cases for the mod_lumenvox CPA/AMD surface: grammar-URI classification including case and ?query handling, rejection of mixed CPA+AMD in one recognition, and the start-input-timers=false path end to end — cause 002 with the mod_unimrcp sentinel body and the matching ASR-Completion-Cause header. Three of them are regression tests for defects found by inspection: the deferred timeout being consumed by the first interaction and so lost to a restart, a deadline surviving pause and firing for a recognition no longer running, and repeated arming disturbing an armed deadline. asr_grammar_management now sets start-recognize=false. Loading a grammar starts recognition immediately (matching mod_unimrcp), which would otherwise make that test's bookkeeping assertions depend on the ASR engine being provisioned server-side.
…oyment asr_cpa_classifies_speech feeds real speech through switch_core_asr_feed and asserts the deployment classifies it: a populated NLSML interpretation rather than the no-result sentinel, and ASR-Completion-Cause 000. Gated on LV_TEST_AUDIO (raw 8 kHz mono S16LE) as well as LV_TEST_TARGET, since no suitable audio ships in the tree. Verified against ch1-dev with a Polly-generated sample: "Hello?" classifies as HUMAN RESIDENCE at 450 ms of speech. Confirmed non-vacuous by pointing LV_TEST_AUDIO at a missing file and watching the case fail. The assertion is deliberately on the transcript, never on the completion cause. Every CPA outcome is cause 000 -- including UNKNOWN SILENCE -- so a test that checked the cause would pass on an empty call.
asr_cpa_classifies_speech now sets cpa-human-business-time and speech-complete-timeout before loading the grammar, so a field the server rejects shows up as a failure to classify. That matters more since rejected requests became non-fatal: a malformed interaction-create request no longer fails the channel, it logs a warning and the start times out, so nothing else in the suite would notice a bad param. speech-complete-timeout in particular reaches CpaSettings via VadSettings.eos_delay_ms and had no coverage at all. Not yet exercised — the dev deployment became unreachable before this could run against it.
All three checked that nothing bad happened without first establishing the mechanism was live, so each passed when the feature was absent. asr_cpa_amd_grammar_classification only asserted that load_grammar returned SUCCESS, which it does for any non-empty string; the classification was stored and, with start-recognize=false, never read. It would have passed unchanged if classify_grammar always returned ASR. Classification is only observable through the mixed-mode guard -- a start succeeds when the enabled grammars agree and fails when they disagree -- so it now drives three starts chosen so that losing the URI matching flips the result: canonical plus ?query-suffixed must start, upper-case AMD against CPA must not, and an ordinary grammar against CPA must not. Verified by mutation: stubbing classify_grammar to return ASR unconditionally makes this case fail, where before it passed. asr_start_input_timers_is_idempotent asserted that three calls returned SUCCESS, which every path does including one that re-armed, and then that no result had arrived within milliseconds of a 5 s deadline. It now uses a 400 ms deadline, re-arms at 250 ms, and asserts the result still lands before 600 ms -- a re-arm would push it to ~650 ms. asr_paused_deadline_does_not_fire could not distinguish a disarmed deadline from one that was never armed. It now runs a positive control first, on its own handle, showing the deadline does fire without the pause. asr_cpa_classifies_speech additionally sets cpa-human-business-time and speech-complete-timeout, giving VadSettings.eos_delay_ms its first coverage.
dev-ryanc
marked this pull request as ready for review
August 3, 2026 10:53
dev-ryanc
requested review from
baloeng,
damirn,
minhtuan1407-telnyx and
tajamulTelnyx
August 3, 2026 10:54
minhtuan1407-telnyx
approved these changes
Aug 3, 2026
baloeng
approved these changes
Aug 6, 2026
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.
Test-only. Adds FST coverage for the CPA/AMD support in
team-telnyx/mod_lumenvox#3 (TELCORE-304). Touches one file,
tests/unit/switch_mod_lumenvox.c.Rebased on
1c78225256; no overlap with the RTP/APR work that landed there.What is covered
Six new cases plus a fix to an existing one:
?queryhandlingstart-input-timers=falsepath end to end — cause002, themod_unimrcp sentinel body, and the matching header
HUMAN RESIDENCEasserted from aspeech sample, which also gives
VadSettings.eos_delay_msits first coverageThree are regression tests for defects found by inspection: a deferred timeout
consumed by the first interaction and lost to a restart, a deadline surviving
pause, and repeated arming disturbing an armed deadline.
asr_grammar_managementnow setsstart-recognize=false. Loading a grammarstarts recognition (matching mod_unimrcp), which had silently made that test's
bookkeeping assertions depend on server-side ASR provisioning.
Test strength was verified, not assumed
Three of these originally asserted less than their names claimed — they checked
that nothing bad happened without establishing the mechanism was live, so they
passed when the feature was absent.
asr_cpa_amd_grammar_classificationonlychecked that
load_grammarreturned SUCCESS, which it does for any non-emptystring.
They now drive observable behaviour, and I confirmed it by mutation: stubbing
classify_grammarto returnASRunconditionally makes the classification casefail, where the previous version passed.
How to run
Not wired into CI —
Makefile.am:9-11excludes it because LumenVox isunreachable from CI, and every meaningful case is
lv_live()-gated. CI stillonly exercises the fail-closed path.
LV_TEST_AUDIOis optional; without it the classification case is skipped. AnyTTS will do — AWS Polly with
OutputFormat=pcm,SampleRate=8000.Last run: 15/15 against ch1-dev, on a core built from this branch's base.