UNPKG

@vonage/voice

Version:

The Voice API lets you create outbound calls, control in-progress calls and get information about historical calls.

107 lines (104 loc) 4.57 kB
import { NCCOActions } from '../../enums/NCCOActions.js'; import { ConnectEventType } from '../../enums/NCCO/ConnectEventType.js'; import { MachineDetection } from '../../enums/NCCO/MachineDetection.js'; import { CallEndpoint } from '../../types/Endpoint/CallEndpoint.js'; import { ConnectAction } from '../../types/NCCO/ConnectAction.js'; import { Serializable } from '../../interfaces/NCCO/Serializable.js'; import '../../types/Endpoint/PhoneEndpoint.js'; import '../../types/Endpoint/SIPEndpoint.js'; import '../../types/Endpoint/VBCEndpoint.js'; import '../../types/Endpoint/WebsocketEndpoint.js'; import '../../types/Endpoint/AppEndpoint.js'; /** * Represents a Connect action in the Nexmo Call Control Object (NCCO) for making voice calls. */ declare class Connect implements ConnectAction, Serializable { /** * The action type, which is always 'connect'. */ action: NCCOActions.CONNECT; /** * An array of CallEndpoint objects representing the endpoints to connect to in the call. * * @param {CallEndpoint} endpoint - An array of CallEndpoint objects * representing the endpoints to connect to in the call. */ endpoint: CallEndpoint[]; /** * The caller's phone number to display as the caller ID. * * @param {string} from - The caller's phone number to display as the caller ID. */ from?: string; /** * Set to true to use a random phone number as the caller ID from the list of * numbers assigned to the current application. * * @param {boolean} randomFromNumber - Set to true to use a random phone number as the caller ID. */ randomFromNumber?: boolean; /** * The event type for call progress events sent to the specified event URL. * * @param {ConnectEventType} eventType - The event type for call progress events. */ eventType?: ConnectEventType; /** * The time in seconds that Vonage waits for the call to be answered before timing out. * * @param {number} timeout - The timeout value in seconds. */ timeout?: number; /** * The maximum number of concurrent calls that can be handled by your application. * * @param {number} limit - The maximum number of concurrent calls. */ limit?: number; /** * Configure the behavior when Vonage detects that the call is answered by voicemail. * * @param {MachineDetection} machineDetection - The behavior when voicemail is detected. */ machineDetection?: MachineDetection; /** * An array of event URLs where call progress events are sent to. Multiple URLs can be specified. * * @param {string} eventUrl - An array of event URLs. */ eventUrl?: string[]; /** * The HTTP method used to send event information to the event URL(s). * * @param {string} eventMethod - The HTTP method used for event callbacks. */ eventMethod?: string; /** * The URL of a ringback tone to play to the caller while waiting for the call to be answered. * * @param {string} ringbackTone - The URL of the ringback tone audio file. */ ringbackTone?: string; /** * Create a new Connect instance. * * @param {CallEndpoint} endpoint - An array of CallEndpoint objects representing the endpoints to connect to in the call. * @param {string} from - The caller's phone number to display as the caller ID. * @param {boolean} randomFromNumber - Set to true to use a random phone number as the caller ID. * @param {ConnectEventType} eventType - The event type for call progress events. * @param {number} timeout - The timeout value in seconds. * @param {number} limit - The maximum number of concurrent calls. * @param {MachineDetection} machineDetection - The behavior when voicemail is detected. * @param {string} eventUrl - An array of event URLs. * @param {string} eventMethod - The HTTP method used for event callbacks. * @param {string} ringbackTone - The URL of the ringback tone audio file. */ constructor(endpoint: CallEndpoint, from?: string, randomFromNumber?: boolean, eventType?: ConnectEventType, timeout?: number, limit?: number, machineDetection?: MachineDetection, eventUrl?: string, eventMethod?: string, ringbackTone?: string); /** * Serialize the Connect action to a Nexmo Call Control Object (NCCO) format. * * @return {ConnectAction} - The serialized Connect action. */ serializeToNCCO(): ConnectAction; } export { Connect };