Skip to content

fix(VAPI-4457): scope SSML un-escape to SpeakSentence text - #148

Merged
nasanov-bw merged 2 commits into
mainfrom
VAPI-4457_scope-ssml-unescape-to-speaksentence
Nov 5, 2026
Merged

nasanov-bw merged 2 commits into
mainfrom
VAPI-4457_scope-ssml-unescape-to-speaksentence

Conversation

@nasanov-bw

@nasanov-bw nasanov-bw commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The SSML un-escape (&lt;tag&gt; -> <tag>) ran over the whole serialized BXML, so it also rewrote escaped <...> inside XML attribute values into a raw <...>. A raw < is illegal in an attribute value, so the output was malformed XML and the API returned invalid_bxml.

The un-escape now only applies to the text inside <SpeakSentence>...</SpeakSentence>, matching the C# and Ruby SDKs. Attribute values and every other element keep their XML escaping.

Jira: VAPI-4457

Validation

  • npx jest tests/unit/models/bxml passes (59 tests) and tsc --noEmit is clean.
  • New tests fail on main and pass on this branch.
  • Not run against a live Bandwidth call; verified that output parses as XML with the expected escaping.

@nasanov-bw
nasanov-bw requested review from a team as code owners November 5, 2026 16:59
@bwappsec

bwappsec commented Nov 5, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Comment thread tests/unit/models/bxml/Response.test.ts Outdated
Comment on lines +67 to +73
test('should un-escape SSML in a Gather SpeakSentence but not in Gather attributes', () => {
const gather = new Gather({ gatherUrl: 'https://example.com/?a=<b>' }, [new SpeakSentence('say <emphasis>this</emphasis>')]);
const bxml = gather.toBxml();

expect(bxml).toContain('gatherUrl="https://example.com/?a=&lt;b&gt;"');
expect(bxml).toContain('say <emphasis>this</emphasis>');
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this test to the Gather test file since its specifically for that verb

@nasanov-bw
nasanov-bw merged commit 3363b7a into main Nov 5, 2026
20 checks passed
@nasanov-bw
nasanov-bw deleted the VAPI-4457_scope-ssml-unescape-to-speaksentence branch November 5, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants