From f18db9576ab3f1fed9b4091d8146cceffb7756b6 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Dec 2024 10:12:37 +0000 Subject: [PATCH] [Librarian] Regenerated @ 45fa5159053e1c1f62f6d613f3b67a9239b43a5f 2551818144b7f525e66740ded45831b930db82b8 --- CHANGES.md | 16 ++ .../api/v2010/account/call/transcription.ts | 4 + src/rest/numbers/V1.ts | 20 +- ...ts => portingWebhookConfigurationFetch.ts} | 45 ++-- src/rest/numbers/v2/hostedNumberOrder.ts | 139 ++++++++++ src/twiml/VoiceResponse.ts | 244 ++++++++++++++++++ 6 files changed, 443 insertions(+), 25 deletions(-) rename src/rest/numbers/v1/{webhook.ts => portingWebhookConfigurationFetch.ts} (74%) diff --git a/CHANGES.md b/CHANGES.md index eafcfc9af..909dc9ab4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,22 @@ twilio-node changelog ===================== +[2024-12-05] Version 5.3.7 +-------------------------- +**Api** +- Add optional parameter `intelligence_service` to `transcription` +- Updated `phone_number_sid` to be populated for sip trunking terminating calls. + +**Numbers** +- Add Update Hosted Number Order V2 API endpoint +- Update Port in docs + +**Twiml** +- Add optional parameter `intelligence_service` to `` +- Add support for new `` and `` noun +- Add `events` attribute to `` verb + + [2024-11-15] Version 5.3.6 -------------------------- **Library - Chore** diff --git a/src/rest/api/v2010/account/call/transcription.ts b/src/rest/api/v2010/account/call/transcription.ts index 23f4620c5..c2f830979 100644 --- a/src/rest/api/v2010/account/call/transcription.ts +++ b/src/rest/api/v2010/account/call/transcription.ts @@ -65,6 +65,8 @@ export interface TranscriptionListInstanceCreateOptions { hints?: string; /** The provider will add punctuation to recognition result */ enableAutomaticPunctuation?: boolean; + /** The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. */ + intelligenceService?: string; } export interface TranscriptionContext { @@ -397,6 +399,8 @@ export function TranscriptionListInstance( data["EnableAutomaticPunctuation"] = serialize.bool( params["enableAutomaticPunctuation"] ); + if (params["intelligenceService"] !== undefined) + data["IntelligenceService"] = params["intelligenceService"]; const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; diff --git a/src/rest/numbers/V1.ts b/src/rest/numbers/V1.ts index 148a24ce4..af82776f7 100644 --- a/src/rest/numbers/V1.ts +++ b/src/rest/numbers/V1.ts @@ -21,8 +21,8 @@ import { PortingPortInPhoneNumberListInstance } from "./v1/portingPortInPhoneNum import { PortingPortabilityListInstance } from "./v1/portingPortability"; import { PortingWebhookConfigurationListInstance } from "./v1/portingWebhookConfiguration"; import { PortingWebhookConfigurationDeleteListInstance } from "./v1/portingWebhookConfigurationDelete"; +import { PortingWebhookConfigurationFetchListInstance } from "./v1/portingWebhookConfigurationFetch"; import { SigningRequestConfigurationListInstance } from "./v1/signingRequestConfiguration"; -import { WebhookListInstance } from "./v1/webhook"; export default class V1 extends Version { /** @@ -48,10 +48,10 @@ export default class V1 extends Version { protected _portingWebhookConfigurations?: PortingWebhookConfigurationListInstance; /** portingWebhookConfigurationsDelete - { Twilio.Numbers.V1.PortingWebhookConfigurationDeleteListInstance } resource */ protected _portingWebhookConfigurationsDelete?: PortingWebhookConfigurationDeleteListInstance; + /** portingWebhookConfigurationFetch - { Twilio.Numbers.V1.PortingWebhookConfigurationFetchListInstance } resource */ + protected _portingWebhookConfigurationFetch?: PortingWebhookConfigurationFetchListInstance; /** signingRequestConfigurations - { Twilio.Numbers.V1.SigningRequestConfigurationListInstance } resource */ protected _signingRequestConfigurations?: SigningRequestConfigurationListInstance; - /** webhook - { Twilio.Numbers.V1.WebhookListInstance } resource */ - protected _webhook?: WebhookListInstance; /** Getter for bulkEligibilities resource */ get bulkEligibilities(): BulkEligibilityListInstance { @@ -104,6 +104,14 @@ export default class V1 extends Version { return this._portingWebhookConfigurationsDelete; } + /** Getter for portingWebhookConfigurationFetch resource */ + get portingWebhookConfigurationFetch(): PortingWebhookConfigurationFetchListInstance { + this._portingWebhookConfigurationFetch = + this._portingWebhookConfigurationFetch || + PortingWebhookConfigurationFetchListInstance(this); + return this._portingWebhookConfigurationFetch; + } + /** Getter for signingRequestConfigurations resource */ get signingRequestConfigurations(): SigningRequestConfigurationListInstance { this._signingRequestConfigurations = @@ -111,10 +119,4 @@ export default class V1 extends Version { SigningRequestConfigurationListInstance(this); return this._signingRequestConfigurations; } - - /** Getter for webhook resource */ - get webhook(): WebhookListInstance { - this._webhook = this._webhook || WebhookListInstance(this); - return this._webhook; - } } diff --git a/src/rest/numbers/v1/webhook.ts b/src/rest/numbers/v1/portingWebhookConfigurationFetch.ts similarity index 74% rename from src/rest/numbers/v1/webhook.ts rename to src/rest/numbers/v1/portingWebhookConfigurationFetch.ts index fb632f573..65a19d1c0 100644 --- a/src/rest/numbers/v1/webhook.ts +++ b/src/rest/numbers/v1/portingWebhookConfigurationFetch.ts @@ -18,23 +18,26 @@ const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; -export interface WebhookSolution {} +export interface PortingWebhookConfigurationFetchSolution {} -export interface WebhookListInstance { +export interface PortingWebhookConfigurationFetchListInstance { _version: V1; - _solution: WebhookSolution; + _solution: PortingWebhookConfigurationFetchSolution; _uri: string; /** - * Fetch a WebhookInstance + * Fetch a PortingWebhookConfigurationFetchInstance * * @param callback - Callback to handle processed record * - * @returns Resolves to processed WebhookInstance + * @returns Resolves to processed PortingWebhookConfigurationFetchInstance */ fetch( - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; + callback?: ( + error: Error | null, + item?: PortingWebhookConfigurationFetchInstance + ) => any + ): Promise; /** * Provide a user-friendly representation @@ -43,16 +46,21 @@ export interface WebhookListInstance { [inspect.custom](_depth: any, options: InspectOptions): any; } -export function WebhookListInstance(version: V1): WebhookListInstance { - const instance = {} as WebhookListInstance; +export function PortingWebhookConfigurationFetchListInstance( + version: V1 +): PortingWebhookConfigurationFetchListInstance { + const instance = {} as PortingWebhookConfigurationFetchListInstance; instance._version = version; instance._solution = {}; instance._uri = `/Porting/Configuration/Webhook`; instance.fetch = function fetch( - callback?: (error: Error | null, items: WebhookInstance) => any - ): Promise { + callback?: ( + error: Error | null, + items: PortingWebhookConfigurationFetchInstance + ) => any + ): Promise { let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, @@ -60,7 +68,8 @@ export function WebhookListInstance(version: V1): WebhookListInstance { }); operationPromise = operationPromise.then( - (payload) => new WebhookInstance(operationVersion, payload) + (payload) => + new PortingWebhookConfigurationFetchInstance(operationVersion, payload) ); operationPromise = instance._version.setPromiseCallback( @@ -84,9 +93,10 @@ export function WebhookListInstance(version: V1): WebhookListInstance { return instance; } -interface WebhookPayload extends WebhookResource {} +interface PortingWebhookConfigurationFetchPayload + extends PortingWebhookConfigurationFetchResource {} -interface WebhookResource { +interface PortingWebhookConfigurationFetchResource { url: string; port_in_target_url: string; port_out_target_url: string; @@ -95,8 +105,11 @@ interface WebhookResource { port_out_target_date_created: Date; } -export class WebhookInstance { - constructor(protected _version: V1, payload: WebhookResource) { +export class PortingWebhookConfigurationFetchInstance { + constructor( + protected _version: V1, + payload: PortingWebhookConfigurationFetchResource + ) { this.url = payload.url; this.portInTargetUrl = payload.port_in_target_url; this.portOutTargetUrl = payload.port_out_target_url; diff --git a/src/rest/numbers/v2/hostedNumberOrder.ts b/src/rest/numbers/v2/hostedNumberOrder.ts index 3f9e19a45..ea0e99a7c 100644 --- a/src/rest/numbers/v2/hostedNumberOrder.ts +++ b/src/rest/numbers/v2/hostedNumberOrder.ts @@ -23,6 +23,7 @@ import { PhoneNumberCapabilities } from "../../../interfaces"; export type HostedNumberOrderStatus = | "received" + | "pending-verification" | "verified" | "pending-loa" | "carrier-processing" @@ -30,6 +31,20 @@ export type HostedNumberOrderStatus = | "failed" | "action-required"; +export type HostedNumberOrderVerificationType = "phone-call"; + +/** + * Options to pass to update a HostedNumberOrderInstance + */ +export interface HostedNumberOrderContextUpdateOptions { + /** */ + status: HostedNumberOrderStatus; + /** The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. */ + verificationCallDelay?: number; + /** The numerical extension to dial when making the ownership verification call. */ + verificationCallExtension?: string; +} + /** * Options to pass to create a HostedNumberOrderInstance */ @@ -159,6 +174,19 @@ export interface HostedNumberOrderContext { callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any ): Promise; + /** + * Update a HostedNumberOrderInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed HostedNumberOrderInstance + */ + update( + params: HostedNumberOrderContextUpdateOptions, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise; + /** * Provide a user-friendly representation */ @@ -226,6 +254,54 @@ export class HostedNumberOrderContextImpl implements HostedNumberOrderContext { return operationPromise; } + update( + params: HostedNumberOrderContextUpdateOptions, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["status"] === null || params["status"] === undefined) { + throw new Error("Required parameter \"params['status']\" missing."); + } + + let data: any = {}; + + data["Status"] = params["status"]; + if (params["verificationCallDelay"] !== undefined) + data["VerificationCallDelay"] = params["verificationCallDelay"]; + if (params["verificationCallExtension"] !== undefined) + data["VerificationCallExtension"] = params["verificationCallExtension"]; + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.update({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new HostedNumberOrderInstance( + operationVersion, + payload, + instance._solution.sid + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + /** * Provide a user-friendly representation * @@ -264,6 +340,12 @@ interface HostedNumberOrderResource { contact_phone_number: string; bulk_hosting_request_sid: string; next_step: string; + verification_attempts: number; + verification_call_sids: Array; + verification_call_delay: number; + verification_call_extension: string; + verification_code: string; + verification_type: HostedNumberOrderVerificationType; } export class HostedNumberOrderInstance { @@ -294,6 +376,16 @@ export class HostedNumberOrderInstance { this.contactPhoneNumber = payload.contact_phone_number; this.bulkHostingRequestSid = payload.bulk_hosting_request_sid; this.nextStep = payload.next_step; + this.verificationAttempts = deserialize.integer( + payload.verification_attempts + ); + this.verificationCallSids = payload.verification_call_sids; + this.verificationCallDelay = deserialize.integer( + payload.verification_call_delay + ); + this.verificationCallExtension = payload.verification_call_extension; + this.verificationCode = payload.verification_code; + this.verificationType = payload.verification_type; this._solution = { sid: sid || this.sid }; } @@ -368,6 +460,27 @@ export class HostedNumberOrderInstance { * The next step you need to take to complete the hosted number order and request it successfully. */ nextStep: string; + /** + * The number of attempts made to verify ownership via a call for the hosted phone number. + */ + verificationAttempts: number; + /** + * The Call SIDs that identify the calls placed to verify ownership. + */ + verificationCallSids: Array; + /** + * The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + */ + verificationCallDelay: number; + /** + * The numerical extension to dial when making the ownership verification call. + */ + verificationCallExtension: string; + /** + * The digits the user must pass in the ownership verification call. + */ + verificationCode: string; + verificationType: HostedNumberOrderVerificationType; private get _proxy(): HostedNumberOrderContext { this._context = @@ -402,6 +515,26 @@ export class HostedNumberOrderInstance { return this._proxy.fetch(callback); } + /** + * Update a HostedNumberOrderInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed HostedNumberOrderInstance + */ + update( + params: HostedNumberOrderContextUpdateOptions, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise; + + update( + params?: any, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise { + return this._proxy.update(params, callback); + } + /** * Provide a user-friendly representation * @@ -428,6 +561,12 @@ export class HostedNumberOrderInstance { contactPhoneNumber: this.contactPhoneNumber, bulkHostingRequestSid: this.bulkHostingRequestSid, nextStep: this.nextStep, + verificationAttempts: this.verificationAttempts, + verificationCallSids: this.verificationCallSids, + verificationCallDelay: this.verificationCallDelay, + verificationCallExtension: this.verificationCallExtension, + verificationCode: this.verificationCode, + verificationType: this.verificationType, }; } diff --git a/src/twiml/VoiceResponse.ts b/src/twiml/VoiceResponse.ts index 38f492cd5..707e80586 100644 --- a/src/twiml/VoiceResponse.ts +++ b/src/twiml/VoiceResponse.ts @@ -348,6 +348,8 @@ namespace VoiceResponse { type ConversationTrim = "trim-silence" | "do-not-trim"; + type DialEvents = "call-progress-event"; + type DialRecord = | "do-not-record" | "record-from-answer" @@ -1339,6 +1341,8 @@ namespace VoiceResponse { answerOnBridge?: boolean; /** callerId - Caller ID to display */ callerId?: string; + /** events - Subscription to events */ + events?: DialEvents; /** hangupOnStar - Hangup call on star press */ hangupOnStar?: boolean; /** method - Action URL method */ @@ -1657,6 +1661,8 @@ namespace VoiceResponse { hints?: string; /** inboundTrackLabel - Friendly name given to the Inbound Track */ inboundTrackLabel?: string; + /** intelligenceService - The SID or the unique name of the Intelligence Service to be used */ + intelligenceService?: string; /** languageCode - Language Code used by the transcription engine */ languageCode?: string; /** name - Friendly name given to the Transcription */ @@ -1763,6 +1769,8 @@ namespace VoiceResponse { hints?: string; /** inboundTrackLabel - Friendly name given to the Inbound Track */ inboundTrackLabel?: string; + /** intelligenceService - The SID or the unique name of the Intelligence Service to be used */ + intelligenceService?: string; /** languageCode - Language Code used by the transcription engine */ languageCode?: string; /** name - Friendly name given to the Transcription */ @@ -2663,6 +2671,134 @@ namespace VoiceResponse { url?: string; } + /** + * Attributes to pass to conversationRelay + */ + export interface ConversationRelayAttributes { + /** debug - Whether debugging on the session is enabled */ + debug?: boolean; + /** dtmfDetection - Whether DTMF tones should be detected and reported in speech transcription */ + dtmfDetection?: boolean; + /** interruptByDtmf - Whether DTMF tone can interrupt the play of text-to-speech */ + interruptByDtmf?: boolean; + /** interruptible - Whether caller's speaking can interrupt the play of text-to-speech */ + interruptible?: boolean; + /** language - Language to be used for both text-to-speech and transcription */ + language?: string; + /** partialPrompts - Whether partial prompts should be reported to WebSocket server before the caller finishes speaking */ + partialPrompts?: boolean; + /** profanityFilter - Whether profanities should be filtered out of the speech transcription */ + profanityFilter?: boolean; + /** speechModel - Speech model to be used for transcription */ + speechModel?: string; + /** transcriptionLanguage - Language to be used for transcription */ + transcriptionLanguage?: string; + /** transcriptionProvider - Provider to be used for transcription */ + transcriptionProvider?: string; + /** ttsLanguage - Language to be used for text-to-speech */ + ttsLanguage?: string; + /** ttsProvider - Provider to be used for text-to-speech */ + ttsProvider?: string; + /** url - URL of the remote service where the session is connected to */ + url?: string; + /** voice - Voice to be used for text-to-speech */ + voice?: string; + /** welcomeGreeting - The sentence to be played automatically when the session is connected */ + welcomeGreeting?: string; + /** welcomeGreetingInterruptible - Whether caller's speaking can interrupt the welcome greeting */ + welcomeGreetingInterruptible?: boolean; + } + + /** + * Attributes to pass to assistant + */ + export interface AssistantAttributes { + /** debug - Whether debugging on the session is enabled */ + debug?: boolean; + /** dtmfDetection - Whether DTMF tones should be detected and reported in speech transcription */ + dtmfDetection?: boolean; + /** id - The assistant ID of the AI Assistant */ + id?: string; + /** interruptByDtmf - Whether DTMF tone can interrupt the play of text-to-speech */ + interruptByDtmf?: boolean; + /** interruptible - Whether caller's speaking can interrupt the play of text-to-speech */ + interruptible?: boolean; + /** language - Language to be used for both text-to-speech and transcription */ + language?: string; + /** partialPrompts - Whether partial prompts should be reported to WebSocket server before the caller finishes speaking */ + partialPrompts?: boolean; + /** profanityFilter - Whether profanities should be filtered out of the speech transcription */ + profanityFilter?: boolean; + /** speechModel - Speech model to be used for transcription */ + speechModel?: string; + /** transcriptionLanguage - Language to be used for transcription */ + transcriptionLanguage?: string; + /** transcriptionProvider - Provider to be used for transcription */ + transcriptionProvider?: string; + /** ttsLanguage - Language to be used for text-to-speech */ + ttsLanguage?: string; + /** ttsProvider - Provider to be used for text-to-speech */ + ttsProvider?: string; + /** voice - Voice to be used for text-to-speech */ + voice?: string; + /** welcomeGreeting - The sentence to be played automatically when the session is connected */ + welcomeGreeting?: string; + /** welcomeGreetingInterruptible - Whether caller's speaking can interrupt the welcome greeting */ + welcomeGreetingInterruptible?: boolean; + } + + /** + * Attributes to pass to language + */ + export interface LanguageAttributes { + /** code - Language code of this language setting is for */ + code?: string; + /** speechModel - Speech model to be used for transcription of this language */ + speechModel?: string; + /** transcriptionProvider - Provider to be used for transcription of this language */ + transcriptionProvider?: string; + /** ttsProvider - Provider to be used for text-to-speech of this language */ + ttsProvider?: string; + /** voice - Voice to be used for text-to-speech of this language */ + voice?: string; + } + + /** + * Attributes to pass to parameter + */ + export interface ParameterAttributes { + /** name - The name of the custom parameter */ + name?: string; + /** value - The value of the custom parameter */ + value?: string; + } + + /** + * Attributes to pass to language + */ + export interface LanguageAttributes { + /** code - Language code of this language setting is for */ + code?: string; + /** speechModel - Speech model to be used for transcription of this language */ + speechModel?: string; + /** transcriptionProvider - Provider to be used for transcription of this language */ + transcriptionProvider?: string; + /** ttsProvider - Provider to be used for text-to-speech of this language */ + ttsProvider?: string; + /** voice - Voice to be used for text-to-speech of this language */ + voice?: string; + } + + /** + * Attributes to pass to parameter + */ + export interface ParameterAttributes { + /** name - The name of the custom parameter */ + name?: string; + /** value - The value of the custom parameter */ + value?: string; + } + /** * Attributes to pass to config */ @@ -2742,6 +2878,42 @@ namespace VoiceResponse { } } + export class Assistant extends TwiML { + assistant: XMLElement; + /** + * TwiML Noun + */ + constructor(assistant: XMLElement) { + super(); + this.assistant = assistant; + this._propertyName = "assistant"; + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + language( + attributes?: VoiceResponse.LanguageAttributes + ): VoiceResponse.Language { + return new VoiceResponse.Language( + this.assistant.ele("Language", attributes) + ); + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + parameter( + attributes?: VoiceResponse.ParameterAttributes + ): VoiceResponse.Parameter { + return new VoiceResponse.Parameter( + this.assistant.ele("Parameter", attributes) + ); + } + } + export class Autopilot extends TwiML { autopilot: XMLElement; /** @@ -2835,6 +3007,18 @@ namespace VoiceResponse { this.connect = connect; this._propertyName = "connect"; } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + assistant( + attributes?: VoiceResponse.AssistantAttributes + ): VoiceResponse.Assistant { + return new VoiceResponse.Assistant( + this.connect.ele("Assistant", attributes) + ); + } /** * TwiML Noun * @@ -2867,6 +3051,18 @@ namespace VoiceResponse { this.connect.ele("Conversation", attributes) ); } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + conversationRelay( + attributes?: VoiceResponse.ConversationRelayAttributes + ): VoiceResponse.ConversationRelay { + return new VoiceResponse.ConversationRelay( + this.connect.ele("ConversationRelay", attributes) + ); + } /** * TwiML Noun * @@ -2922,6 +3118,42 @@ namespace VoiceResponse { } } + export class ConversationRelay extends TwiML { + conversationRelay: XMLElement; + /** + * TwiML Noun + */ + constructor(conversationRelay: XMLElement) { + super(); + this.conversationRelay = conversationRelay; + this._propertyName = "conversationRelay"; + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + language( + attributes?: VoiceResponse.LanguageAttributes + ): VoiceResponse.Language { + return new VoiceResponse.Language( + this.conversationRelay.ele("Language", attributes) + ); + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + parameter( + attributes?: VoiceResponse.ParameterAttributes + ): VoiceResponse.Parameter { + return new VoiceResponse.Parameter( + this.conversationRelay.ele("Parameter", attributes) + ); + } + } + export class Dial extends TwiML { dial: XMLElement; /** @@ -3226,6 +3458,18 @@ namespace VoiceResponse { } } + export class Language extends TwiML { + language: XMLElement; + /** + * TwiML Noun + */ + constructor(language: XMLElement) { + super(); + this.language = language; + this._propertyName = "language"; + } + } + export class Leave extends TwiML { leave: XMLElement; /**