Skip to content

VAPI-3165 Add Refer BXML verb support - #118

Open
s-aher wants to merge 14 commits into
mainfrom
VAPI-3165
Open

VAPI-3165 Add Refer BXML verb support#118
s-aher wants to merge 14 commits into
mainfrom
VAPI-3165

Conversation

@s-aher

@s-aher s-aher commented May 25, 2026

Copy link
Copy Markdown

Adds the <Refer> BXML verb.

  • models/bxml/verbs/Refer.ts: new Refer verb (referCompleteUrl, referCompleteMethod, tag attributes, one required SipUri child).
  • Reuses the existing SipUri type for the child element instead of a separate ReferSipUri - no runtime validation restricting which SipUri attributes are legal per verb (matches csharp-sdk#201, which dropped this as over-engineering).
  • ReferCompleteCallback model is out of scope here - lands separately once VAPI-3440 merges. Deleted the orphaned generated models/refer-call-status.ts/docs/ReferCallStatus.md and the corresponding bandwidth.yml schemas, which had no remaining consumer once that callback work was descoped.
  • common.ts: fixed a pre-existing TS2527 build error (unrelated to Refer, also present on main) that was failing npm run build on every CI matrix job - annotated createRequestFunction's return type to avoid emitting an axios-internal type that isn't portable to a .d.ts.
  • Tests in tests/unit/models/bxml/verbs/Refer.test.ts.

Tests: npm run build and npx jest - full suite passes (257/257 test files).

VAPI-3439

@bwappsec

bwappsec commented May 25, 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.

@s-aher
s-aher marked this pull request as ready for review June 22, 2026 07:08
@s-aher
s-aher requested review from a team as code owners June 22, 2026 07:08

@stampercasey stampercasey left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review from Claude Code — see inline comments for individual findings. One blocker (regen job); the verb implementation is otherwise sound.

Regen job has not runmodels/refer-complete-callback.ts is absent and bandwidth.yml was not updated. The PR description lists this as a follow-up pending api-specs#2142, which has now merged (June 12). The regen needs to run and ReferCompleteCallback + the four scenario tests need to land before this is ready to merge.

Comment thread models/bxml/verbs/Refer.ts
Comment thread models/bxml/verbs/Refer.ts
Comment thread models/bxml/verbs/Refer.ts
Comment thread tests/unit/models/bxml/verbs/Refer.test.ts Outdated
stampercasey
stampercasey previously approved these changes Jun 23, 2026
s-aher and others added 2 commits June 24, 2026 12:55
… in Refer

ReferCompleteCallback will land later via a separate api-specs-driven PR
once VAPI-3440 merges. Refer now takes the existing Transfer-flavored
SipUri instead of a duplicate ReferSipUri type, matching the reviewed
csharp-sdk reference implementation (no runtime validation, no builder
bloat).
models/refer-call-status.ts had no consumer once ReferSipUri/ReferCompleteCallback
were removed from this PR's scope. bandwidth.yml still carried the full
referCompleteCallback/referCallStatus/referSipResponseCode/notifySipResponseCode
schemas and a referComplete addition to the shared eventType enum description.
Also cleaned up the corresponding .openapi-generator/FILES entries.
…return type

tsc (with declaration:true) failed on common.ts:110 - 'The inferred type of
createRequestFunction references an inaccessible unique symbol type' -
because axios 1.19's request<T,R>() return type involves an internal
branded type not portable to a .d.ts. This broke npm run build (invoked
via yarn's prepare hook) on every OS/Node matrix job in CI, on main as
well as this PR. Annotating the returned function's return type as
Promise<R> sidesteps emitting the unexported internal type.
Comment thread common.ts Outdated
Comment on lines +111 to +113
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
return function <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH): Promise<R> {
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
return axios.request<T, R>(axiosRequestArgs) as Promise<R>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fix for CI error unrelated to PR change. Actions aren't required so can remove this if wanted

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.

We need to remove this, I have a ticket for fixing the CI issue, but this is an autogenerated file, so we can't update it directly like this

Comment thread models/bxml/verbs/Refer.ts Outdated
* @export
* @class Refer
* @extends {NestableVerb}
* Represents a Refer BXML verb.

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.

Suggested change
* Represents a Refer BXML verb.
* Represents a Refer verb.

Comment thread models/bxml/verbs/Refer.ts Outdated
Comment on lines +23 to +24
* @param {SipUri} sipUri The SipUri child element (required - spec mandates exactly one)
* @param {ReferAttributes} attributes The attributes to add to the element

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.

Suggested change
* @param {SipUri} sipUri The SipUri child element (required - spec mandates exactly one)
* @param {ReferAttributes} attributes The attributes to add to the element
* @param {ReferAttributes} attributes The attributes to add to the element
* @param {SipUri} sipUri The SipUri to refer to

Comment thread models/bxml/verbs/Refer.ts Outdated
* @param {SipUri} sipUri The SipUri child element (required - spec mandates exactly one)
* @param {ReferAttributes} attributes The attributes to add to the element
*/
constructor(sipUri: SipUri, attributes?: ReferAttributes) {

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.

Suggested change
constructor(sipUri: SipUri, attributes?: ReferAttributes) {
constructor(attributes?: ReferAttributes, sipUri?: SipUri) {

the order of these arguments should match the NestableVerb constructor and the other nestable verbs for consistency

Comment thread models/bxml/verbs/Refer.ts Outdated
* @param {ReferAttributes} attributes The attributes to add to the element
*/
constructor(sipUri: SipUri, attributes?: ReferAttributes) {
super('Refer', undefined, attributes, [sipUri]);

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.

Suggested change
super('Refer', undefined, attributes, [sipUri]);
super('Refer', undefined, attributes, sipUri);

we have logic in the parent constructor to convert to an array so that isn't needed here

Comment thread models/bxml/verbs/Refer.ts Outdated
* @param {SipUri} sipUri The SipUri to refer to
*/
setSipUri(sipUri: SipUri): void {
// Replaces the single required SipUri child - <Refer> allows exactly one.

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.

Suggested change
// Replaces the single required SipUri child - <Refer> allows exactly one.

import { SipUri } from '../../../../../models/bxml/verbs/SipUri';

describe('Refer', () => {
test('should generate Refer XML with SipUri and all attributes', () => {

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.

these tests dont match any of the other nestable verb tests, we should make our tests as consistent as possible, look at Gather, Transfer, Connect, or StartStream for how this should look.

Comment thread common.ts Outdated
Comment on lines +111 to +113
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
return function <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH): Promise<R> {
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
return axios.request<T, R>(axiosRequestArgs) as Promise<R>;

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.

We need to remove this, I have a ticket for fixing the CI issue, but this is an autogenerated file, so we can't update it directly like this

stampercasey and others added 2 commits August 3, 2026 15:14
…mon.ts

Flip Refer's constructor to (attributes, sipUri) matching NestableVerb
and every other verb's convention; drop the unnecessary array-wrap since
the parent constructor already normalizes a single Verb to an array.
Simplify the class doc comment to match Transfer's. Rewrite Refer.test.ts
to follow the Gather/Transfer/Connect/StartStream test structure.

Revert the common.ts patch from the CI-fix commit: it's an autogenerated
file and shouldn't be hand-edited - ckoegel has a separate ticket
tracking the real fix for the TS2527 build error.
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.

4 participants