-
Notifications
You must be signed in to change notification settings - Fork 0
VAPI-3165 Add Refer BXML verb support #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
s-aher
wants to merge
6
commits into
main
Choose a base branch
from
VAPI-3165
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c72c181
VAPI-3165 Add Refer BXML verb implementation and tests
s-aher 2b31ce6
Merge branch 'main' of github.com:Bandwidth/node-sdk into VAPI-3165
s-aher 95909f7
VAPI-3165 Update bandwidth.yaml and models for sip refer
s-aher e139ddd
Merge branch 'main' into VAPI-3165
s-aher d3414d9
Merge remote-tracking branch 'origin/VAPI-3165' into VAPI-3165
s-aher 785428c
VAPI-3165 fixed review comments
s-aher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # ReferCallStatus | ||
|
|
||
| The outcome of the REFER attempt. Possible values are success or failure. | ||
|
|
||
| ## Enum | ||
|
|
||
| * `Success` (value: `'success'`) | ||
|
|
||
| * `Failure` (value: `'failure'`) | ||
|
|
||
| [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # ReferCompleteCallback | ||
|
|
||
| The Refer Complete event is fired when the <Refer> verb finishes executing. This is sent to the referCompleteUrl specified on the <Refer> verb, and the BXML returned in it is executed on the call. | ||
|
|
||
| ## Properties | ||
|
|
||
| Name | Type | Description | Notes | ||
| ------------ | ------------- | ------------- | ------------- | ||
| **eventType** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, referComplete, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] [default to undefined] | ||
| **eventTime** | **string** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] [default to undefined] | ||
| **accountId** | **string** | The user account associated with the call. | [optional] [default to undefined] | ||
| **applicationId** | **string** | The id of the application associated with the call. | [optional] [default to undefined] | ||
| **from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] [default to undefined] | ||
| **to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] [default to undefined] | ||
| **direction** | [**CallDirectionEnum**](CallDirectionEnum.md) | | [optional] [default to undefined] | ||
| **callId** | **string** | The call id associated with the event. | [optional] [default to undefined] | ||
| **callUrl** | **string** | The URL of the call associated with the event. | [optional] [default to undefined] | ||
| **startTime** | **string** | Time the call was started, in ISO 8601 format. | [optional] [default to undefined] | ||
| **answerTime** | **string** | Time the call was answered, in ISO 8601 format. | [optional] [default to undefined] | ||
| **tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] [default to undefined] | ||
| **referCallStatus** | [**ReferCallStatus**](ReferCallStatus.md) | | [optional] [default to undefined] | ||
| **referSipResponseCode** | **number** | The SIP response code received for the REFER request (e.g. 202, 405, 603). Absent when not applicable. | [optional] [default to undefined] | ||
| **notifySipResponseCode** | **number** | The SIP response code received in the NOTIFY message (e.g. 200, 404, 486). Absent on REFER rejection or NOTIFY timeout. | [optional] [default to undefined] | ||
|
|
||
| ## Example | ||
|
|
||
| ```typescript | ||
| import { ReferCompleteCallback } from 'bandwidth-sdk'; | ||
|
|
||
| const instance: ReferCompleteCallback = { | ||
| eventType, | ||
| eventTime, | ||
| accountId, | ||
| applicationId, | ||
| from, | ||
| to, | ||
| direction, | ||
| callId, | ||
| callUrl, | ||
| startTime, | ||
| answerTime, | ||
| tag, | ||
| referCallStatus, | ||
| referSipResponseCode, | ||
| notifySipResponseCode, | ||
| }; | ||
| ``` | ||
|
|
||
| [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { NestableVerb } from '../NestableVerb'; | ||
| import { ReferSipUri } from './ReferSipUri'; | ||
|
|
||
| export interface ReferAttributes { | ||
| referCompleteUrl?: string; | ||
| referCompleteMethod?: string; | ||
| tag?: string; | ||
| } | ||
|
|
||
| /** | ||
| * @export | ||
| * @class Refer | ||
| * @extends {NestableVerb} | ||
| * Represents a Refer BXML verb. | ||
| * NOTE: On success the call is terminated — the remote SIP endpoint redirects away from Bandwidth. | ||
| * Recovery BXML in referCompleteUrl only makes sense for failure handling. | ||
| */ | ||
| export class Refer extends NestableVerb { | ||
| attributes: ReferAttributes; | ||
|
|
||
| /** | ||
| * Creates an instance of Refer | ||
| * @param {ReferSipUri} sipUri The SipUri child element (required — spec mandates exactly one) | ||
| * @param {ReferAttributes} attributes The attributes to add to the element | ||
| */ | ||
| constructor(sipUri: ReferSipUri, attributes?: ReferAttributes) { | ||
| super('Refer', undefined, attributes, [sipUri]); | ||
| } | ||
|
|
||
| /** | ||
| * Set the SipUri for this Refer verb | ||
| * @param {ReferSipUri} sipUri The SipUri to refer to | ||
| */ | ||
| setSipUri(sipUri: ReferSipUri): void { | ||
| // Replaces the single required SipUri child — <Refer> allows exactly one. | ||
| this.nestedVerbs = [sipUri]; | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { Verb } from '../Verb'; | ||
|
|
||
| /** | ||
| * @export | ||
| * @class ReferSipUri | ||
| * @extends {Verb} | ||
| * Represents a SipUri child element scoped to the Refer verb. | ||
| * Unlike the Transfer-scoped SipUri, this accepts only a URI — no | ||
| * transferAnswerUrl, uui, username/password, or other Transfer attributes. | ||
| */ | ||
| export class ReferSipUri extends Verb { | ||
| uri: string; | ||
|
|
||
| /** | ||
| * Creates an instance of ReferSipUri | ||
| * @param {string} uri The SIP URI to refer to (must start with sip:) | ||
| */ | ||
| constructor(uri: string) { | ||
| super('SipUri', uri); | ||
| } | ||
| } | ||
|
|
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* tslint:disable */ | ||
| /* eslint-disable */ | ||
| /** | ||
| * Bandwidth | ||
| * Bandwidth\'s Communication APIs | ||
| * | ||
| * The version of the OpenAPI document: 1.0.0 | ||
| * Contact: letstalk@bandwidth.com | ||
| * | ||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
| * https://openapi-generator.tech | ||
| * Do not edit the class manually. | ||
| */ | ||
|
|
||
|
|
||
|
|
||
| /** | ||
| * The outcome of the REFER attempt. Possible values are success or failure. | ||
| */ | ||
|
|
||
| export const ReferCallStatus = { | ||
| Success: 'success', | ||
| Failure: 'failure' | ||
| } as const; | ||
|
|
||
| export type ReferCallStatus = typeof ReferCallStatus[keyof typeof ReferCallStatus]; | ||
|
|
||
|
|
||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* tslint:disable */ | ||
| /* eslint-disable */ | ||
| /** | ||
| * Bandwidth | ||
| * Bandwidth\'s Communication APIs | ||
| * | ||
| * The version of the OpenAPI document: 1.0.0 | ||
| * Contact: letstalk@bandwidth.com | ||
| * | ||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
| * https://openapi-generator.tech | ||
| * Do not edit the class manually. | ||
| */ | ||
|
|
||
|
|
||
| // May contain unused imports in some cases | ||
| // @ts-ignore | ||
| import type { CallDirectionEnum } from './call-direction-enum'; | ||
| // May contain unused imports in some cases | ||
| // @ts-ignore | ||
| import type { ReferCallStatus } from './refer-call-status'; | ||
|
|
||
| /** | ||
| * The Refer Complete event is fired when the <Refer> verb finishes executing. This is sent to the referCompleteUrl specified on the <Refer> verb, and the BXML returned in it is executed on the call. | ||
| */ | ||
| export interface ReferCompleteCallback { | ||
| /** | ||
| * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, referComplete, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | ||
| */ | ||
| 'eventType'?: string; | ||
| /** | ||
| * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | ||
| */ | ||
| 'eventTime'?: string; | ||
| /** | ||
| * The user account associated with the call. | ||
| */ | ||
| 'accountId'?: string; | ||
| /** | ||
| * The id of the application associated with the call. | ||
| */ | ||
| 'applicationId'?: string; | ||
| /** | ||
| * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | ||
| */ | ||
| 'from'?: string; | ||
| /** | ||
| * The phone number that received the call, in E.164 format (e.g. +15555555555). | ||
| */ | ||
| 'to'?: string; | ||
| 'direction'?: CallDirectionEnum; | ||
| /** | ||
| * The call id associated with the event. | ||
| */ | ||
| 'callId'?: string; | ||
| /** | ||
| * The URL of the call associated with the event. | ||
| */ | ||
| 'callUrl'?: string; | ||
| /** | ||
| * Time the call was started, in ISO 8601 format. | ||
| */ | ||
| 'startTime'?: string; | ||
| /** | ||
| * Time the call was answered, in ISO 8601 format. | ||
| */ | ||
| 'answerTime'?: string | null; | ||
| /** | ||
| * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | ||
| */ | ||
| 'tag'?: string | null; | ||
| 'referCallStatus'?: ReferCallStatus; | ||
| /** | ||
| * The SIP response code received for the REFER request (e.g. 202, 405, 603). Absent when not applicable. | ||
| */ | ||
| 'referSipResponseCode'?: number | null; | ||
| /** | ||
| * The SIP response code received in the NOTIFY message (e.g. 200, 404, 486). Absent on REFER rejection or NOTIFY timeout. | ||
| */ | ||
| 'notifySipResponseCode'?: number | null; | ||
| } | ||
|
|
||
|
|
||
|
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.