From 56ff9e35504166794b332bd946c1940646f5e1fd Mon Sep 17 00:00:00 2001 From: Antoine Sein Date: Fri, 16 Feb 2024 16:06:33 +0100 Subject: [PATCH 1/4] Refactor Voice models --- .../src/voice/applications/getNumbers.ts | 2 +- .../src/voice/calls/manageWithCallLeg.ts | 2 +- .../simple-examples/src/voice/calls/update.ts | 2 +- .../v1/ace-request-amd/ace-request-amd.ts | 22 ------- .../src/models/v1/ace-request-amd/index.ts | 1 - .../voice/src/models/v1/ace-request/index.ts | 1 - .../models/v1/ace-response/ace-response.ts | 26 -------- .../v1/assign-numbers/assign-numbers.ts | 13 +--- .../src/models/v1/call-header/call-header.ts | 10 --- .../src/models/v1/call-object/call-object.ts | 31 +++++++++ .../voice/src/models/v1/call-object/index.ts | 1 + .../v1/callout-request/callout-request.ts | 28 -------- .../src/models/v1/callout-request/index.ts | 1 - .../v1/callout-response/callout-response.ts | 10 +++ .../src/models/v1/callout-response/index.ts | 1 + ...callout-request-conference-dtmf-options.ts | 22 ------- .../index.ts | 3 - .../conference-callout-request.ts | 15 +---- .../conference-dtmf-options.ts} | 10 +-- .../v1/conference-dtmf-options/index.ts | 1 + .../custom-callout-request.ts | 9 --- .../src/models/v1/destination/destination.ts | 13 +--- .../dice-request-debit/dice-request-debit.ts | 20 ------ .../src/models/v1/dice-request-debit/index.ts | 1 - .../dice-request-user-rate.ts | 20 ------ .../models/v1/dice-request-user-rate/index.ts | 1 - packages/voice/src/models/v1/enums.ts | 30 --------- .../get-call-response-obj.ts | 66 ------------------- .../models/v1/get-call-response-obj/index.ts | 7 -- .../v1/get-callbacks-url/get-callbacks-url.ts | 20 ------ .../src/models/v1/get-callbacks-url/index.ts | 1 - .../models/v1/get-callbacks/get-callbacks.ts | 17 ++--- .../src/models/v1/get-callbacks/index.ts | 2 +- .../get-callout-response-obj.ts | 18 ----- .../v1/get-callout-response-obj/index.ts | 1 - ...erence-info-response-participants-inner.ts | 21 ------ .../index.ts | 1 - .../get-conference-info-response.ts | 21 +++--- .../v1/get-conference-info-response/index.ts | 2 +- .../index.ts | 1 - .../get-numbers-response-obj.ts | 16 ----- .../v1/get-numbers-response-obj/index.ts | 1 - .../get-query-number-number-item-rate.ts | 20 ------ .../index.ts | 1 - .../get-query-number-number-item.ts | 28 -------- .../v1/get-query-number-number-item/index.ts | 1 - .../v1/get-query-number/get-query-number.ts | 18 ----- .../src/models/v1/get-query-number/index.ts | 1 - .../get-recording-file-info.ts | 18 ----- .../v1/get-recording-file-info/index.ts | 1 - .../v1/ice-request-to/ice-request-to.ts | 20 ------ .../src/models/v1/ice-request-to/index.ts | 1 - .../ice-request-user-rate.ts | 20 ------ .../models/v1/ice-request-user-rate/index.ts | 1 - .../models/v1/ice-response/ice-response.ts | 36 ---------- packages/voice/src/models/v1/index.ts | 60 ++++------------- .../models/v1/list-numbers-response/index.ts | 1 + .../list-numbers-response.ts} | 17 ++--- .../manage-conference-participant-request.ts | 22 +------ packages/voice/src/models/v1/menu/menu.ts | 7 -- .../ace-request/ace-request.ts | 21 +++--- .../v1/mod-callbacks/ace-request/index.ts | 1 + .../ace-response/ace-response.ts | 28 ++++++++ .../{ => mod-callbacks}/ace-response/index.ts | 0 .../dice-request/dice-request.ts | 28 +++----- .../{ => mod-callbacks}/dice-request/index.ts | 0 .../ice-request/ice-request.ts | 21 ++---- .../{ => mod-callbacks}/ice-request/index.ts | 0 .../ice-response/ice-response.ts | 38 +++++++++++ .../{ => mod-callbacks}/ice-response/index.ts | 0 .../src/models/v1/mod-callbacks/index.ts | 9 +++ .../notify-error-request/index.ts | 0 .../notify-error-request.ts | 10 --- .../notify-request/index.ts | 0 .../notify-request/notify-request.ts | 14 +--- .../v1/mod-callbacks/pie-request/index.ts | 1 + .../pie-request/pie-request.ts | 23 +++---- .../{ => mod-callbacks}/pie-response/index.ts | 0 .../pie-response/pie-response.ts | 37 +++++++++++ .../voice/src/models/v1/mod-svaml/index.ts | 17 +++++ .../svaml-action-connect-conf/index.ts | 0 .../svaml-action-connect-conf.ts | 15 +---- .../svaml-action-connect-mxp/index.ts | 0 .../svaml-action-connect-mxp.ts | 15 ++--- .../svaml-action-connect-pstn/index.ts | 1 + .../svaml-action-connect-pstn.ts | 18 ++--- .../svaml-action-connect-sip/index.ts | 1 + .../svaml-action-connect-sip.ts | 20 +++--- .../svaml-action-continue/index.ts | 0 .../svaml-action-continue.ts | 10 --- .../svaml-action-hangup/index.ts | 0 .../svaml-action-hangup.ts | 10 --- .../svaml-action-park/index.ts | 0 .../svaml-action-park/svaml-action-park.ts | 10 --- .../svaml-action-run-menu/index.ts | 0 .../svaml-action-run-menu.ts | 11 +--- .../v1/{ => mod-svaml}/svaml-action/index.ts | 0 .../svaml-action/svaml-action.ts | 7 -- .../svaml-instruction-answer/index.ts | 0 .../svaml-instruction-answer.ts | 10 --- .../svaml-instruction-play-files/index.ts | 0 .../svaml-instruction-play-files.ts | 10 --- .../svaml-instruction-say/index.ts | 0 .../svaml-instruction-say.ts | 10 --- .../svaml-instruction-send-dtmf/index.ts | 0 .../svaml-instruction-send-dtmf.ts | 10 --- .../svaml-instruction-set-cookie/index.ts | 0 .../svaml-instruction-set-cookie.ts | 10 --- .../index.ts | 0 .../svaml-instruction-start-recording.ts | 10 +-- .../svaml-instruction-stop-recording/index.ts | 0 .../svaml-instruction-stop-recording.ts | 10 --- .../svaml-instruction/index.ts | 0 .../svaml-instruction/svaml-instruction.ts | 7 -- packages/voice/src/models/v1/option/option.ts | 10 --- .../voice/src/models/v1/participant/index.ts | 1 + .../src/models/v1/participant/participant.ts | 12 ++++ .../v1/pie-request-menu-result/index.ts | 1 - .../pie-request-menu-result.ts | 24 ------- .../voice/src/models/v1/pie-request/index.ts | 1 - .../models/v1/pie-response/pie-response.ts | 32 --------- .../models/v1/query-number-response/index.ts | 1 + .../query-number-response.ts | 23 +++++++ .../index.ts | 1 - .../index.ts | 1 - .../svaml-action-connect-mxp-destination.ts | 20 ------ .../v1/svaml-action-connect-pstn-amd/index.ts | 1 - .../svaml-action-connect-pstn-amd.ts | 18 ----- .../v1/svaml-action-connect-pstn/index.ts | 1 - .../index.ts | 1 - .../svaml-action-connect-sip-destination.ts | 18 ----- .../v1/svaml-action-connect-sip/index.ts | 1 - .../svaml-request-body/svaml-request-body.ts | 12 +--- .../tts-callout-request.ts | 14 +--- .../v1/unassign-numbers/unassign-numbers.ts | 13 +--- .../models/v1/update-callbacks-url/index.ts | 1 - .../update-callbacks-url.ts | 20 ------ .../src/models/v1/update-callbacks/index.ts | 2 +- .../v1/update-callbacks/update-callbacks.ts | 22 +++---- .../src/models/v1/voice-error/voice-error.ts | 10 --- .../voice/src/models/v1/voice-price/index.ts | 1 + .../src/models/v1/voice-price/voice-price.ts | 9 +++ .../applications-api.jest.fixture.ts | 6 +- .../rest/v1/applications/applications-api.ts | 12 ++-- .../v1/callouts/callouts-api.jest.fixture.ts | 8 +-- .../src/rest/v1/callouts/callouts-api.ts | 14 ++-- .../rest/v1/calls/calls-api.jest.fixture.ts | 4 +- packages/voice/src/rest/v1/calls/calls-api.ts | 14 ++-- .../v1/applications/applications-api.test.ts | 16 ++--- .../rest/v1/callouts/callouts-api.test.ts | 8 +-- .../tests/rest/v1/calls/calls-api.test.ts | 8 +-- 151 files changed, 402 insertions(+), 1166 deletions(-) delete mode 100644 packages/voice/src/models/v1/ace-request-amd/ace-request-amd.ts delete mode 100644 packages/voice/src/models/v1/ace-request-amd/index.ts delete mode 100644 packages/voice/src/models/v1/ace-request/index.ts delete mode 100644 packages/voice/src/models/v1/ace-response/ace-response.ts create mode 100644 packages/voice/src/models/v1/call-object/call-object.ts create mode 100644 packages/voice/src/models/v1/call-object/index.ts delete mode 100644 packages/voice/src/models/v1/callout-request/callout-request.ts delete mode 100644 packages/voice/src/models/v1/callout-request/index.ts create mode 100644 packages/voice/src/models/v1/callout-response/callout-response.ts create mode 100644 packages/voice/src/models/v1/callout-response/index.ts delete mode 100644 packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/conference-callout-request-conference-dtmf-options.ts delete mode 100644 packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/index.ts rename packages/voice/src/models/v1/{svaml-action-connect-conf-conference-dtmf-options/svaml-action-connect-conf-conference-dtmf-options.ts => conference-dtmf-options/conference-dtmf-options.ts} (81%) create mode 100644 packages/voice/src/models/v1/conference-dtmf-options/index.ts delete mode 100644 packages/voice/src/models/v1/dice-request-debit/dice-request-debit.ts delete mode 100644 packages/voice/src/models/v1/dice-request-debit/index.ts delete mode 100644 packages/voice/src/models/v1/dice-request-user-rate/dice-request-user-rate.ts delete mode 100644 packages/voice/src/models/v1/dice-request-user-rate/index.ts delete mode 100644 packages/voice/src/models/v1/get-call-response-obj/get-call-response-obj.ts delete mode 100644 packages/voice/src/models/v1/get-call-response-obj/index.ts delete mode 100644 packages/voice/src/models/v1/get-callbacks-url/get-callbacks-url.ts delete mode 100644 packages/voice/src/models/v1/get-callbacks-url/index.ts delete mode 100644 packages/voice/src/models/v1/get-callout-response-obj/get-callout-response-obj.ts delete mode 100644 packages/voice/src/models/v1/get-callout-response-obj/index.ts delete mode 100644 packages/voice/src/models/v1/get-conference-info-response-participants-inner/get-conference-info-response-participants-inner.ts delete mode 100644 packages/voice/src/models/v1/get-conference-info-response-participants-inner/index.ts delete mode 100644 packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/index.ts delete mode 100644 packages/voice/src/models/v1/get-numbers-response-obj/get-numbers-response-obj.ts delete mode 100644 packages/voice/src/models/v1/get-numbers-response-obj/index.ts delete mode 100644 packages/voice/src/models/v1/get-query-number-number-item-rate/get-query-number-number-item-rate.ts delete mode 100644 packages/voice/src/models/v1/get-query-number-number-item-rate/index.ts delete mode 100644 packages/voice/src/models/v1/get-query-number-number-item/get-query-number-number-item.ts delete mode 100644 packages/voice/src/models/v1/get-query-number-number-item/index.ts delete mode 100644 packages/voice/src/models/v1/get-query-number/get-query-number.ts delete mode 100644 packages/voice/src/models/v1/get-query-number/index.ts delete mode 100644 packages/voice/src/models/v1/get-recording-file-info/get-recording-file-info.ts delete mode 100644 packages/voice/src/models/v1/get-recording-file-info/index.ts delete mode 100644 packages/voice/src/models/v1/ice-request-to/ice-request-to.ts delete mode 100644 packages/voice/src/models/v1/ice-request-to/index.ts delete mode 100644 packages/voice/src/models/v1/ice-request-user-rate/ice-request-user-rate.ts delete mode 100644 packages/voice/src/models/v1/ice-request-user-rate/index.ts delete mode 100644 packages/voice/src/models/v1/ice-response/ice-response.ts create mode 100644 packages/voice/src/models/v1/list-numbers-response/index.ts rename packages/voice/src/models/v1/{get-numbers-response-obj-numbers-inner/get-numbers-response-obj-numbers-inner.ts => list-numbers-response/list-numbers-response.ts} (63%) rename packages/voice/src/models/v1/{ => mod-callbacks}/ace-request/ace-request.ts (53%) create mode 100644 packages/voice/src/models/v1/mod-callbacks/ace-request/index.ts create mode 100644 packages/voice/src/models/v1/mod-callbacks/ace-response/ace-response.ts rename packages/voice/src/models/v1/{ => mod-callbacks}/ace-response/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-callbacks}/dice-request/dice-request.ts (66%) rename packages/voice/src/models/v1/{ => mod-callbacks}/dice-request/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-callbacks}/ice-request/ice-request.ts (77%) rename packages/voice/src/models/v1/{ => mod-callbacks}/ice-request/index.ts (100%) create mode 100644 packages/voice/src/models/v1/mod-callbacks/ice-response/ice-response.ts rename packages/voice/src/models/v1/{ => mod-callbacks}/ice-response/index.ts (100%) create mode 100644 packages/voice/src/models/v1/mod-callbacks/index.ts rename packages/voice/src/models/v1/{ => mod-callbacks}/notify-error-request/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-callbacks}/notify-error-request/notify-error-request.ts (86%) rename packages/voice/src/models/v1/{ => mod-callbacks}/notify-request/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-callbacks}/notify-request/notify-request.ts (71%) create mode 100644 packages/voice/src/models/v1/mod-callbacks/pie-request/index.ts rename packages/voice/src/models/v1/{ => mod-callbacks}/pie-request/pie-request.ts (57%) rename packages/voice/src/models/v1/{ => mod-callbacks}/pie-response/index.ts (100%) create mode 100644 packages/voice/src/models/v1/mod-callbacks/pie-response/pie-response.ts create mode 100644 packages/voice/src/models/v1/mod-svaml/index.ts rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-connect-conf/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-connect-conf/svaml-action-connect-conf.ts (66%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-connect-mxp/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-connect-mxp/svaml-action-connect-mxp.ts (61%) create mode 100644 packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-connect-pstn/svaml-action-connect-pstn.ts (88%) create mode 100644 packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-connect-sip/svaml-action-connect-sip.ts (81%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-continue/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-continue/svaml-action-continue.ts (72%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-hangup/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-hangup/svaml-action-hangup.ts (79%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-park/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-park/svaml-action-park.ts (92%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-run-menu/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action-run-menu/svaml-action-run-menu.ts (93%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-action/svaml-action.ts (89%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-answer/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-answer/svaml-instruction-answer.ts (60%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-play-files/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-play-files/svaml-instruction-play-files.ts (87%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-say/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-say/svaml-instruction-say.ts (85%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-send-dtmf/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts (85%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-set-cookie/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts (73%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-start-recording/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-start-recording/svaml-instruction-start-recording.ts (91%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-stop-recording/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts (61%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction/index.ts (100%) rename packages/voice/src/models/v1/{ => mod-svaml}/svaml-instruction/svaml-instruction.ts (90%) create mode 100644 packages/voice/src/models/v1/participant/index.ts create mode 100644 packages/voice/src/models/v1/participant/participant.ts delete mode 100644 packages/voice/src/models/v1/pie-request-menu-result/index.ts delete mode 100644 packages/voice/src/models/v1/pie-request-menu-result/pie-request-menu-result.ts delete mode 100644 packages/voice/src/models/v1/pie-request/index.ts delete mode 100644 packages/voice/src/models/v1/pie-response/pie-response.ts create mode 100644 packages/voice/src/models/v1/query-number-response/index.ts create mode 100644 packages/voice/src/models/v1/query-number-response/query-number-response.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/index.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-mxp-destination/index.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-mxp-destination/svaml-action-connect-mxp-destination.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-pstn-amd/index.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-pstn-amd/svaml-action-connect-pstn-amd.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-pstn/index.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-sip-destination/index.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-sip-destination/svaml-action-connect-sip-destination.ts delete mode 100644 packages/voice/src/models/v1/svaml-action-connect-sip/index.ts delete mode 100644 packages/voice/src/models/v1/update-callbacks-url/index.ts delete mode 100644 packages/voice/src/models/v1/update-callbacks-url/update-callbacks-url.ts create mode 100644 packages/voice/src/models/v1/voice-price/index.ts create mode 100644 packages/voice/src/models/v1/voice-price/voice-price.ts diff --git a/examples/simple-examples/src/voice/applications/getNumbers.ts b/examples/simple-examples/src/voice/applications/getNumbers.ts index 1df4a0d2..79047da2 100644 --- a/examples/simple-examples/src/voice/applications/getNumbers.ts +++ b/examples/simple-examples/src/voice/applications/getNumbers.ts @@ -11,7 +11,7 @@ import { GetNumbersRequestData } from '@sinch/sdk-core'; const sinchClient = initApplicationClient(); let response; try { - response = await sinchClient.voice.applications.getNumbers(requestData); + response = await sinchClient.voice.applications.listNumbers(requestData); } catch (error) { console.log(`Impossible to get information about your numbers`); throw error; diff --git a/examples/simple-examples/src/voice/calls/manageWithCallLeg.ts b/examples/simple-examples/src/voice/calls/manageWithCallLeg.ts index 600c3d94..5dcdc1e0 100644 --- a/examples/simple-examples/src/voice/calls/manageWithCallLeg.ts +++ b/examples/simple-examples/src/voice/calls/manageWithCallLeg.ts @@ -14,7 +14,7 @@ import { ManageWithCallLegRequestData, VoiceRegion } from '@sinch/sdk-core'; const requestData: ManageWithCallLegRequestData = { callId, callLeg: 'callee', - svamlRequestBody: { + manageWithCallLegRequestBody: { instructions: [ { name: 'say', diff --git a/examples/simple-examples/src/voice/calls/update.ts b/examples/simple-examples/src/voice/calls/update.ts index a71e54c5..7776b78a 100644 --- a/examples/simple-examples/src/voice/calls/update.ts +++ b/examples/simple-examples/src/voice/calls/update.ts @@ -13,7 +13,7 @@ import { UpdateCallRequestData, VoiceRegion } from '@sinch/sdk-core'; const requestData: UpdateCallRequestData = { callId, - svamlRequestBody: { + updateCallRequestBody: { instructions: [ { name: 'sendDtmf', diff --git a/packages/voice/src/models/v1/ace-request-amd/ace-request-amd.ts b/packages/voice/src/models/v1/ace-request-amd/ace-request-amd.ts deleted file mode 100644 index ae3e201c..00000000 --- a/packages/voice/src/models/v1/ace-request-amd/ace-request-amd.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Model: AceRequestAmd - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * If [Answering Machine Detection](/docs/voice/api-reference/amd_v2) (AMD) is enabled, this object contains information about whether the call was answered by a machine. - */ -export interface AceRequestAmd { - - /** The determination by the system of who answered the call. */ - status?: string; - /** The reason that the system used to determine who answered the call. */ - reason?: string; - /** The length of the call. */ - duration?: number; -} - - diff --git a/packages/voice/src/models/v1/ace-request-amd/index.ts b/packages/voice/src/models/v1/ace-request-amd/index.ts deleted file mode 100644 index 727d612e..00000000 --- a/packages/voice/src/models/v1/ace-request-amd/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { AceRequestAmd } from './ace-request-amd'; diff --git a/packages/voice/src/models/v1/ace-request/index.ts b/packages/voice/src/models/v1/ace-request/index.ts deleted file mode 100644 index 5ae17def..00000000 --- a/packages/voice/src/models/v1/ace-request/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { AceRequest } from './ace-request'; diff --git a/packages/voice/src/models/v1/ace-response/ace-response.ts b/packages/voice/src/models/v1/ace-response/ace-response.ts deleted file mode 100644 index 327808c4..00000000 --- a/packages/voice/src/models/v1/ace-response/ace-response.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { SvamlActionHangup } from '../svaml-action-hangup'; -import { SvamlActionConnectConf } from '../svaml-action-connect-conf'; -import { SvamlActionRunMenu } from '../svaml-action-run-menu'; -import { SvamlActionContinue } from '../svaml-action-continue'; -import { SvamlInstructionPlayFiles } from '../svaml-instruction-play-files'; -import { SvamlInstructionSay } from '../svaml-instruction-say'; -import { SvamlInstructionSetCookie } from '../svaml-instruction-set-cookie'; -import { SvamlInstructionStartRecording } from '../svaml-instruction-start-recording'; - -export type AceSvamlAction = SvamlActionHangup - | SvamlActionContinue - | SvamlActionConnectConf - | SvamlActionRunMenu; - -export type AceSvamlInstruction = SvamlInstructionPlayFiles - | SvamlInstructionSay - | SvamlInstructionSetCookie - | SvamlInstructionStartRecording; - -export interface AceResponse { - - /** The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary. */ - instructions?: AceSvamlInstruction[]; - /** @see SvamlAction */ - action?: AceSvamlAction; -} diff --git a/packages/voice/src/models/v1/assign-numbers/assign-numbers.ts b/packages/voice/src/models/v1/assign-numbers/assign-numbers.ts index d7868ba9..4ecdf09c 100644 --- a/packages/voice/src/models/v1/assign-numbers/assign-numbers.ts +++ b/packages/voice/src/models/v1/assign-numbers/assign-numbers.ts @@ -1,11 +1,3 @@ -/** - * Model: AssignNumbers - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - export interface AssignNumbers { /** The phone number or list of numbers in E.164 format. */ @@ -13,8 +5,5 @@ export interface AssignNumbers { /** indicates the application where the number(s) will be assigned. If empty, the application key that is used to sign the request will be used. */ applicationkey?: string; /** indicates the DID capability that needs to be assigned to the chosen application. Valid values are 'voice' and 'sms'. Please note that the DID needs to support the selected capability. */ - capability?: CapabilityEnum; + capability?: 'voice' | 'sms'; } - -export type CapabilityEnum = 'voice' | 'sms'; - diff --git a/packages/voice/src/models/v1/call-header/call-header.ts b/packages/voice/src/models/v1/call-header/call-header.ts index e1ce5176..5f09c4d9 100644 --- a/packages/voice/src/models/v1/call-header/call-header.ts +++ b/packages/voice/src/models/v1/call-header/call-header.ts @@ -1,11 +1,3 @@ -/** - * Model: CallHeader - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Call Headers can be used to pass custom data from a Sinch SDK client to another, or specified in an ICE response to be made available to the receiving client. Further, if Call Headers is specified they will be available in ICE and DICE events. */ @@ -16,5 +8,3 @@ export interface CallHeader { /** The call header value of the key value pair. */ value?: string; } - - diff --git a/packages/voice/src/models/v1/call-object/call-object.ts b/packages/voice/src/models/v1/call-object/call-object.ts new file mode 100644 index 00000000..56a94e72 --- /dev/null +++ b/packages/voice/src/models/v1/call-object/call-object.ts @@ -0,0 +1,31 @@ +import { ReasonEnum, ResultEnum } from '../enums'; +import { VoicePrice } from '../voice-price'; +import { Participant } from '../participant'; + +export interface CallObject { + + /** Contains the caller information. */ + from?: Participant; + /** Contains the callee information. */ + to?: Participant; + /** Must be `pstn` for PSTN. */ + domain?: 'pstn'; + /** The unique identifier of the call. */ + callId?: string; + /** The duration of the call in seconds. */ + duration?: number; + /** The status of the call. Either `ONGOING` or `FINAL` */ + status?: 'ONGOING' | 'FINAL'; + /** Contains the result of a call. */ + result?: ResultEnum; + /** Contains the reason why a call ended. */ + reason?: ReasonEnum; + /** The date and time of the call. */ + timestamp?: Date; + /** An object that can be used to pass custom information related to the call. */ + custom?: string; + /** The rate per minute that was charged for the call. */ + userRate?: VoicePrice; + /** The total amount charged for the call. */ + debit?: VoicePrice; +} diff --git a/packages/voice/src/models/v1/call-object/index.ts b/packages/voice/src/models/v1/call-object/index.ts new file mode 100644 index 00000000..ff3384d4 --- /dev/null +++ b/packages/voice/src/models/v1/call-object/index.ts @@ -0,0 +1 @@ +export type { CallObject } from './call-object'; diff --git a/packages/voice/src/models/v1/callout-request/callout-request.ts b/packages/voice/src/models/v1/callout-request/callout-request.ts deleted file mode 100644 index e920e00f..00000000 --- a/packages/voice/src/models/v1/callout-request/callout-request.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Model: CalloutRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { ConferenceCalloutRequest } from '../conference-callout-request'; -import { CustomCalloutRequest } from '../custom-callout-request'; -import { TtsCalloutRequest } from '../tts-callout-request'; - -/** - * Currently three types of callouts are supported: conference callouts, text-to-speech callouts and custom callouts. The custom callout is the most flexible, but text-to-speech and conference callouts are more convenient. - */ -export interface CalloutRequest { - - /** Sets the type of callout. */ - method: MethodEnum; - /** @see ConferenceCalloutRequest */ - conferenceCallout?: ConferenceCalloutRequest; - /** @see TtsCalloutRequest */ - ttsCallout?: TtsCalloutRequest; - /** @see CustomCalloutRequest */ - customCallout?: CustomCalloutRequest; -} - -export type MethodEnum = 'conferenceCallout' | 'ttsCallout' | 'customCallout'; - diff --git a/packages/voice/src/models/v1/callout-request/index.ts b/packages/voice/src/models/v1/callout-request/index.ts deleted file mode 100644 index b71a5adc..00000000 --- a/packages/voice/src/models/v1/callout-request/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { CalloutRequest } from './callout-request'; diff --git a/packages/voice/src/models/v1/callout-response/callout-response.ts b/packages/voice/src/models/v1/callout-response/callout-response.ts new file mode 100644 index 00000000..460e04e5 --- /dev/null +++ b/packages/voice/src/models/v1/callout-response/callout-response.ts @@ -0,0 +1,10 @@ +/** + * The returned call ID. + */ +export interface CalloutResponse { + + /** The returned call identifier. */ + callId?: string; +} + + diff --git a/packages/voice/src/models/v1/callout-response/index.ts b/packages/voice/src/models/v1/callout-response/index.ts new file mode 100644 index 00000000..ded27918 --- /dev/null +++ b/packages/voice/src/models/v1/callout-response/index.ts @@ -0,0 +1 @@ +export type { CalloutResponse } from './callout-response'; diff --git a/packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/conference-callout-request-conference-dtmf-options.ts b/packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/conference-callout-request-conference-dtmf-options.ts deleted file mode 100644 index 9c93bb24..00000000 --- a/packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/conference-callout-request-conference-dtmf-options.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Model: ConferenceCalloutRequestConferenceDtmfOptions - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * Options to control how DTMF signals are used by the participant in the conference. For information on how to use this feature, read more [here](../../../conference-dtmf). - */ -export interface ConferenceCalloutRequestConferenceDtmfOptions { - - /** Determines what DTMF mode the participant will use in the call. */ - mode?: string; - /** The maximum number of accepted digits before sending the collected input via a PIE callback. The default value is `1`. If the value is greater than `1`, the PIE callback is triggered by one of the three following events: - No additional digit is entered before the `timeoutMills` timeout period has elapsed. - The `#` character is entered. - The maximum number of digits has been entered. */ - maxDigits?: number; - /** The number of milliseconds that the system will wait between entered digits before triggering the PIE callback. The default value is `3000`. */ - timeoutMills?: number; -} - - diff --git a/packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/index.ts b/packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/index.ts deleted file mode 100644 index 2a20883e..00000000 --- a/packages/voice/src/models/v1/conference-callout-request-conference-dtmf-options/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { - ConferenceCalloutRequestConferenceDtmfOptions, -} from './conference-callout-request-conference-dtmf-options'; diff --git a/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts b/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts index e838a4b6..6d7583da 100644 --- a/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts +++ b/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts @@ -1,12 +1,5 @@ -/** - * Model: ConferenceCalloutRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { ConferenceCalloutRequestConferenceDtmfOptions } from '../conference-callout-request-conference-dtmf-options'; import { Destination } from '../destination'; +import { ConferenceDtmfOptions } from '../conference-dtmf-options'; /** * The conference callout calls a phone number or a user. When the call is answered, it's connected to a conference room. @@ -19,8 +12,8 @@ export interface ConferenceCalloutRequest { destination: Destination; /** The conferenceId of the conference to which you want the callee to join. If the conferenceId doesn't exist a conference room will be created. */ conferenceId: string; - /** @see ConferenceCalloutRequestConferenceDtmfOptions */ - conferenceDtmfOptions?: ConferenceCalloutRequestConferenceDtmfOptions; + /** Options to control how DTMF signals are used by the participant in the conference. For information on how to use this feature, read more [here](../../../conference-dtmf). */ + conferenceDtmfOptions?: ConferenceDtmfOptions; /** When the destination picks up, this DTMF tones will be played to the callee. Valid characters in the string are "0"-"9", "#" and "w". A "w" will render a 500 ms pause. Example: "ww1234#w#" will render a 1s pause, the DTMF tones "1", "2", "3", "4" and "#" followed by a 0.5s pause and finally the DTMF tone for "#". This can be used if the callout destination for instance require a conference PIN code or an extension to be entered. */ dtmf?: string; maxDuration?: number; @@ -41,5 +34,3 @@ export interface ConferenceCalloutRequest { /** can be either “pstn” for PSTN endpoint or “mxp” for data (app or web) clients. */ domain?: string; } - - diff --git a/packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/svaml-action-connect-conf-conference-dtmf-options.ts b/packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts similarity index 81% rename from packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/svaml-action-connect-conf-conference-dtmf-options.ts rename to packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts index 7e0f3198..1d833d8c 100644 --- a/packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/svaml-action-connect-conf-conference-dtmf-options.ts +++ b/packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts @@ -1,15 +1,7 @@ -/** - * Model: SvamlActionConnectConfConferenceDtmfOptions - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Options to control how DTMF signals are used by the participant in the conference. For information on how to use this feature, read more [here](../../conference-dtmf). */ -export interface SvamlActionConnectConfConferenceDtmfOptions { +export interface ConferenceDtmfOptions { /** Determines what DTMF mode the participant will use in the call. */ mode?: string; diff --git a/packages/voice/src/models/v1/conference-dtmf-options/index.ts b/packages/voice/src/models/v1/conference-dtmf-options/index.ts new file mode 100644 index 00000000..b432af10 --- /dev/null +++ b/packages/voice/src/models/v1/conference-dtmf-options/index.ts @@ -0,0 +1 @@ +export type { ConferenceDtmfOptions } from './conference-dtmf-options'; diff --git a/packages/voice/src/models/v1/custom-callout-request/custom-callout-request.ts b/packages/voice/src/models/v1/custom-callout-request/custom-callout-request.ts index db85252f..4cc0f999 100644 --- a/packages/voice/src/models/v1/custom-callout-request/custom-callout-request.ts +++ b/packages/voice/src/models/v1/custom-callout-request/custom-callout-request.ts @@ -1,10 +1,3 @@ -/** - * Model: CustomCalloutRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - import { Destination } from '../destination'; /** @@ -29,5 +22,3 @@ export interface CustomCalloutRequest { /** Note: PIE callbacks are not available for DATA Calls; only PSTN and SIP calls. You can use inline SVAML to replace a callback URL when using custom callouts. Ensure that the JSON object is escaped correctly. A PIE event will contain a value chosen from an IVR choice. Usually a PIE event wil contain a URL to a callback sever that will receive the choice and be able to parse it. This could result in further SVAML or some other application logic function. Example: ```"https://your-application-server-host/application"``` */ pie?: string; } - - diff --git a/packages/voice/src/models/v1/destination/destination.ts b/packages/voice/src/models/v1/destination/destination.ts index 498f03af..27000138 100644 --- a/packages/voice/src/models/v1/destination/destination.ts +++ b/packages/voice/src/models/v1/destination/destination.ts @@ -1,21 +1,10 @@ -/** - * Model: Destination - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * The type of device and number or endpoint to call. */ export interface Destination { /** Can be of type `number` for PSTN endpoints or of type `username` for data endpoints. */ - type: TypeEnum; + type: 'number' | 'username'; /** If the type is `number` the value of the endpoint is a phone number. If the type is `username` the value is the username for a data endpoint. */ endpoint: string; } - -export type TypeEnum = 'number' | 'username'; - diff --git a/packages/voice/src/models/v1/dice-request-debit/dice-request-debit.ts b/packages/voice/src/models/v1/dice-request-debit/dice-request-debit.ts deleted file mode 100644 index f80a87de..00000000 --- a/packages/voice/src/models/v1/dice-request-debit/dice-request-debit.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: DiceRequestDebit - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * An object containing currency and total amount charged for the call. - */ -export interface DiceRequestDebit { - - /** The currency ID of the rate, for example, `USD`. */ - currencyId?: string; - /** The total amount debited for the call. */ - amount?: number; -} - - diff --git a/packages/voice/src/models/v1/dice-request-debit/index.ts b/packages/voice/src/models/v1/dice-request-debit/index.ts deleted file mode 100644 index 9c1de520..00000000 --- a/packages/voice/src/models/v1/dice-request-debit/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { DiceRequestDebit } from './dice-request-debit'; diff --git a/packages/voice/src/models/v1/dice-request-user-rate/dice-request-user-rate.ts b/packages/voice/src/models/v1/dice-request-user-rate/dice-request-user-rate.ts deleted file mode 100644 index 01fd42b2..00000000 --- a/packages/voice/src/models/v1/dice-request-user-rate/dice-request-user-rate.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: DiceRequestUserRate - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * An object containing currency and rate per minute for the call. - */ -export interface DiceRequestUserRate { - - /** The currency in which the call is charged. */ - currencyId?: string; - /** The rate per minute that was charged for the call. */ - amount?: number; -} - - diff --git a/packages/voice/src/models/v1/dice-request-user-rate/index.ts b/packages/voice/src/models/v1/dice-request-user-rate/index.ts deleted file mode 100644 index efc97b50..00000000 --- a/packages/voice/src/models/v1/dice-request-user-rate/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { DiceRequestUserRate } from './dice-request-user-rate'; diff --git a/packages/voice/src/models/v1/enums.ts b/packages/voice/src/models/v1/enums.ts index c3dd6a3a..fb313e83 100644 --- a/packages/voice/src/models/v1/enums.ts +++ b/packages/voice/src/models/v1/enums.ts @@ -1,33 +1,3 @@ -export type { - MethodEnum as CalloutRequestMethodEnum, -} from './callout-request/callout-request'; -export type { - TypeEnum as DestinationTypeEnum, -} from './destination/destination'; -export type { - DomainEnum as GetCallResponseObjDomainEnum, - StatusEnum as GetCallResponseObjStatusEnum, -} from './get-call-response-obj/get-call-response-obj'; -export type { - CapabilityEnum as GetNumbersResponseObjNumbersInnerCapabilityEnum, -} from './get-numbers-response-obj-numbers-inner/get-numbers-response-obj-numbers-inner'; -export type { - NumberTypeEnum as GetQueryNumberNumberItemNumberTypeEnum, -} from './get-query-number-number-item/get-query-number-number-item'; -export type { - DomainEnum as TtsCalloutRequestDomainEnum, -} from './tts-callout-request/tts-callout-request'; -export type { - CapabilityEnum as UnassignNumbersCapabilityEnum, -} from './unassign-numbers/unassign-numbers'; -export type { - CapabilityEnum as UpdateNumbersCapabilityEnum, -} from './assign-numbers/assign-numbers'; -export type { - CommandEnum as ManageConferenceParticipantRequestCommandEnum, - MohEnum as ManageConferenceParticipantRequestMohEnum, -} from './manage-conference-participant-request/manage-conference-participant-request'; - export type ResultEnum = 'N/A' | 'ANSWERED' | 'BUSY' | 'NOANSWER' | 'FAILED'; export type ReasonEnum = 'N/A' diff --git a/packages/voice/src/models/v1/get-call-response-obj/get-call-response-obj.ts b/packages/voice/src/models/v1/get-call-response-obj/get-call-response-obj.ts deleted file mode 100644 index cdba88b9..00000000 --- a/packages/voice/src/models/v1/get-call-response-obj/get-call-response-obj.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Model: GetCallResponseObj - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ -import { ReasonEnum, ResultEnum } from '../enums'; - -export interface GetCallResponseObj { - - /** Contains the caller information. */ - from?: GetCallResponseFrom; - /** Contains the callee information. */ - to?: GetCallResponseTo; - /** Must be `pstn` for PSTN. */ - domain?: DomainEnum; - /** The unique identifier of the call. */ - callId?: string; - /** The duration of the call in seconds. */ - duration?: number; - /** The status of the call. Either `ONGOING` or `FINAL` */ - status?: StatusEnum; - /** Contains the result of a call. */ - result?: ResultEnum; - /** Contains the reason why a call ended. */ - reason?: ReasonEnum; - /** The date and time of the call. */ - timestamp?: Date; - /** An object that can be used to pass custom information related to the call. */ - custom?: string; - /** The rate per minute that was charged for the call. */ - userRate?: GetCallResponseUserRate; - /** The total amount charged for the call. */ - debit?: GetCallResponseDebit; -} - -export interface GetCallResponseTo { - /** The type of the destination. */ - type?: string; - /** The phone number, username, or other identifier of the destination. */ - endpoint?: string; -} - -export interface GetCallResponseFrom { - /** The type of the destination. */ - type?: string; - /** The phone number, username, or other identifier of the destination. */ - endpoint?: string; -} - -export interface GetCallResponseUserRate { - /** The currency in which the call is charged. */ - currencyId?: string; - /** The rate per minute that was charged for the call. */ - amount?: number; -} - -export interface GetCallResponseDebit { - /** The currency ID of the rate, for example, `USD`. */ - currencyId?: string; - /** The total amount debited for the call. */ - amount?: number; -} - -export type DomainEnum = 'pstn'; -export type StatusEnum = 'ONGOING' | 'FINAL'; diff --git a/packages/voice/src/models/v1/get-call-response-obj/index.ts b/packages/voice/src/models/v1/get-call-response-obj/index.ts deleted file mode 100644 index 281421db..00000000 --- a/packages/voice/src/models/v1/get-call-response-obj/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type { - GetCallResponseObj, - GetCallResponseFrom, - GetCallResponseTo, - GetCallResponseUserRate, - GetCallResponseDebit, -} from './get-call-response-obj'; diff --git a/packages/voice/src/models/v1/get-callbacks-url/get-callbacks-url.ts b/packages/voice/src/models/v1/get-callbacks-url/get-callbacks-url.ts deleted file mode 100644 index b626dba3..00000000 --- a/packages/voice/src/models/v1/get-callbacks-url/get-callbacks-url.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: GetCallbacksUrl - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * Gets primary and if configured fallback callback URLs - */ -export interface GetCallbacksUrl { - - /** Your primary callback URL */ - primary?: string; - /** Your fallback callback URL (returned if configured). It is used only if Sinch platform gets a timeout or error from your primary callback URL. */ - fallback?: string; -} - - diff --git a/packages/voice/src/models/v1/get-callbacks-url/index.ts b/packages/voice/src/models/v1/get-callbacks-url/index.ts deleted file mode 100644 index 0b028827..00000000 --- a/packages/voice/src/models/v1/get-callbacks-url/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetCallbacksUrl } from './get-callbacks-url'; diff --git a/packages/voice/src/models/v1/get-callbacks/get-callbacks.ts b/packages/voice/src/models/v1/get-callbacks/get-callbacks.ts index 45bc51df..35e3a565 100644 --- a/packages/voice/src/models/v1/get-callbacks/get-callbacks.ts +++ b/packages/voice/src/models/v1/get-callbacks/get-callbacks.ts @@ -1,16 +1,13 @@ -/** - * Model: GetCallbacks - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { GetCallbacksUrl } from '../get-callbacks-url'; - export interface GetCallbacks { - /** @see GetCallbacksUrl */ + /** Gets primary and if configured fallback callback URLs */ url?: GetCallbacksUrl; } +export interface GetCallbacksUrl { + /** Your primary callback URL */ + primary?: string; + /** Your fallback callback URL (returned if configured). It is used only if Sinch platform gets a timeout or error from your primary callback URL. */ + fallback?: string; +} diff --git a/packages/voice/src/models/v1/get-callbacks/index.ts b/packages/voice/src/models/v1/get-callbacks/index.ts index 746f7acc..99f42124 100644 --- a/packages/voice/src/models/v1/get-callbacks/index.ts +++ b/packages/voice/src/models/v1/get-callbacks/index.ts @@ -1 +1 @@ -export type { GetCallbacks } from './get-callbacks'; +export type { GetCallbacks, GetCallbacksUrl } from './get-callbacks'; diff --git a/packages/voice/src/models/v1/get-callout-response-obj/get-callout-response-obj.ts b/packages/voice/src/models/v1/get-callout-response-obj/get-callout-response-obj.ts deleted file mode 100644 index 2f3d5a6a..00000000 --- a/packages/voice/src/models/v1/get-callout-response-obj/get-callout-response-obj.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Model: GetCalloutResponseObj - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * The returned call ID. - */ -export interface GetCalloutResponseObj { - - /** The returned call identifier. */ - callId?: string; -} - - diff --git a/packages/voice/src/models/v1/get-callout-response-obj/index.ts b/packages/voice/src/models/v1/get-callout-response-obj/index.ts deleted file mode 100644 index ecfec137..00000000 --- a/packages/voice/src/models/v1/get-callout-response-obj/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetCalloutResponseObj } from './get-callout-response-obj'; diff --git a/packages/voice/src/models/v1/get-conference-info-response-participants-inner/get-conference-info-response-participants-inner.ts b/packages/voice/src/models/v1/get-conference-info-response-participants-inner/get-conference-info-response-participants-inner.ts deleted file mode 100644 index a406af88..00000000 --- a/packages/voice/src/models/v1/get-conference-info-response-participants-inner/get-conference-info-response-participants-inner.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Model: GetConferenceInfoResponseParticipantsInner - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -export interface GetConferenceInfoResponseParticipantsInner { - - /** The phone number of the PSTN participant that was connected in the conference, or whatever was passed as CLI for data originated/terminated calls. */ - cli?: string; - /** The callId of the call leg that the participant joined the conference. */ - id?: string; - /** The number of seconds that the participant has been connected to the conference. */ - duration?: number; - muted?: boolean; - onhold?: boolean; -} - - diff --git a/packages/voice/src/models/v1/get-conference-info-response-participants-inner/index.ts b/packages/voice/src/models/v1/get-conference-info-response-participants-inner/index.ts deleted file mode 100644 index fd4fc704..00000000 --- a/packages/voice/src/models/v1/get-conference-info-response-participants-inner/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetConferenceInfoResponseParticipantsInner } from './get-conference-info-response-participants-inner'; diff --git a/packages/voice/src/models/v1/get-conference-info-response/get-conference-info-response.ts b/packages/voice/src/models/v1/get-conference-info-response/get-conference-info-response.ts index 4a9a42f1..a48eb051 100644 --- a/packages/voice/src/models/v1/get-conference-info-response/get-conference-info-response.ts +++ b/packages/voice/src/models/v1/get-conference-info-response/get-conference-info-response.ts @@ -1,19 +1,20 @@ -/** - * Model: GetConferenceInfoResponse - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { GetConferenceInfoResponseParticipantsInner } from '../get-conference-info-response-participants-inner'; - /** * The response returns information about the participants in the conference. */ export interface GetConferenceInfoResponse { /** List of GetConferenceInfoResponseParticipantsInners */ - participants?: GetConferenceInfoResponseParticipantsInner[]; + participants?: ParticipantDetails[]; } +export interface ParticipantDetails { + /** The phone number of the PSTN participant that was connected in the conference, or whatever was passed as CLI for data originated/terminated calls. */ + cli?: string; + /** The callId of the call leg that the participant joined the conference. */ + id?: string; + /** The number of seconds that the participant has been connected to the conference. */ + duration?: number; + muted?: boolean; + onhold?: boolean; +} diff --git a/packages/voice/src/models/v1/get-conference-info-response/index.ts b/packages/voice/src/models/v1/get-conference-info-response/index.ts index 41a8a82f..b856291b 100644 --- a/packages/voice/src/models/v1/get-conference-info-response/index.ts +++ b/packages/voice/src/models/v1/get-conference-info-response/index.ts @@ -1 +1 @@ -export type { GetConferenceInfoResponse } from './get-conference-info-response'; +export type { GetConferenceInfoResponse, ParticipantDetails } from './get-conference-info-response'; diff --git a/packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/index.ts b/packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/index.ts deleted file mode 100644 index da3de84f..00000000 --- a/packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetNumbersResponseObjNumbersInner } from './get-numbers-response-obj-numbers-inner'; diff --git a/packages/voice/src/models/v1/get-numbers-response-obj/get-numbers-response-obj.ts b/packages/voice/src/models/v1/get-numbers-response-obj/get-numbers-response-obj.ts deleted file mode 100644 index 516d2ba8..00000000 --- a/packages/voice/src/models/v1/get-numbers-response-obj/get-numbers-response-obj.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Model: GetNumbersResponseObj - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { GetNumbersResponseObjNumbersInner } from '../get-numbers-response-obj-numbers-inner'; - -export interface GetNumbersResponseObj { - - /** The object type. Will always be list of numbers, associated application keys and capabilities */ - numbers?: GetNumbersResponseObjNumbersInner[]; -} - - diff --git a/packages/voice/src/models/v1/get-numbers-response-obj/index.ts b/packages/voice/src/models/v1/get-numbers-response-obj/index.ts deleted file mode 100644 index 8cd685b8..00000000 --- a/packages/voice/src/models/v1/get-numbers-response-obj/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetNumbersResponseObj } from './get-numbers-response-obj'; diff --git a/packages/voice/src/models/v1/get-query-number-number-item-rate/get-query-number-number-item-rate.ts b/packages/voice/src/models/v1/get-query-number-number-item-rate/get-query-number-number-item-rate.ts deleted file mode 100644 index 4e09ed2c..00000000 --- a/packages/voice/src/models/v1/get-query-number-number-item-rate/get-query-number-number-item-rate.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: GetQueryNumberNumberItemRate - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * The cost per minute to call the destination number. - */ -export interface GetQueryNumberNumberItemRate { - - /** The currency ID of the rate, for example, `USD`. */ - currencyId?: string; - /** The amount. */ - amount?: number; -} - - diff --git a/packages/voice/src/models/v1/get-query-number-number-item-rate/index.ts b/packages/voice/src/models/v1/get-query-number-number-item-rate/index.ts deleted file mode 100644 index 95eea515..00000000 --- a/packages/voice/src/models/v1/get-query-number-number-item-rate/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetQueryNumberNumberItemRate } from './get-query-number-number-item-rate'; diff --git a/packages/voice/src/models/v1/get-query-number-number-item/get-query-number-number-item.ts b/packages/voice/src/models/v1/get-query-number-number-item/get-query-number-number-item.ts deleted file mode 100644 index b5608adb..00000000 --- a/packages/voice/src/models/v1/get-query-number-number-item/get-query-number-number-item.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Model: GetQueryNumberNumberItem - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { GetQueryNumberNumberItemRate } from '../get-query-number-number-item-rate'; - -/** - * The number item object. - */ -export interface GetQueryNumberNumberItem { - - /** The ISO 3166-1 formatted country code. */ - countryId?: string; - /** The type of the number. */ - numberType?: NumberTypeEnum; - /** The number in E.164 format. */ - normalizedNumber?: string; - /** Concerns whether the call is restricted or not. */ - restricted?: boolean; - /** @see GetQueryNumberNumberItemRate */ - rate?: GetQueryNumberNumberItemRate; -} - -export type NumberTypeEnum = 'Unknown' | 'Fixed' | 'Mobile' | 'Other'; - diff --git a/packages/voice/src/models/v1/get-query-number-number-item/index.ts b/packages/voice/src/models/v1/get-query-number-number-item/index.ts deleted file mode 100644 index 109ee456..00000000 --- a/packages/voice/src/models/v1/get-query-number-number-item/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetQueryNumberNumberItem } from './get-query-number-number-item'; diff --git a/packages/voice/src/models/v1/get-query-number/get-query-number.ts b/packages/voice/src/models/v1/get-query-number/get-query-number.ts deleted file mode 100644 index 5750d84d..00000000 --- a/packages/voice/src/models/v1/get-query-number/get-query-number.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Model: GetQueryNumber - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { GetQueryNumberNumberItem } from '../get-query-number-number-item'; - -export interface GetQueryNumber { - - /** The type of method. */ - method?: string; - /** @see GetQueryNumberNumberItem */ - number?: GetQueryNumberNumberItem; -} - - diff --git a/packages/voice/src/models/v1/get-query-number/index.ts b/packages/voice/src/models/v1/get-query-number/index.ts deleted file mode 100644 index b4b9b5a4..00000000 --- a/packages/voice/src/models/v1/get-query-number/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetQueryNumber } from './get-query-number'; diff --git a/packages/voice/src/models/v1/get-recording-file-info/get-recording-file-info.ts b/packages/voice/src/models/v1/get-recording-file-info/get-recording-file-info.ts deleted file mode 100644 index 903a2984..00000000 --- a/packages/voice/src/models/v1/get-recording-file-info/get-recording-file-info.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Model: GetRecordingFileInfo - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -export interface GetRecordingFileInfo { - - key?: string; - url?: string; - createdOn?: Date; - expiresOn?: Date; - headers?: object; -} - - diff --git a/packages/voice/src/models/v1/get-recording-file-info/index.ts b/packages/voice/src/models/v1/get-recording-file-info/index.ts deleted file mode 100644 index 9f1e7dac..00000000 --- a/packages/voice/src/models/v1/get-recording-file-info/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { GetRecordingFileInfo } from './get-recording-file-info'; diff --git a/packages/voice/src/models/v1/ice-request-to/ice-request-to.ts b/packages/voice/src/models/v1/ice-request-to/ice-request-to.ts deleted file mode 100644 index 223ec843..00000000 --- a/packages/voice/src/models/v1/ice-request-to/ice-request-to.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: IceRequestTo - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * An object containing information about the recipient of the call. - */ -export interface IceRequestTo { - - /** The type of the destination. */ - type?: string; - /** The phone number, user name, or other identifier of the destination. */ - endpoint?: string; -} - - diff --git a/packages/voice/src/models/v1/ice-request-to/index.ts b/packages/voice/src/models/v1/ice-request-to/index.ts deleted file mode 100644 index 1b5ac9eb..00000000 --- a/packages/voice/src/models/v1/ice-request-to/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { IceRequestTo } from './ice-request-to'; diff --git a/packages/voice/src/models/v1/ice-request-user-rate/ice-request-user-rate.ts b/packages/voice/src/models/v1/ice-request-user-rate/ice-request-user-rate.ts deleted file mode 100644 index 7c1035d9..00000000 --- a/packages/voice/src/models/v1/ice-request-user-rate/ice-request-user-rate.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: IceRequestUserRate - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * The rate that will be charged for the call established to the original destination. If the SVAML response specifies another destination, the same rate may not apply. - */ -export interface IceRequestUserRate { - - /** The currency ID of the rate, for example, `USD`. */ - currencyId?: string; - /** The amount of the rate. */ - amount?: number; -} - - diff --git a/packages/voice/src/models/v1/ice-request-user-rate/index.ts b/packages/voice/src/models/v1/ice-request-user-rate/index.ts deleted file mode 100644 index 312645fe..00000000 --- a/packages/voice/src/models/v1/ice-request-user-rate/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { IceRequestUserRate } from './ice-request-user-rate'; diff --git a/packages/voice/src/models/v1/ice-response/ice-response.ts b/packages/voice/src/models/v1/ice-response/ice-response.ts deleted file mode 100644 index 3cbafc68..00000000 --- a/packages/voice/src/models/v1/ice-response/ice-response.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { SvamlActionHangup } from '../svaml-action-hangup'; -import { SvamlActionConnectPstn } from '../svaml-action-connect-pstn'; -import { SvamlActionConnectMxp } from '../svaml-action-connect-mxp'; -import { SvamlActionConnectConf } from '../svaml-action-connect-conf'; -import { SvamlActionConnectSip } from '../svaml-action-connect-sip'; -import { SvamlActionRunMenu } from '../svaml-action-run-menu'; -import { SvamlActionPark } from '../svaml-action-park'; -import { SvamlInstructionPlayFiles } from '../svaml-instruction-play-files'; -import { SvamlInstructionSay } from '../svaml-instruction-say'; -import { SvamlInstructionSendDtmf } from '../svaml-instruction-send-dtmf'; -import { SvamlInstructionSetCookie } from '../svaml-instruction-set-cookie'; -import { SvamlInstructionStartRecording } from '../svaml-instruction-start-recording'; -import { SvamlInstructionAnswer } from '../svaml-instruction-answer'; - -export type IceSvamlAction = SvamlActionHangup - | SvamlActionConnectPstn - | SvamlActionConnectMxp - | SvamlActionConnectConf - | SvamlActionConnectSip - | SvamlActionRunMenu - | SvamlActionPark; - -export type IceSvamlInstruction = SvamlInstructionPlayFiles - | SvamlInstructionSay - | SvamlInstructionSendDtmf - | SvamlInstructionSetCookie - | SvamlInstructionStartRecording - | SvamlInstructionAnswer; - -export interface IceResponse { - - /** The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary. */ - instructions?: IceSvamlInstruction[]; - /** @see SvamlAction */ - action?: IceSvamlAction; -} diff --git a/packages/voice/src/models/v1/index.ts b/packages/voice/src/models/v1/index.ts index 62cd8b21..3c3975de 100644 --- a/packages/voice/src/models/v1/index.ts +++ b/packages/voice/src/models/v1/index.ts @@ -1,65 +1,27 @@ -export * from './ace-request'; -export * from './ace-request-amd'; -export * from './ace-response'; export * from './call-header'; -export * from './callout-request'; export * from './conference-callout-request'; -export * from './conference-callout-request-conference-dtmf-options'; +export * from './conference-dtmf-options'; export * from './custom-callout-request'; export * from './destination'; -export * from './dice-request'; -export * from './dice-request-debit'; -export * from './dice-request-user-rate'; +export * from './voice-price'; export * from './voice-error'; -export * from './get-call-response-obj'; +export * from './call-object'; export * from './get-callbacks'; -export * from './get-callbacks-url'; -export * from './get-callout-response-obj'; +export * from './callout-response'; export * from './get-conference-info-response'; -export * from './get-conference-info-response-participants-inner'; -export * from './get-numbers-response-obj'; -export * from './get-numbers-response-obj-numbers-inner'; -export * from './get-query-number'; -export * from './get-query-number-number-item'; -export * from './get-query-number-number-item-rate'; -export * from './get-recording-file-info'; -export * from './ice-request'; -export * from './ice-request-to'; -export * from './ice-request-user-rate'; -export * from './ice-response'; +export * from './list-numbers-response'; +export * from './query-number-response'; +export * from './participant'; export * from './manage-conference-participant-request'; export * from './menu'; -export * from './notify-error-request'; -export * from './notify-request'; export * from './option'; -export * from './pie-request'; -export * from './pie-request-menu-result'; -export * from './pie-response'; export * from './svaml-request-body'; -export * from './svaml-action'; -export * from './svaml-action-connect-conf'; -export * from './svaml-action-connect-conf-conference-dtmf-options'; -export * from './svaml-action-connect-mxp'; -export * from './svaml-action-connect-mxp-destination'; -export * from './svaml-action-connect-pstn'; -export * from './svaml-action-connect-pstn-amd'; -export * from './svaml-action-connect-sip'; -export * from './svaml-action-connect-sip-destination'; -export * from './svaml-action-continue'; -export * from './svaml-action-hangup'; -export * from './svaml-action-park'; -export * from './svaml-action-run-menu'; -export * from './svaml-instruction'; -export * from './svaml-instruction-answer'; -export * from './svaml-instruction-play-files'; -export * from './svaml-instruction-say'; -export * from './svaml-instruction-send-dtmf'; -export * from './svaml-instruction-set-cookie'; -export * from './svaml-instruction-start-recording'; -export * from './svaml-instruction-stop-recording'; export * from './tts-callout-request'; export * from './unassign-numbers'; export * from './update-callbacks'; -export * from './update-callbacks-url'; export * from './assign-numbers'; export * from './enums'; +// Callbacks +export * from './mod-callbacks'; +// SVAML +export * from './mod-svaml'; diff --git a/packages/voice/src/models/v1/list-numbers-response/index.ts b/packages/voice/src/models/v1/list-numbers-response/index.ts new file mode 100644 index 00000000..ec8898e1 --- /dev/null +++ b/packages/voice/src/models/v1/list-numbers-response/index.ts @@ -0,0 +1 @@ +export type { ListNumbersResponse, NumberInformation } from './list-numbers-response'; diff --git a/packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/get-numbers-response-obj-numbers-inner.ts b/packages/voice/src/models/v1/list-numbers-response/list-numbers-response.ts similarity index 63% rename from packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/get-numbers-response-obj-numbers-inner.ts rename to packages/voice/src/models/v1/list-numbers-response/list-numbers-response.ts index 07a3f2d3..553d0282 100644 --- a/packages/voice/src/models/v1/get-numbers-response-obj-numbers-inner/get-numbers-response-obj-numbers-inner.ts +++ b/packages/voice/src/models/v1/list-numbers-response/list-numbers-response.ts @@ -1,20 +1,15 @@ -/** - * Model: GetNumbersResponseObjNumbersInner - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ +export interface ListNumbersResponse { + /** The object type. Will always be list of numbers, associated application keys and capabilities */ + numbers?: NumberInformation[]; +} -export interface GetNumbersResponseObjNumbersInner { +export interface NumberInformation { /** Numbers that you own in E.164 format. */ number?: string; /** Indicates the application where the number(s) will be assigned. If no number is assigned the applicationkey will not be returned. */ applicationkey?: string; /** indicates the DID capability that needs to be assigned to the chosen application. Valid values are 'voice' and 'sms'. Please note that the DID needs to support the selected capability. */ - capability?: CapabilityEnum; + capability?: 'voice' | 'sms'; } - -export type CapabilityEnum = 'voice' | 'sms'; - diff --git a/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts b/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts index 21863be7..8f2cdd19 100644 --- a/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts +++ b/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts @@ -1,28 +1,10 @@ -/** - * Model: ManageConferenceParticipantRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * */ export interface ManageConferenceParticipantRequest { /** Action to apply on conference participant. */ - command: CommandEnum; + command: 'mute' | 'unmute' | 'onhold' | 'resume'; /** Means "music on hold". If this optional parameter is included, plays music to the first participant in a conference while they're alone and waiting for other participants to join. If `moh` isn't specified, the user will only hear silence while alone in the conference. This property is only available to use with the `onhold` command. */ - moh?: MohEnum; + moh?: 'ring' | 'music1' | 'music2' | 'music3'; } - -export type CommandEnum = 'mute' - | 'unmute' - | 'onhold' - | 'resume'; - -export type MohEnum = 'ring' - | 'music1' - | 'music2' - | 'music3'; diff --git a/packages/voice/src/models/v1/menu/menu.ts b/packages/voice/src/models/v1/menu/menu.ts index 9f278288..20759132 100644 --- a/packages/voice/src/models/v1/menu/menu.ts +++ b/packages/voice/src/models/v1/menu/menu.ts @@ -1,10 +1,3 @@ -/** - * Model: Menu - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - import { Option } from '../option'; /** diff --git a/packages/voice/src/models/v1/ace-request/ace-request.ts b/packages/voice/src/models/v1/mod-callbacks/ace-request/ace-request.ts similarity index 53% rename from packages/voice/src/models/v1/ace-request/ace-request.ts rename to packages/voice/src/models/v1/mod-callbacks/ace-request/ace-request.ts index a549a6eb..7170cfa9 100644 --- a/packages/voice/src/models/v1/ace-request/ace-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/ace-request/ace-request.ts @@ -1,12 +1,3 @@ -/** - * Model: AceRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { AceRequestAmd } from '../ace-request-amd'; - /** * The request body of an Answered Call Event. */ @@ -22,10 +13,18 @@ export interface AceRequest { version?: number; /** A string that can be used to pass custom information related to the call. */ custom?: string; - /** @see AceRequestAmd */ - amd?: AceRequestAmd; + /** If [Answering Machine Detection](/docs/voice/api-reference/amd_v2) (AMD) is enabled, this object contains information about whether the call was answered by a machine. */ + amd?: AnsweringMachineDetection; /** The unique application key. You can find it in the Sinch [dashboard](https://dashboard.sinch.com/voice/apps). */ applicationKey?: string; } +export interface AnsweringMachineDetection { + /** The determination by the system of who answered the call. */ + status?: string; + /** The reason that the system used to determine who answered the call. */ + reason?: string; + /** The length of the call. */ + duration?: number; +} diff --git a/packages/voice/src/models/v1/mod-callbacks/ace-request/index.ts b/packages/voice/src/models/v1/mod-callbacks/ace-request/index.ts new file mode 100644 index 00000000..6e0f7b57 --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/ace-request/index.ts @@ -0,0 +1 @@ +export type { AceRequest, AnsweringMachineDetection } from './ace-request'; diff --git a/packages/voice/src/models/v1/mod-callbacks/ace-response/ace-response.ts b/packages/voice/src/models/v1/mod-callbacks/ace-response/ace-response.ts new file mode 100644 index 00000000..ff3e31f8 --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/ace-response/ace-response.ts @@ -0,0 +1,28 @@ +import { + SvamlActionHangup, + SvamlActionConnectConf, + SvamlActionRunMenu, + SvamlActionContinue, + SvamlInstructionPlayFiles, + SvamlInstructionSay, + SvamlInstructionSetCookie, + SvamlInstructionStartRecording, +} from '../../mod-svaml'; + +export type AceSvamlAction = SvamlActionHangup + | SvamlActionContinue + | SvamlActionConnectConf + | SvamlActionRunMenu; + +export type AceSvamlInstruction = SvamlInstructionPlayFiles + | SvamlInstructionSay + | SvamlInstructionSetCookie + | SvamlInstructionStartRecording; + +export interface AceResponse { + + /** The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary. */ + instructions?: AceSvamlInstruction[]; + /** The action that will control the call. Each SVAML object can only include one action. */ + action?: AceSvamlAction; +} diff --git a/packages/voice/src/models/v1/ace-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/ace-response/index.ts similarity index 100% rename from packages/voice/src/models/v1/ace-response/index.ts rename to packages/voice/src/models/v1/mod-callbacks/ace-response/index.ts diff --git a/packages/voice/src/models/v1/dice-request/dice-request.ts b/packages/voice/src/models/v1/mod-callbacks/dice-request/dice-request.ts similarity index 66% rename from packages/voice/src/models/v1/dice-request/dice-request.ts rename to packages/voice/src/models/v1/mod-callbacks/dice-request/dice-request.ts index 72272bc4..a3d7861f 100644 --- a/packages/voice/src/models/v1/dice-request/dice-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/dice-request/dice-request.ts @@ -1,15 +1,7 @@ -/** - * Model: DiceRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { CallHeader } from '../call-header'; -import { DiceRequestDebit } from '../dice-request-debit'; -import { DiceRequestUserRate } from '../dice-request-user-rate'; -import { IceRequestTo } from '../ice-request-to'; -import { ReasonEnum, ResultEnum } from '../enums'; +import { CallHeader } from '../../call-header'; +import { VoicePrice } from '../../voice-price'; +import { Participant } from '../../participant'; +import { ReasonEnum, ResultEnum } from '../../enums'; /** * The request body of a Disconnected Call Event. @@ -30,12 +22,12 @@ export interface DiceRequest { version?: number; /** A string that can be used to pass custom information related to the call. */ custom?: string; - /** @see DiceRequestDebit */ - debit?: DiceRequestDebit; - /** @see DiceRequestUserRate */ - userRate?: DiceRequestUserRate; - /** @see IceRequestTo */ - to?: IceRequestTo; + /** An object containing currency and total amount charged for the call. */ + debit?: VoicePrice; + /** An object containing currency and rate per minute for the call. */ + userRate?: VoicePrice; + /** @see Participant */ + to?: Participant; /** The duration of the call in seconds. */ duration?: number; /** Information about the initiator of the call. */ diff --git a/packages/voice/src/models/v1/dice-request/index.ts b/packages/voice/src/models/v1/mod-callbacks/dice-request/index.ts similarity index 100% rename from packages/voice/src/models/v1/dice-request/index.ts rename to packages/voice/src/models/v1/mod-callbacks/dice-request/index.ts diff --git a/packages/voice/src/models/v1/ice-request/ice-request.ts b/packages/voice/src/models/v1/mod-callbacks/ice-request/ice-request.ts similarity index 77% rename from packages/voice/src/models/v1/ice-request/ice-request.ts rename to packages/voice/src/models/v1/mod-callbacks/ice-request/ice-request.ts index 7d30ca5b..c816fbe0 100644 --- a/packages/voice/src/models/v1/ice-request/ice-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/ice-request/ice-request.ts @@ -1,13 +1,6 @@ -/** - * Model: IceRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { CallHeader } from '../call-header'; -import { IceRequestTo } from '../ice-request-to'; -import { IceRequestUserRate } from '../ice-request-user-rate'; +import { CallHeader } from '../../call-header'; +import { Participant } from '../../participant'; +import { VoicePrice } from '../../voice-price'; /** * The request body of an Incoming Call Event. @@ -26,12 +19,12 @@ export interface IceRequest { version?: number; /** A string that can be used to pass custom information related to the call. */ custom?: string; - /** @see IceRequestUserRate */ - userRate?: IceRequestUserRate; + /** The rate that will be charged for the call established to the original destination. If the SVAML response specifies another destination, the same rate may not apply. */ + userRate?: VoicePrice; /** The number that will be displayed to the recipient of the call. To set your own CLI, you may use your verified number or your Dashboard virtual number and add it to the `connectPSTN` SVAML response to the Incoming Call Event request. It must be in [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. */ cli?: string; - /** @see IceRequestTo */ - to?: IceRequestTo; + /** An object containing information about the recipient of the call. */ + to?: Participant; /** The domain destination of the incoming call. */ domain?: string; /** The unique application key. You can find it in the Sinch [dashboard](https://dashboard.sinch.com/voice/apps). */ diff --git a/packages/voice/src/models/v1/ice-request/index.ts b/packages/voice/src/models/v1/mod-callbacks/ice-request/index.ts similarity index 100% rename from packages/voice/src/models/v1/ice-request/index.ts rename to packages/voice/src/models/v1/mod-callbacks/ice-request/index.ts diff --git a/packages/voice/src/models/v1/mod-callbacks/ice-response/ice-response.ts b/packages/voice/src/models/v1/mod-callbacks/ice-response/ice-response.ts new file mode 100644 index 00000000..3915d7eb --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/ice-response/ice-response.ts @@ -0,0 +1,38 @@ +import { + SvamlActionHangup, + SvamlActionConnectPstn, + SvamlActionConnectMxp, + SvamlActionConnectConf, + SvamlActionConnectSip, + SvamlActionRunMenu, + SvamlActionPark, + SvamlInstructionPlayFiles, + SvamlInstructionSay, + SvamlInstructionSendDtmf, + SvamlInstructionSetCookie, + SvamlInstructionStartRecording, + SvamlInstructionAnswer, +} from '../../mod-svaml'; + +export type IceSvamlAction = SvamlActionHangup + | SvamlActionConnectPstn + | SvamlActionConnectMxp + | SvamlActionConnectConf + | SvamlActionConnectSip + | SvamlActionRunMenu + | SvamlActionPark; + +export type IceSvamlInstruction = SvamlInstructionPlayFiles + | SvamlInstructionSay + | SvamlInstructionSendDtmf + | SvamlInstructionSetCookie + | SvamlInstructionStartRecording + | SvamlInstructionAnswer; + +export interface IceResponse { + + /** The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary. */ + instructions?: IceSvamlInstruction[]; + /** The action that will control the call. Each SVAML object can only include one action. */ + action?: IceSvamlAction; +} diff --git a/packages/voice/src/models/v1/ice-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/ice-response/index.ts similarity index 100% rename from packages/voice/src/models/v1/ice-response/index.ts rename to packages/voice/src/models/v1/mod-callbacks/ice-response/index.ts diff --git a/packages/voice/src/models/v1/mod-callbacks/index.ts b/packages/voice/src/models/v1/mod-callbacks/index.ts new file mode 100644 index 00000000..2a000d80 --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/index.ts @@ -0,0 +1,9 @@ +export * from './ace-request'; +export * from './ace-response'; +export * from './dice-request'; +export * from './ice-request'; +export * from './ice-response'; +export * from './notify-error-request'; +export * from './notify-request'; +export * from './pie-request'; +export * from './pie-response'; diff --git a/packages/voice/src/models/v1/notify-error-request/index.ts b/packages/voice/src/models/v1/mod-callbacks/notify-error-request/index.ts similarity index 100% rename from packages/voice/src/models/v1/notify-error-request/index.ts rename to packages/voice/src/models/v1/mod-callbacks/notify-error-request/index.ts diff --git a/packages/voice/src/models/v1/notify-error-request/notify-error-request.ts b/packages/voice/src/models/v1/mod-callbacks/notify-error-request/notify-error-request.ts similarity index 86% rename from packages/voice/src/models/v1/notify-error-request/notify-error-request.ts rename to packages/voice/src/models/v1/mod-callbacks/notify-error-request/notify-error-request.ts index cb535f0f..9b4c01a6 100644 --- a/packages/voice/src/models/v1/notify-error-request/notify-error-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/notify-error-request/notify-error-request.ts @@ -1,11 +1,3 @@ -/** - * Model: NotifyErrorRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * The request body of Notify Event notifying of an error. */ @@ -28,5 +20,3 @@ export interface NotifyErrorRequest { /** An optional parameter containing notification-specific information. */ custom?: string; } - - diff --git a/packages/voice/src/models/v1/notify-request/index.ts b/packages/voice/src/models/v1/mod-callbacks/notify-request/index.ts similarity index 100% rename from packages/voice/src/models/v1/notify-request/index.ts rename to packages/voice/src/models/v1/mod-callbacks/notify-request/index.ts diff --git a/packages/voice/src/models/v1/notify-request/notify-request.ts b/packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts similarity index 71% rename from packages/voice/src/models/v1/notify-request/notify-request.ts rename to packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts index 9a70d956..21123dfd 100644 --- a/packages/voice/src/models/v1/notify-request/notify-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts @@ -1,11 +1,3 @@ -/** - * Model: NotifyRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * The request body of a Notify Event. */ @@ -15,12 +7,12 @@ export interface NotifyRequest { event?: 'notify'; /** The unique ID assigned to this call. */ callid?: string; + /** The unique ID assigned to this conference. */ + conferenceId?: string; /** The current API version. */ version?: number; /** The type of information communicated in the notification. */ - type?: string; + type?: 'recording_finished' | 'recording_available' | 'transcription_available' | string; /** An optional parameter containing notification-specific information. */ custom?: string; } - - diff --git a/packages/voice/src/models/v1/mod-callbacks/pie-request/index.ts b/packages/voice/src/models/v1/mod-callbacks/pie-request/index.ts new file mode 100644 index 00000000..12e1bc6f --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/pie-request/index.ts @@ -0,0 +1 @@ +export type { PieRequest, MenuResult } from './pie-request'; diff --git a/packages/voice/src/models/v1/pie-request/pie-request.ts b/packages/voice/src/models/v1/mod-callbacks/pie-request/pie-request.ts similarity index 57% rename from packages/voice/src/models/v1/pie-request/pie-request.ts rename to packages/voice/src/models/v1/mod-callbacks/pie-request/pie-request.ts index 9fc05d06..6e5e40b5 100644 --- a/packages/voice/src/models/v1/pie-request/pie-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/pie-request/pie-request.ts @@ -1,12 +1,3 @@ -/** - * Model: PieRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { PieRequestMenuResult } from '../pie-request-menu-result'; - /** * The request body of a Prompt Input Event. */ @@ -18,8 +9,8 @@ export interface PieRequest { callid?: string; /** The timestamp in UTC format. */ timestamp?: Date; - /** @see PieRequestMenuResult */ - menuResult?: PieRequestMenuResult; + /** An object containing information about the returned menu result. */ + menuResult?: MenuResult; /** The current API version. */ version?: number; /** A string that can be used to pass custom information related to the call. */ @@ -28,4 +19,14 @@ export interface PieRequest { applicationKey?: string; } +export interface MenuResult { + /** The ID of the menu that triggered the prompt input event. */ + menuId?: string; + /** The type of information that's returned. */ + type?: string; + /** The value of the returned information. */ + value?: string; + /** The type of input received. */ + inputMethod?: string; +} diff --git a/packages/voice/src/models/v1/pie-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/pie-response/index.ts similarity index 100% rename from packages/voice/src/models/v1/pie-response/index.ts rename to packages/voice/src/models/v1/mod-callbacks/pie-response/index.ts diff --git a/packages/voice/src/models/v1/mod-callbacks/pie-response/pie-response.ts b/packages/voice/src/models/v1/mod-callbacks/pie-response/pie-response.ts new file mode 100644 index 00000000..7cf372ae --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/pie-response/pie-response.ts @@ -0,0 +1,37 @@ +import { + SvamlActionHangup, + SvamlActionConnectConf, + SvamlActionRunMenu, + SvamlActionContinue, + SvamlActionConnectSip, + SvamlInstructionPlayFiles, + SvamlInstructionSay, + SvamlInstructionSendDtmf, + SvamlInstructionSetCookie, + SvamlInstructionStartRecording, + SvamlInstructionStopRecording, +} from '../../mod-svaml'; + +export type PieSvamlAction = SvamlActionHangup + | SvamlActionContinue + | SvamlActionConnectConf + | SvamlActionConnectSip + | SvamlActionRunMenu; + +export type PieSvamlInstruction = SvamlInstructionPlayFiles + | SvamlInstructionSay + | SvamlInstructionSendDtmf + | SvamlInstructionSetCookie + | SvamlInstructionStartRecording + | SvamlInstructionStopRecording; + +/** + * PIE callbacks are not available for DATA calls; only PSTN and SIP calls. + */ +export interface PieResponse { + + /** The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary. */ + instructions?: PieSvamlInstruction[]; + /** The action that will control the call. Each SVAML object can only include one action. */ + action?: PieSvamlAction; +} diff --git a/packages/voice/src/models/v1/mod-svaml/index.ts b/packages/voice/src/models/v1/mod-svaml/index.ts new file mode 100644 index 00000000..683db975 --- /dev/null +++ b/packages/voice/src/models/v1/mod-svaml/index.ts @@ -0,0 +1,17 @@ +export * from './svaml-action'; +export * from './svaml-action-connect-conf'; +export * from './svaml-action-connect-mxp'; +export * from './svaml-action-connect-pstn'; +export * from './svaml-action-connect-sip'; +export * from './svaml-action-continue'; +export * from './svaml-action-hangup'; +export * from './svaml-action-park'; +export * from './svaml-action-run-menu'; +export * from './svaml-instruction'; +export * from './svaml-instruction-answer'; +export * from './svaml-instruction-play-files'; +export * from './svaml-instruction-say'; +export * from './svaml-instruction-send-dtmf'; +export * from './svaml-instruction-set-cookie'; +export * from './svaml-instruction-start-recording'; +export * from './svaml-instruction-stop-recording'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-conf/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action-connect-conf/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/index.ts diff --git a/packages/voice/src/models/v1/svaml-action-connect-conf/svaml-action-connect-conf.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts similarity index 66% rename from packages/voice/src/models/v1/svaml-action-connect-conf/svaml-action-connect-conf.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts index b287fcd3..96b52901 100644 --- a/packages/voice/src/models/v1/svaml-action-connect-conf/svaml-action-connect-conf.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts @@ -1,11 +1,4 @@ -/** - * Model: SvamlActionConnectConf - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { SvamlActionConnectConfConferenceDtmfOptions } from '../svaml-action-connect-conf-conference-dtmf-options'; +import { ConferenceDtmfOptions } from '../../conference-dtmf-options'; /** * Connects an incoming call to a conference. Available to use in a response to an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. @@ -16,10 +9,8 @@ export interface SvamlActionConnectConf { name: 'connectConf'; /** The unique identifier of the conference. Shouldn't exceed 64 characters. */ conferenceId: string; - /** @see SvamlActionConnectConfConferenceDtmfOptions */ - conferenceDtmfOptions?: SvamlActionConnectConfConferenceDtmfOptions; + /** Options to control how DTMF signals are used by the participant in the conference. For information on how to use this feature, read more [here](../../conference-dtmf). */ + conferenceDtmfOptions?: ConferenceDtmfOptions; /** Means "music on hold". If this optional parameter is included, plays music to the first participant in a conference while they're alone and waiting for other participants to join. If `moh` isn't specified, the user will only hear silence while alone in the conference. */ moh?: string; } - - diff --git a/packages/voice/src/models/v1/svaml-action-connect-mxp/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action-connect-mxp/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/index.ts diff --git a/packages/voice/src/models/v1/svaml-action-connect-mxp/svaml-action-connect-mxp.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts similarity index 61% rename from packages/voice/src/models/v1/svaml-action-connect-mxp/svaml-action-connect-mxp.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts index f119092d..419c48cb 100644 --- a/packages/voice/src/models/v1/svaml-action-connect-mxp/svaml-action-connect-mxp.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts @@ -1,12 +1,5 @@ -/** - * Model: SvamlActionConnectMxp - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { CallHeader } from '../call-header'; -import { SvamlActionConnectMxpDestination } from '../svaml-action-connect-mxp-destination'; +import { CallHeader } from '../../call-header'; +import { Destination } from '../../destination'; /** * Determines how an application-to-application call is connected. Available to use in a response to an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. @@ -15,8 +8,8 @@ export interface SvamlActionConnectMxp { /** The name property. Must have the value `connectMxp`. */ name: 'connectMxp'; - /** @see SvamlActionConnectMxpDestination */ - destination?: SvamlActionConnectMxpDestination; + /** Allows you to specify or override the final destination of the call. If the final destination of the call is not dialed, this is a required parameter. */ + destination?: Destination; /** An optional parameter that allows you to specify or override call headers provided to the receiving Sinch SDK client. Read more about call headers [here](../../call-headers/). */ callheaders?: CallHeader[]; } diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts new file mode 100644 index 00000000..592ea1f7 --- /dev/null +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts @@ -0,0 +1 @@ +export type { SvamlActionConnectPstn, EnableAmd } from './svaml-action-connect-pstn'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-pstn/svaml-action-connect-pstn.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts similarity index 88% rename from packages/voice/src/models/v1/svaml-action-connect-pstn/svaml-action-connect-pstn.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts index a977b092..0898c34a 100644 --- a/packages/voice/src/models/v1/svaml-action-connect-pstn/svaml-action-connect-pstn.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts @@ -1,12 +1,3 @@ -/** - * Model: SvamlActionConnectPstn - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { SvamlActionConnectPstnAmd } from '../svaml-action-connect-pstn-amd'; - /** * Determines how a PSTN call is connected. Available to use in a response to an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. */ @@ -30,8 +21,13 @@ export interface SvamlActionConnectPstn { dtmf?: string; /** The locale's tone to play while ringing. */ indications?: string; - /** @see SvamlActionConnectPstnAmd */ - amd?: SvamlActionConnectPstnAmd; + /** An optional property used to enable [Answering Machine Detection](/docs/voice/api-reference/amd_v2) (AMD). */ + amd?: EnableAmd; } +export interface EnableAmd { + + /** Sets whether AMD is enabled. */ + enabled?: boolean; +} diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts new file mode 100644 index 00000000..aac71bb4 --- /dev/null +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts @@ -0,0 +1 @@ +export type { SvamlActionConnectSip, SipDestination } from './svaml-action-connect-sip'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-sip/svaml-action-connect-sip.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts similarity index 81% rename from packages/voice/src/models/v1/svaml-action-connect-sip/svaml-action-connect-sip.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts index 0b6baf8d..067e02e5 100644 --- a/packages/voice/src/models/v1/svaml-action-connect-sip/svaml-action-connect-sip.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts @@ -1,12 +1,4 @@ -/** - * Model: SvamlActionConnectSip - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { CallHeader } from '../call-header'; -import { SvamlActionConnectSipDestination } from '../svaml-action-connect-sip-destination'; +import { CallHeader } from '../../call-header'; /** * Determines how to route a call to a SIP server. Available to use in a response to an [Incoming Call Event](../../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. @@ -15,8 +7,8 @@ export interface SvamlActionConnectSip { /** The name property. Must have the value `connectSip`. */ name: 'connectSip'; - /** @see SvamlActionConnectSipDestination */ - destination: SvamlActionConnectSipDestination; + /** Specifies where to route the SIP call. */ + destination: SipDestination; /** The max duration of the call in seconds (max 14400 seconds). If the call is still connected at that time, it will be automatically disconnected. */ maxDuration?: number; /** Used to override the CLI (or caller ID) of the client. The phone number of the person who initiated the call is shown as the CLI. To set your own CLI, you may use your verified number or your Dashboard virtual number. */ @@ -31,4 +23,10 @@ export interface SvamlActionConnectSip { moh?: string; } +export interface SipDestination { + /** The SIP address. */ + endpoint: string; + /** */ + type?: 'Sip' +} diff --git a/packages/voice/src/models/v1/svaml-action-continue/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-continue/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action-continue/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-continue/index.ts diff --git a/packages/voice/src/models/v1/svaml-action-continue/svaml-action-continue.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-continue/svaml-action-continue.ts similarity index 72% rename from packages/voice/src/models/v1/svaml-action-continue/svaml-action-continue.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-continue/svaml-action-continue.ts index c3362b76..9fc369ab 100644 --- a/packages/voice/src/models/v1/svaml-action-continue/svaml-action-continue.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-continue/svaml-action-continue.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlActionContinue - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Continues to set up a call. Available to use in a response to an [Answered Call Event](../../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) callback. */ @@ -14,5 +6,3 @@ export interface SvamlActionContinue { /** The name property. Must have the value `continue`. */ name: 'continue'; } - - diff --git a/packages/voice/src/models/v1/svaml-action-hangup/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-hangup/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action-hangup/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-hangup/index.ts diff --git a/packages/voice/src/models/v1/svaml-action-hangup/svaml-action-hangup.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-hangup/svaml-action-hangup.ts similarity index 79% rename from packages/voice/src/models/v1/svaml-action-hangup/svaml-action-hangup.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-hangup/svaml-action-hangup.ts index 3af2ba90..66f45bbe 100644 --- a/packages/voice/src/models/v1/svaml-action-hangup/svaml-action-hangup.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-hangup/svaml-action-hangup.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlActionHangup - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Hangs up a call. Available to use in a response to an [Incoming Call Event](../../../docs/voice/api-reference/voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback or an [Answered Call Event](../../../docs/voice/api-reference/voice/tag/Callbacks/#tag/Callbacks/operation/ace) callback. */ @@ -14,5 +6,3 @@ export interface SvamlActionHangup { /** The name property. Must have the value `hangup`. */ name: 'hangup'; } - - diff --git a/packages/voice/src/models/v1/svaml-action-park/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action-park/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-park/index.ts diff --git a/packages/voice/src/models/v1/svaml-action-park/svaml-action-park.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts similarity index 92% rename from packages/voice/src/models/v1/svaml-action-park/svaml-action-park.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts index 919aefdb..93cae188 100644 --- a/packages/voice/src/models/v1/svaml-action-park/svaml-action-park.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlActionPark - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Parks the call and places the caller on hold. The caller is placed into a loop, listening to an IVR prompt (either a pre-recorded audio file or generated by text to speech). If the call is unparked, prompts will stop playing immediately. If the max duration is reached, the last prompt will be fully played until the call ends. */ @@ -22,5 +14,3 @@ export interface SvamlActionPark { /** The maximum amount of time in seconds that the `holdPrompt` will be played. */ maxDuration?: number; } - - diff --git a/packages/voice/src/models/v1/svaml-action-run-menu/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action-run-menu/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/index.ts diff --git a/packages/voice/src/models/v1/svaml-action-run-menu/svaml-action-run-menu.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts similarity index 93% rename from packages/voice/src/models/v1/svaml-action-run-menu/svaml-action-run-menu.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts index 53df0eef..1688ff41 100644 --- a/packages/voice/src/models/v1/svaml-action-run-menu/svaml-action-run-menu.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts @@ -1,11 +1,4 @@ -/** - * Model: SvamlActionRunMenu - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { Menu } from '../menu'; +import { Menu } from '../../menu'; /** * Plays an interactive voice response (IVR) menu to the callee. This menu can play pre-recorded files or text-to-speech messages, collect DTMF tones, and trigger the [Prompt Input Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/pie) (PIE) callback towards your backend, notifying you of the actions the callee took. Available to use in a response to an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback or an [Answered Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) callback. Also be used in combination with the [Conferences](/docs/voice/api-reference/voice/tag/Conferences/#tag/Conferences) endpoint of the Voice API. @@ -25,5 +18,3 @@ export interface SvamlActionRunMenu { /** The list of menus available. The menu with the `id` value of `main` will always play first. If no menu has an `id` value of `main`, an error is returned. */ menus?: Menu[]; } - - diff --git a/packages/voice/src/models/v1/svaml-action/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-action/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action/index.ts diff --git a/packages/voice/src/models/v1/svaml-action/svaml-action.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action/svaml-action.ts similarity index 89% rename from packages/voice/src/models/v1/svaml-action/svaml-action.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-action/svaml-action.ts index cf7d6058..6d96a342 100644 --- a/packages/voice/src/models/v1/svaml-action/svaml-action.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action/svaml-action.ts @@ -1,10 +1,3 @@ -/** - * Model: SvamlAction - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - import { SvamlActionConnectConf } from '../svaml-action-connect-conf'; import { SvamlActionConnectMxp } from '../svaml-action-connect-mxp'; import { SvamlActionConnectPstn } from '../svaml-action-connect-pstn'; diff --git a/packages/voice/src/models/v1/svaml-instruction-answer/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-answer/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-answer/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-answer/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-answer/svaml-instruction-answer.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-answer/svaml-instruction-answer.ts similarity index 60% rename from packages/voice/src/models/v1/svaml-instruction-answer/svaml-instruction-answer.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-answer/svaml-instruction-answer.ts index c711f8ec..d204eb9f 100644 --- a/packages/voice/src/models/v1/svaml-instruction-answer/svaml-instruction-answer.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-answer/svaml-instruction-answer.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionAnswer - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Forces the callee to answer the call. */ @@ -14,5 +6,3 @@ export interface SvamlInstructionAnswer { /** The `name` property. Must have the value `answer`. */ name: 'answer'; } - - diff --git a/packages/voice/src/models/v1/svaml-instruction-play-files/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-play-files/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-play-files/svaml-instruction-play-files.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts similarity index 87% rename from packages/voice/src/models/v1/svaml-instruction-play-files/svaml-instruction-play-files.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts index fca14de5..bcc09113 100644 --- a/packages/voice/src/models/v1/svaml-instruction-play-files/svaml-instruction-play-files.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionPlayFiles - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Plays Interactive Voice Response (IVR) files for the supported locale or SSML commands at the Sinch backend. An IVR message is played only on the caller's side. */ @@ -18,5 +10,3 @@ export interface SvamlInstructionPlayFiles { /** If using SSML or TTS, this is a required field. The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../voice-locales). */ locale: string; } - - diff --git a/packages/voice/src/models/v1/svaml-instruction-say/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-say/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-say/svaml-instruction-say.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts similarity index 85% rename from packages/voice/src/models/v1/svaml-instruction-say/svaml-instruction-say.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts index fdd9db85..fd24a5f0 100644 --- a/packages/voice/src/models/v1/svaml-instruction-say/svaml-instruction-say.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionSay - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Plays a synthesized text-to-speech message to the end user. The message is provided in the text field. */ @@ -18,5 +10,3 @@ export interface SvamlInstructionSay { /** The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../voice-locales). */ locale?: string; } - - diff --git a/packages/voice/src/models/v1/svaml-instruction-send-dtmf/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-send-dtmf/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts similarity index 85% rename from packages/voice/src/models/v1/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts index a40eb378..58e6ef23 100644 --- a/packages/voice/src/models/v1/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionSendDtmf - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Plays DTMF tones in the call. */ @@ -16,5 +8,3 @@ export interface SvamlInstructionSendDtmf { /** A string that determines the DTMF tones to play to the callee when the call is picked up. Valid characters are: `0-9`, `#`, and `w`. `w` renders a 500ms pause. For example, the string `ww1234#w#`, plays a 1 second pause, the DTMF tones for `1`, `2`, `3`, `4`, and `#`, followed by a 500ms pause and finally the `#` tone. This is useful if the callout destination requires a conference PIN code or an extension. If there is a calling party, it will hear progress while the DTMF is sent. */ value?: string; } - - diff --git a/packages/voice/src/models/v1/svaml-instruction-set-cookie/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-set-cookie/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts similarity index 73% rename from packages/voice/src/models/v1/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts index 2624f5cc..e34a1e30 100644 --- a/packages/voice/src/models/v1/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionSetCookie - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Creates a cookie for the duration of the call. */ @@ -18,5 +10,3 @@ export interface SvamlInstructionSetCookie { /** The value of the cookie you want to set. */ value?: string; } - - diff --git a/packages/voice/src/models/v1/svaml-instruction-start-recording/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-start-recording/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-start-recording/svaml-instruction-start-recording.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts similarity index 91% rename from packages/voice/src/models/v1/svaml-instruction-start-recording/svaml-instruction-start-recording.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts index d23c8b32..1548ac91 100644 --- a/packages/voice/src/models/v1/svaml-instruction-start-recording/svaml-instruction-start-recording.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionStartRecording - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Starts a recording of the call. */ @@ -31,6 +23,8 @@ export interface StartRecordingOptions { } export interface TranscriptionOptions { + /** Enable / disable the transcription */ enabled?: boolean; + /** The locale of the transcription (e.g.: 'en-US') */ locale?: string; } diff --git a/packages/voice/src/models/v1/svaml-instruction-stop-recording/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-stop-recording/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction-stop-recording/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-stop-recording/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts similarity index 61% rename from packages/voice/src/models/v1/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts index f72424f9..ad14290e 100644 --- a/packages/voice/src/models/v1/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-stop-recording/svaml-instruction-stop-recording.ts @@ -1,11 +1,3 @@ -/** - * Model: SvamlInstructionStopRecording - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * Stops the recording of the call. */ @@ -14,5 +6,3 @@ export interface SvamlInstructionStopRecording { /** The `name` property. Must have the value `stopRecording`. */ name: 'stopRecording'; } - - diff --git a/packages/voice/src/models/v1/svaml-instruction/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction/index.ts similarity index 100% rename from packages/voice/src/models/v1/svaml-instruction/index.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction/index.ts diff --git a/packages/voice/src/models/v1/svaml-instruction/svaml-instruction.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction/svaml-instruction.ts similarity index 90% rename from packages/voice/src/models/v1/svaml-instruction/svaml-instruction.ts rename to packages/voice/src/models/v1/mod-svaml/svaml-instruction/svaml-instruction.ts index 92dd647b..f5f5ec0f 100644 --- a/packages/voice/src/models/v1/svaml-instruction/svaml-instruction.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction/svaml-instruction.ts @@ -1,10 +1,3 @@ -/** - * Model: SvamlInstruction - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - import { SvamlInstructionAnswer } from '../svaml-instruction-answer'; import { SvamlInstructionPlayFiles } from '../svaml-instruction-play-files'; import { SvamlInstructionSay } from '../svaml-instruction-say'; diff --git a/packages/voice/src/models/v1/option/option.ts b/packages/voice/src/models/v1/option/option.ts index e158b7b0..0dd82a7f 100644 --- a/packages/voice/src/models/v1/option/option.ts +++ b/packages/voice/src/models/v1/option/option.ts @@ -1,11 +1,3 @@ -/** - * Model: Option - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - /** * A configured option that the user can trigger to perform an action. */ @@ -16,5 +8,3 @@ export interface Option { /** Determines which action is taken when the DTMF digit is pressed. */ action: string; } - - diff --git a/packages/voice/src/models/v1/participant/index.ts b/packages/voice/src/models/v1/participant/index.ts new file mode 100644 index 00000000..c82a002d --- /dev/null +++ b/packages/voice/src/models/v1/participant/index.ts @@ -0,0 +1 @@ +export type { Participant } from './participant'; diff --git a/packages/voice/src/models/v1/participant/participant.ts b/packages/voice/src/models/v1/participant/participant.ts new file mode 100644 index 00000000..82124509 --- /dev/null +++ b/packages/voice/src/models/v1/participant/participant.ts @@ -0,0 +1,12 @@ +/** + * An object containing information about the participant (caller or callee) of the call. + */ +export interface Participant { + + /** The type of the participant (caller or callee). */ + type?: string; + /** The phone number, user name, or other identifier of the participant (caller or callee). */ + endpoint?: string; +} + + diff --git a/packages/voice/src/models/v1/pie-request-menu-result/index.ts b/packages/voice/src/models/v1/pie-request-menu-result/index.ts deleted file mode 100644 index 8e3dcc75..00000000 --- a/packages/voice/src/models/v1/pie-request-menu-result/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { PieRequestMenuResult } from './pie-request-menu-result'; diff --git a/packages/voice/src/models/v1/pie-request-menu-result/pie-request-menu-result.ts b/packages/voice/src/models/v1/pie-request-menu-result/pie-request-menu-result.ts deleted file mode 100644 index 403897d9..00000000 --- a/packages/voice/src/models/v1/pie-request-menu-result/pie-request-menu-result.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Model: PieRequestMenuResult - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * An object containing information about the returned menu result. - */ -export interface PieRequestMenuResult { - - /** The ID of the menu that triggered the prompt input event. */ - menuId?: string; - /** The type of information that's returned. */ - type?: string; - /** The value of the returned information. */ - value?: string; - /** The type of input received. */ - inputMethod?: string; -} - - diff --git a/packages/voice/src/models/v1/pie-request/index.ts b/packages/voice/src/models/v1/pie-request/index.ts deleted file mode 100644 index fdfecd4d..00000000 --- a/packages/voice/src/models/v1/pie-request/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { PieRequest } from './pie-request'; diff --git a/packages/voice/src/models/v1/pie-response/pie-response.ts b/packages/voice/src/models/v1/pie-response/pie-response.ts deleted file mode 100644 index a0f5d2cd..00000000 --- a/packages/voice/src/models/v1/pie-response/pie-response.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { SvamlActionHangup } from '../svaml-action-hangup'; -import { SvamlActionConnectConf } from '../svaml-action-connect-conf'; -import { SvamlActionRunMenu } from '../svaml-action-run-menu'; -import { SvamlActionContinue } from '../svaml-action-continue'; -import { SvamlActionConnectSip } from '../svaml-action-connect-sip'; -import { SvamlInstructionPlayFiles } from '../svaml-instruction-play-files'; -import { SvamlInstructionSay } from '../svaml-instruction-say'; -import { SvamlInstructionSendDtmf } from '../svaml-instruction-send-dtmf'; -import { SvamlInstructionSetCookie } from '../svaml-instruction-set-cookie'; -import { SvamlInstructionStartRecording } from '../svaml-instruction-start-recording'; -import { SvamlInstructionStopRecording } from '../svaml-instruction-stop-recording'; - -export type PieSvamlAction = SvamlActionHangup - | SvamlActionContinue - | SvamlActionConnectConf - | SvamlActionConnectSip - | SvamlActionRunMenu; - -export type PieSvamlInstruction = SvamlInstructionPlayFiles - | SvamlInstructionSay - | SvamlInstructionSendDtmf - | SvamlInstructionSetCookie - | SvamlInstructionStartRecording - | SvamlInstructionStopRecording; - -export interface PieResponse { - - /** The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary. */ - instructions?: PieSvamlInstruction[]; - /** @see SvamlAction */ - action?: PieSvamlAction; -} diff --git a/packages/voice/src/models/v1/query-number-response/index.ts b/packages/voice/src/models/v1/query-number-response/index.ts new file mode 100644 index 00000000..cb8c7feb --- /dev/null +++ b/packages/voice/src/models/v1/query-number-response/index.ts @@ -0,0 +1 @@ +export type { QueryNumberResponse } from './query-number-response'; diff --git a/packages/voice/src/models/v1/query-number-response/query-number-response.ts b/packages/voice/src/models/v1/query-number-response/query-number-response.ts new file mode 100644 index 00000000..e36d56d9 --- /dev/null +++ b/packages/voice/src/models/v1/query-number-response/query-number-response.ts @@ -0,0 +1,23 @@ +import { VoicePrice } from '../voice-price'; + +export interface QueryNumberResponse { + + /** The type of method. */ + method?: string; + /** The number details object. */ + number?: NumberDetails; +} + +export interface NumberDetails { + + /** The ISO 3166-1 formatted country code. */ + countryId?: string; + /** The type of the number. */ + numberType?: 'Unknown' | 'Fixed' | 'Mobile' | 'Other'; + /** The number in E.164 format. */ + normalizedNumber?: string; + /** Concerns whether the call is restricted or not. */ + restricted?: boolean; + /** The cost per minute to call the destination number. */ + rate?: VoicePrice; +} diff --git a/packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/index.ts b/packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/index.ts deleted file mode 100644 index 85f37c68..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-conf-conference-dtmf-options/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SvamlActionConnectConfConferenceDtmfOptions } from './svaml-action-connect-conf-conference-dtmf-options'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-mxp-destination/index.ts b/packages/voice/src/models/v1/svaml-action-connect-mxp-destination/index.ts deleted file mode 100644 index a5b4c072..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-mxp-destination/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SvamlActionConnectMxpDestination } from './svaml-action-connect-mxp-destination'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-mxp-destination/svaml-action-connect-mxp-destination.ts b/packages/voice/src/models/v1/svaml-action-connect-mxp-destination/svaml-action-connect-mxp-destination.ts deleted file mode 100644 index b15ffce3..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-mxp-destination/svaml-action-connect-mxp-destination.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: SvamlActionConnectMxpDestination - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * Allows you to specify or override the final destination of the call. If the final destination of the call is not dialed, this is a required parameter. - */ -export interface SvamlActionConnectMxpDestination { - - /** The type of the definition. */ - type: string; - /** The phone number or username of the desired call destination. */ - endpoint: string; -} - - diff --git a/packages/voice/src/models/v1/svaml-action-connect-pstn-amd/index.ts b/packages/voice/src/models/v1/svaml-action-connect-pstn-amd/index.ts deleted file mode 100644 index 98538294..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-pstn-amd/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SvamlActionConnectPstnAmd } from './svaml-action-connect-pstn-amd'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-pstn-amd/svaml-action-connect-pstn-amd.ts b/packages/voice/src/models/v1/svaml-action-connect-pstn-amd/svaml-action-connect-pstn-amd.ts deleted file mode 100644 index ab24f2d6..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-pstn-amd/svaml-action-connect-pstn-amd.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Model: SvamlActionConnectPstnAmd - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * An optional property used to enable [Answering Machine Detection](/docs/voice/api-reference/amd_v2) (AMD). - */ -export interface SvamlActionConnectPstnAmd { - - /** Sets whether AMD is enabled. */ - enabled?: boolean; -} - - diff --git a/packages/voice/src/models/v1/svaml-action-connect-pstn/index.ts b/packages/voice/src/models/v1/svaml-action-connect-pstn/index.ts deleted file mode 100644 index 2a0a19dd..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-pstn/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SvamlActionConnectPstn } from './svaml-action-connect-pstn'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-sip-destination/index.ts b/packages/voice/src/models/v1/svaml-action-connect-sip-destination/index.ts deleted file mode 100644 index af4377c0..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-sip-destination/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SvamlActionConnectSipDestination } from './svaml-action-connect-sip-destination'; diff --git a/packages/voice/src/models/v1/svaml-action-connect-sip-destination/svaml-action-connect-sip-destination.ts b/packages/voice/src/models/v1/svaml-action-connect-sip-destination/svaml-action-connect-sip-destination.ts deleted file mode 100644 index ef63a673..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-sip-destination/svaml-action-connect-sip-destination.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Model: SvamlActionConnectSipDestination - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * Specifies where to route the SIP call. - */ -export interface SvamlActionConnectSipDestination { - - /** The SIP address. */ - endpoint: string; -} - - diff --git a/packages/voice/src/models/v1/svaml-action-connect-sip/index.ts b/packages/voice/src/models/v1/svaml-action-connect-sip/index.ts deleted file mode 100644 index ffa2e326..00000000 --- a/packages/voice/src/models/v1/svaml-action-connect-sip/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SvamlActionConnectSip } from './svaml-action-connect-sip'; diff --git a/packages/voice/src/models/v1/svaml-request-body/svaml-request-body.ts b/packages/voice/src/models/v1/svaml-request-body/svaml-request-body.ts index 3c949b45..5da2456b 100644 --- a/packages/voice/src/models/v1/svaml-request-body/svaml-request-body.ts +++ b/packages/voice/src/models/v1/svaml-request-body/svaml-request-body.ts @@ -1,12 +1,4 @@ -/** - * Model: SVAMLRequestBody - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { SvamlAction } from '../svaml-action'; -import { SvamlInstruction } from '../svaml-instruction'; +import { SvamlAction, SvamlInstruction } from '../mod-svaml'; /** * SVAML is a call control markup language. When a server receives a callback event from the Sinch platform, it can respond with a SVAML object to control the voice call. The following is an example of a SVAML object type and its contents. @@ -18,5 +10,3 @@ export interface SVAMLRequestBody { /** @see SvamlAction */ action?: SvamlAction; } - - diff --git a/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts b/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts index fa2b3f16..54ed199a 100644 --- a/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts +++ b/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts @@ -1,10 +1,3 @@ -/** - * Model: TtsCalloutRequest - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - import { Destination } from '../destination'; /** @@ -14,12 +7,12 @@ export interface TtsCalloutRequest { /** The number that will be displayed as the incoming caller. To set your own CLI, you may use your verified number or your Dashboard number. The number must be in [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. */ cli?: string; - /** @see Destination */ + /** The type of device and number or endpoint to call. */ destination: Destination; /** When the destination picks up, this DTMF tones will be played to the callee. Valid characters in the string are "0"-"9", "#", and "w". A "w" will render a 500 ms pause. For example, "ww1234#w#" will render a 1s pause, the DTMF tones "1", "2", "3", "4" and "#" followed by a 0.5s pause and finally the DTMF tone for "#". This can be used if the callout destination for instance require a conference PIN code or an extension to be entered. */ dtmf?: string; /** Can be either `pstn` for PSTN endpoint or `mxp` for data (app or web) clients. */ - domain?: DomainEnum; + domain?: 'pstn' | 'mxp'; /** Can be used to input custom data. */ custom?: string; /** The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../../voice-locales/). */ @@ -35,6 +28,3 @@ export interface TtsCalloutRequest { /** Note: PIE callbacks are not available for DATA Calls; only PSTN and SIP calls. If `enablePie` is set to `true` and the application has a callback URL specified, you will receive a PIE callback after the `runMenu` action executes and after the configured menu timeout has elapsed with no input. If it's set to `false`, no PIE events will be sent to your backend. */ enablePie?: boolean; } - -export type DomainEnum = 'pstn' | 'mxp'; - diff --git a/packages/voice/src/models/v1/unassign-numbers/unassign-numbers.ts b/packages/voice/src/models/v1/unassign-numbers/unassign-numbers.ts index 39183562..a7e3b00e 100644 --- a/packages/voice/src/models/v1/unassign-numbers/unassign-numbers.ts +++ b/packages/voice/src/models/v1/unassign-numbers/unassign-numbers.ts @@ -1,11 +1,3 @@ -/** - * Model: UnassignNumbers - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - export interface UnassignNumbers { /** The phone number in E.164 format (https://en.wikipedia.org/wiki/E.164) */ @@ -13,8 +5,5 @@ export interface UnassignNumbers { /** Indicates the application where the number(s) was assigned. If empty, the application key that is used to sign the request will be used. */ applicationkey?: string; /** (optional) indicates the DID capability that was assigned to the chosen application. Please note that the DID needs to support the selected capability. */ - capability?: CapabilityEnum; + capability?: 'voice' | 'sms'; } - -export type CapabilityEnum = 'voice' | 'sms'; - diff --git a/packages/voice/src/models/v1/update-callbacks-url/index.ts b/packages/voice/src/models/v1/update-callbacks-url/index.ts deleted file mode 100644 index 22c3705c..00000000 --- a/packages/voice/src/models/v1/update-callbacks-url/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { UpdateCallbacksUrl } from './update-callbacks-url'; diff --git a/packages/voice/src/models/v1/update-callbacks-url/update-callbacks-url.ts b/packages/voice/src/models/v1/update-callbacks-url/update-callbacks-url.ts deleted file mode 100644 index 919e8424..00000000 --- a/packages/voice/src/models/v1/update-callbacks-url/update-callbacks-url.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Model: UpdateCallbacksUrl - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - -/** - * Contains primary and or fallback callback URLs - */ -export interface UpdateCallbacksUrl { - - /** Your primary callback URL */ - primary?: string; - /** Your fallback callback URL */ - fallback?: string; -} - - diff --git a/packages/voice/src/models/v1/update-callbacks/index.ts b/packages/voice/src/models/v1/update-callbacks/index.ts index f5a75100..d7dbe6ff 100644 --- a/packages/voice/src/models/v1/update-callbacks/index.ts +++ b/packages/voice/src/models/v1/update-callbacks/index.ts @@ -1 +1 @@ -export type { UpdateCallbacks } from './update-callbacks'; +export type { UpdateCallbacks, CallbacksUrl } from './update-callbacks'; diff --git a/packages/voice/src/models/v1/update-callbacks/update-callbacks.ts b/packages/voice/src/models/v1/update-callbacks/update-callbacks.ts index 00793922..534784ce 100644 --- a/packages/voice/src/models/v1/update-callbacks/update-callbacks.ts +++ b/packages/voice/src/models/v1/update-callbacks/update-callbacks.ts @@ -1,16 +1,16 @@ -/** - * Model: UpdateCallbacks - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - -import { UpdateCallbacksUrl } from '../update-callbacks-url'; - export interface UpdateCallbacks { - /** @see UpdateCallbacksUrl */ - url?: UpdateCallbacksUrl; + /** Contains primary and/or fallback callback URLs */ + url?: CallbacksUrl; } +/** + * Contains primary and or fallback callback URLs + */ +export interface CallbacksUrl { + /** Your primary callback URL */ + primary?: string; + /** Your fallback callback URL */ + fallback?: string; +} diff --git a/packages/voice/src/models/v1/voice-error/voice-error.ts b/packages/voice/src/models/v1/voice-error/voice-error.ts index 9b00b8d0..14c7154a 100644 --- a/packages/voice/src/models/v1/voice-error/voice-error.ts +++ b/packages/voice/src/models/v1/voice-error/voice-error.ts @@ -1,11 +1,3 @@ -/** - * Model: VerificationError - * - * THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. - * - */ - - export interface VoiceError { /** A summary of the HTTP error code and error type. */ @@ -17,5 +9,3 @@ export interface VoiceError { /** If applicable, a reference ID for support to use with diagnosing the error. */ reference?: string; } - - diff --git a/packages/voice/src/models/v1/voice-price/index.ts b/packages/voice/src/models/v1/voice-price/index.ts new file mode 100644 index 00000000..1ad6ae77 --- /dev/null +++ b/packages/voice/src/models/v1/voice-price/index.ts @@ -0,0 +1 @@ +export type { VoicePrice } from './voice-price'; diff --git a/packages/voice/src/models/v1/voice-price/voice-price.ts b/packages/voice/src/models/v1/voice-price/voice-price.ts new file mode 100644 index 00000000..0f846c62 --- /dev/null +++ b/packages/voice/src/models/v1/voice-price/voice-price.ts @@ -0,0 +1,9 @@ +export interface VoicePrice { + + /** The currency ID, for example, `USD`. */ + currencyId?: string; + /** The total amount. */ + amount?: number; +} + + diff --git a/packages/voice/src/rest/v1/applications/applications-api.jest.fixture.ts b/packages/voice/src/rest/v1/applications/applications-api.jest.fixture.ts index f9d12598..af982f32 100644 --- a/packages/voice/src/rest/v1/applications/applications-api.jest.fixture.ts +++ b/packages/voice/src/rest/v1/applications/applications-api.jest.fixture.ts @@ -1,4 +1,4 @@ -import { GetCallbacks, GetNumbersResponseObj, GetQueryNumber } from '../../../models'; +import { GetCallbacks, ListNumbersResponse, QueryNumberResponse } from '../../../models'; import { ApplicationsApi, QueryNumberRequestData, GetCallbackURLsRequestData, GetNumbersRequestData, UnassignNumberRequestData, UpdateCallbackURLsRequestData, AssignNumbersRequestData } from './applications-api'; export class ApplicationsApiFixture implements Partial> { @@ -6,7 +6,7 @@ export class ApplicationsApiFixture implements Partial /** * Fixture associated to function queryNumber */ - public queryNumber: jest.Mock, [QueryNumberRequestData]> = jest.fn(); + public queryNumber: jest.Mock, [QueryNumberRequestData]> = jest.fn(); /** * Fixture associated to function getCallbackURLs */ @@ -14,7 +14,7 @@ export class ApplicationsApiFixture implements Partial /** * Fixture associated to function getNumbers */ - public getNumbers: jest.Mock, [GetNumbersRequestData]> = jest.fn(); + public listNumbers: jest.Mock, [GetNumbersRequestData]> = jest.fn(); /** * Fixture associated to function unassignNumber */ diff --git a/packages/voice/src/rest/v1/applications/applications-api.ts b/packages/voice/src/rest/v1/applications/applications-api.ts index 32cbc8de..f03d84a0 100644 --- a/packages/voice/src/rest/v1/applications/applications-api.ts +++ b/packages/voice/src/rest/v1/applications/applications-api.ts @@ -1,7 +1,7 @@ import { GetCallbacks, - GetNumbersResponseObj, - GetQueryNumber, + ListNumbersResponse, + QueryNumberResponse, UnassignNumbers, UpdateCallbacks, AssignNumbers, @@ -53,7 +53,7 @@ export class ApplicationsApi extends VoiceDomainApi { * Returns information about the requested number. * @param { QueryNumberRequestData } data - The data to provide to the API call. */ - public async queryNumber(data: QueryNumberRequestData): Promise { + public async queryNumber(data: QueryNumberRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -70,7 +70,7 @@ export class ApplicationsApi extends VoiceDomainApi { = await this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, body || undefined, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, @@ -112,7 +112,7 @@ export class ApplicationsApi extends VoiceDomainApi { * Get information about your numbers. It returns a list of numbers that you own, as well as their capability (voice or SMS). For the ones that are assigned to an app, it returns the application key of the app. * @param { GetNumbersRequestData } data - The data to provide to the API call. */ - public async getNumbers(data: GetNumbersRequestData): Promise { + public async listNumbers(data: GetNumbersRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -128,7 +128,7 @@ export class ApplicationsApi extends VoiceDomainApi { = await this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, body || undefined, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, diff --git a/packages/voice/src/rest/v1/callouts/callouts-api.jest.fixture.ts b/packages/voice/src/rest/v1/callouts/callouts-api.jest.fixture.ts index bd3b8460..40990290 100644 --- a/packages/voice/src/rest/v1/callouts/callouts-api.jest.fixture.ts +++ b/packages/voice/src/rest/v1/callouts/callouts-api.jest.fixture.ts @@ -1,4 +1,4 @@ -import { GetCalloutResponseObj } from '../../../models'; +import { CalloutResponse } from '../../../models'; import { CalloutsApi, ConferenceCalloutRequestData, @@ -11,16 +11,16 @@ export class CalloutsApiFixture implements Partial> { /** * Fixture associated to function tts */ - public tts: jest.Mock, [TtsCalloutRequestData]> = jest.fn(); + public tts: jest.Mock, [TtsCalloutRequestData]> = jest.fn(); /** * Fixture associated to function tts */ - public conference: jest.Mock, [ConferenceCalloutRequestData]> = jest.fn(); + public conference: jest.Mock, [ConferenceCalloutRequestData]> = jest.fn(); /** * Fixture associated to function tts */ - public custom: jest.Mock, [CustomCalloutRequestData]> = jest.fn(); + public custom: jest.Mock, [CustomCalloutRequestData]> = jest.fn(); } diff --git a/packages/voice/src/rest/v1/callouts/callouts-api.ts b/packages/voice/src/rest/v1/callouts/callouts-api.ts index 45b3da0c..c043b369 100644 --- a/packages/voice/src/rest/v1/callouts/callouts-api.ts +++ b/packages/voice/src/rest/v1/callouts/callouts-api.ts @@ -1,7 +1,7 @@ import { ConferenceCalloutRequest, CustomCalloutRequest, - GetCalloutResponseObj, + CalloutResponse, TtsCalloutRequest, } from '../../../models'; import { @@ -53,7 +53,7 @@ export class CalloutsApi extends VoiceDomainApi { * Makes a text-to-speech callout to a phone number. * @param { TtsCalloutRequestData } data - The data to provide to the API call. */ - public async tts(data: TtsCalloutRequestData): Promise { + public async tts(data: TtsCalloutRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -68,7 +68,7 @@ export class CalloutsApi extends VoiceDomainApi { const requestOptions = await this.client.prepareOptions(basePathUrl, 'POST', getParams, headers, body, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, @@ -81,7 +81,7 @@ export class CalloutsApi extends VoiceDomainApi { * Makes a conference callout to a phone number. * @param { ConferenceCalloutRequestData } data - The data to provide to the API call. */ - public async conference(data: ConferenceCalloutRequestData): Promise { + public async conference(data: ConferenceCalloutRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -97,7 +97,7 @@ export class CalloutsApi extends VoiceDomainApi { const requestOptions = await this.client.prepareOptions(basePathUrl, 'POST', getParams, headers, body, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, @@ -110,7 +110,7 @@ export class CalloutsApi extends VoiceDomainApi { * Makes a conference callout to a phone number. * @param { CustomCalloutRequestData } data - The data to provide to the API call. */ - public async custom(data: CustomCalloutRequestData): Promise { + public async custom(data: CustomCalloutRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -126,7 +126,7 @@ export class CalloutsApi extends VoiceDomainApi { const requestOptions = await this.client.prepareOptions(basePathUrl, 'POST', getParams, headers, body, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, diff --git a/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts b/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts index 7cbae8c0..1997c665 100644 --- a/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts +++ b/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts @@ -1,4 +1,4 @@ -import { GetCallResponseObj } from '../../../models'; +import { CallObject } from '../../../models'; import { CallsApi, GetCallResultRequestData, ManageWithCallLegRequestData, UpdateCallRequestData } from './calls-api'; export class CallsApiFixture implements Partial> { @@ -6,7 +6,7 @@ export class CallsApiFixture implements Partial> { /** * Fixture associated to function getCallResult */ - public get: jest.Mock, [GetCallResultRequestData]> = jest.fn(); + public get: jest.Mock, [GetCallResultRequestData]> = jest.fn(); /** * Fixture associated to function manageCallWithCallLeg */ diff --git a/packages/voice/src/rest/v1/calls/calls-api.ts b/packages/voice/src/rest/v1/calls/calls-api.ts index 9f1a059e..64aac263 100644 --- a/packages/voice/src/rest/v1/calls/calls-api.ts +++ b/packages/voice/src/rest/v1/calls/calls-api.ts @@ -1,5 +1,5 @@ import { - GetCallResponseObj, + CallObject, SVAMLRequestBody, } from '../../../models'; import { @@ -19,13 +19,13 @@ export interface ManageWithCallLegRequestData { /** Specifies which part of the call will be managed. This option is used only by the `PlayFiles` and `Say` instructions to indicate which channel the sound will be played on. Valid options are `caller`, `callee` or `both`. If not specified, the default value is `caller`.
The `callLeg` identifier is ignored for calls that are part of a conference and calls initiated using the Callout API. */ 'callLeg': CallLegEnum; /** */ - 'svamlRequestBody'?: SVAMLRequestBody; + 'manageWithCallLegRequestBody'?: SVAMLRequestBody; } export interface UpdateCallRequestData { /** The unique identifier of the call. This value is generated by the system. */ 'callId': string; /** */ - 'svamlRequestBody'?: SVAMLRequestBody; + 'updateCallRequestBody'?: SVAMLRequestBody; } export class CallsApi extends VoiceDomainApi { @@ -44,7 +44,7 @@ export class CallsApi extends VoiceDomainApi { * You can retrieve information about an ongoing or completed call using a call ID. You can find the call ID of an ongoing call by viewing the response object from a callout request. You can find the call ID of a completed call by looking at your call logs in your Sinch [Dashboard](https://dashboard.sinch.com/voice/logs). Note: You can only use this method for calls that terminate to PSTN or SIP networks from an In-app call. * @param { GetCallResultRequestData } data - The data to provide to the API call. */ - public async get(data: GetCallResultRequestData): Promise { + public async get(data: GetCallResultRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -60,7 +60,7 @@ export class CallsApi extends VoiceDomainApi { = await this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, body || undefined, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, @@ -81,7 +81,7 @@ export class CallsApi extends VoiceDomainApi { 'Accept': 'application/json', }; - const body: RequestBody = data['svamlRequestBody'] ? JSON.stringify(data['svamlRequestBody']) : '{}'; + const body: RequestBody = data['manageWithCallLegRequestBody'] ? JSON.stringify(data['manageWithCallLegRequestBody']) : '{}'; const path = `/calling/v1/calls/id/${data['callId']}/leg/${data['callLeg']}`; const basePathUrl = this.client.apiClientOptions.basePath + path; @@ -109,7 +109,7 @@ export class CallsApi extends VoiceDomainApi { 'Accept': 'application/json', }; - const body: RequestBody = data['svamlRequestBody'] ? JSON.stringify(data['svamlRequestBody']) : '{}'; + const body: RequestBody = data['updateCallRequestBody'] ? JSON.stringify(data['updateCallRequestBody']) : '{}'; const path = `/calling/v1/calls/id/${data['callId']}`; const basePathUrl = this.client.apiClientOptions.basePath + path; diff --git a/packages/voice/tests/rest/v1/applications/applications-api.test.ts b/packages/voice/tests/rest/v1/applications/applications-api.test.ts index 71d12d30..c278e14e 100644 --- a/packages/voice/tests/rest/v1/applications/applications-api.test.ts +++ b/packages/voice/tests/rest/v1/applications/applications-api.test.ts @@ -5,8 +5,8 @@ import { GetCallbacks, GetCallbackURLsRequestData, GetNumbersRequestData, - GetNumbersResponseObj, - GetQueryNumber, + ListNumbersResponse, + QueryNumberResponse, QueryNumberRequestData, UnassignNumberRequestData, UpdateCallbackURLsRequestData, @@ -31,7 +31,7 @@ describe('ApplicationsApi', () => { const requestData: QueryNumberRequestData = { number: '+14151112223333', }; - const expectedResponse: GetQueryNumber = { + const expectedResponse: QueryNumberResponse = { method: 'numberItem', number: { countryId: 'US', @@ -84,7 +84,7 @@ describe('ApplicationsApi', () => { it('should make a GET request to get information about your numbers', async () => { // Given const requestData: GetNumbersRequestData = {}; - const expectedResponse: GetNumbersResponseObj = { + const expectedResponse: ListNumbersResponse = { numbers: [ { number: '33444555666', @@ -95,13 +95,13 @@ describe('ApplicationsApi', () => { }; // When - fixture.getNumbers.mockResolvedValue(expectedResponse); - applicationsApi.getNumbers = fixture.getNumbers; - const response = await applicationsApi.getNumbers(requestData); + fixture.listNumbers.mockResolvedValue(expectedResponse); + applicationsApi.listNumbers = fixture.listNumbers; + const response = await applicationsApi.listNumbers(requestData); // Then expect(response).toEqual(expectedResponse); - expect(fixture.getNumbers).toHaveBeenCalledWith(requestData); + expect(fixture.listNumbers).toHaveBeenCalledWith(requestData); }); }); diff --git a/packages/voice/tests/rest/v1/callouts/callouts-api.test.ts b/packages/voice/tests/rest/v1/callouts/callouts-api.test.ts index fd185681..744810ec 100644 --- a/packages/voice/tests/rest/v1/callouts/callouts-api.test.ts +++ b/packages/voice/tests/rest/v1/callouts/callouts-api.test.ts @@ -2,7 +2,7 @@ import { ApiClientOptions, SigningRequest } from '@sinch/sdk-client'; import { CalloutsApi, CalloutsApiFixture, ConferenceCalloutRequestData, CustomCalloutRequestData, - GetCalloutResponseObj, + CalloutResponse, TtsCalloutRequestData, } from '../../../../src'; @@ -36,7 +36,7 @@ describe('CalloutsApi', () => { }, }, }; - const expectedResponse: GetCalloutResponseObj = { + const expectedResponse: CalloutResponse = { callId: 'callId', }; @@ -68,7 +68,7 @@ describe('CalloutsApi', () => { }, }, }; - const expectedResponse: GetCalloutResponseObj = { + const expectedResponse: CalloutResponse = { callId: 'callId', }; @@ -98,7 +98,7 @@ describe('CalloutsApi', () => { }, }, }; - const expectedResponse: GetCalloutResponseObj = { + const expectedResponse: CalloutResponse = { callId: 'callId', }; diff --git a/packages/voice/tests/rest/v1/calls/calls-api.test.ts b/packages/voice/tests/rest/v1/calls/calls-api.test.ts index 10ea4871..2940cd37 100644 --- a/packages/voice/tests/rest/v1/calls/calls-api.test.ts +++ b/packages/voice/tests/rest/v1/calls/calls-api.test.ts @@ -2,7 +2,7 @@ import { ApiClientOptions, SigningRequest } from '@sinch/sdk-client'; import { CallsApi, CallsApiFixture, - GetCallResponseObj, + CallObject, GetCallResultRequestData, ManageWithCallLegRequestData, SvamlAction, @@ -32,7 +32,7 @@ describe('CallsApi', () => { const requestData: GetCallResultRequestData = { callId: 'callId', }; - const expectedResponse: GetCallResponseObj = { + const expectedResponse: CallObject = { callId: 'callId', to: { type: 'Number', @@ -79,7 +79,7 @@ describe('CallsApi', () => { const requestData: ManageWithCallLegRequestData = { callId: 'callId', callLeg: 'caller', - svamlRequestBody: { + manageWithCallLegRequestBody: { instructions: [ instruction, ], @@ -110,7 +110,7 @@ describe('CallsApi', () => { } as SvamlActionHangup; const requestData: UpdateCallRequestData = { callId: 'callId', - svamlRequestBody: { + updateCallRequestBody: { instructions: [ instruction, ], From df548c446ed1a43072a1d060aa177ded2b928143 Mon Sep 17 00:00:00 2001 From: Antoine Sein Date: Wed, 21 Feb 2024 15:41:33 +0100 Subject: [PATCH 2/4] Fix linter --- packages/voice/src/rest/v1/calls/calls-api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/voice/src/rest/v1/calls/calls-api.ts b/packages/voice/src/rest/v1/calls/calls-api.ts index 64aac263..10e316b6 100644 --- a/packages/voice/src/rest/v1/calls/calls-api.ts +++ b/packages/voice/src/rest/v1/calls/calls-api.ts @@ -81,7 +81,9 @@ export class CallsApi extends VoiceDomainApi { 'Accept': 'application/json', }; - const body: RequestBody = data['manageWithCallLegRequestBody'] ? JSON.stringify(data['manageWithCallLegRequestBody']) : '{}'; + const body: RequestBody = data['manageWithCallLegRequestBody'] + ? JSON.stringify(data['manageWithCallLegRequestBody']) + : '{}'; const path = `/calling/v1/calls/id/${data['callId']}/leg/${data['callLeg']}`; const basePathUrl = this.client.apiClientOptions.basePath + path; From a4f8d003078401a61019065dbe66cce762d4d311 Mon Sep 17 00:00:00 2001 From: Antoine Sein Date: Thu, 22 Feb 2024 10:46:18 +0100 Subject: [PATCH 3/4] Rename CallObject to GetCallInformation --- packages/voice/src/models/v1/call-object/index.ts | 1 - .../get-call-information.ts} | 2 +- .../voice/src/models/v1/get-call-information/index.ts | 1 + packages/voice/src/models/v1/index.ts | 2 +- .../voice/src/rest/v1/calls/calls-api.jest.fixture.ts | 4 ++-- packages/voice/src/rest/v1/calls/calls-api.ts | 9 ++++----- packages/voice/src/rest/v1/enums.ts | 2 +- packages/voice/tests/rest/v1/calls/calls-api.test.ts | 4 ++-- 8 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 packages/voice/src/models/v1/call-object/index.ts rename packages/voice/src/models/v1/{call-object/call-object.ts => get-call-information/get-call-information.ts} (96%) create mode 100644 packages/voice/src/models/v1/get-call-information/index.ts diff --git a/packages/voice/src/models/v1/call-object/index.ts b/packages/voice/src/models/v1/call-object/index.ts deleted file mode 100644 index ff3384d4..00000000 --- a/packages/voice/src/models/v1/call-object/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { CallObject } from './call-object'; diff --git a/packages/voice/src/models/v1/call-object/call-object.ts b/packages/voice/src/models/v1/get-call-information/get-call-information.ts similarity index 96% rename from packages/voice/src/models/v1/call-object/call-object.ts rename to packages/voice/src/models/v1/get-call-information/get-call-information.ts index 56a94e72..efc6f321 100644 --- a/packages/voice/src/models/v1/call-object/call-object.ts +++ b/packages/voice/src/models/v1/get-call-information/get-call-information.ts @@ -2,7 +2,7 @@ import { ReasonEnum, ResultEnum } from '../enums'; import { VoicePrice } from '../voice-price'; import { Participant } from '../participant'; -export interface CallObject { +export interface GetCallInformation { /** Contains the caller information. */ from?: Participant; diff --git a/packages/voice/src/models/v1/get-call-information/index.ts b/packages/voice/src/models/v1/get-call-information/index.ts new file mode 100644 index 00000000..696c32cb --- /dev/null +++ b/packages/voice/src/models/v1/get-call-information/index.ts @@ -0,0 +1 @@ +export type { GetCallInformation } from './get-call-information'; diff --git a/packages/voice/src/models/v1/index.ts b/packages/voice/src/models/v1/index.ts index 3c3975de..cc370696 100644 --- a/packages/voice/src/models/v1/index.ts +++ b/packages/voice/src/models/v1/index.ts @@ -5,7 +5,7 @@ export * from './custom-callout-request'; export * from './destination'; export * from './voice-price'; export * from './voice-error'; -export * from './call-object'; +export * from './get-call-information'; export * from './get-callbacks'; export * from './callout-response'; export * from './get-conference-info-response'; diff --git a/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts b/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts index 1997c665..b508365b 100644 --- a/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts +++ b/packages/voice/src/rest/v1/calls/calls-api.jest.fixture.ts @@ -1,4 +1,4 @@ -import { CallObject } from '../../../models'; +import { GetCallInformation } from '../../../models'; import { CallsApi, GetCallResultRequestData, ManageWithCallLegRequestData, UpdateCallRequestData } from './calls-api'; export class CallsApiFixture implements Partial> { @@ -6,7 +6,7 @@ export class CallsApiFixture implements Partial> { /** * Fixture associated to function getCallResult */ - public get: jest.Mock, [GetCallResultRequestData]> = jest.fn(); + public get: jest.Mock, [GetCallResultRequestData]> = jest.fn(); /** * Fixture associated to function manageCallWithCallLeg */ diff --git a/packages/voice/src/rest/v1/calls/calls-api.ts b/packages/voice/src/rest/v1/calls/calls-api.ts index 10e316b6..62481697 100644 --- a/packages/voice/src/rest/v1/calls/calls-api.ts +++ b/packages/voice/src/rest/v1/calls/calls-api.ts @@ -1,5 +1,5 @@ import { - CallObject, + GetCallInformation, SVAMLRequestBody, } from '../../../models'; import { @@ -8,7 +8,6 @@ import { } from '@sinch/sdk-client'; import { VoiceDomainApi } from '../voice-domain-api'; -export type CallLegEnum = 'caller' | 'callee' | 'both'; export interface GetCallResultRequestData { /** The unique identifier of the call. This value is generated by the system. */ 'callId': string; @@ -17,7 +16,7 @@ export interface ManageWithCallLegRequestData { /** The unique identifier of the call. This value is generated by the system. */ 'callId': string; /** Specifies which part of the call will be managed. This option is used only by the `PlayFiles` and `Say` instructions to indicate which channel the sound will be played on. Valid options are `caller`, `callee` or `both`. If not specified, the default value is `caller`.
The `callLeg` identifier is ignored for calls that are part of a conference and calls initiated using the Callout API. */ - 'callLeg': CallLegEnum; + 'callLeg': 'caller' | 'callee' | 'both'; /** */ 'manageWithCallLegRequestBody'?: SVAMLRequestBody; } @@ -44,7 +43,7 @@ export class CallsApi extends VoiceDomainApi { * You can retrieve information about an ongoing or completed call using a call ID. You can find the call ID of an ongoing call by viewing the response object from a callout request. You can find the call ID of a completed call by looking at your call logs in your Sinch [Dashboard](https://dashboard.sinch.com/voice/logs). Note: You can only use this method for calls that terminate to PSTN or SIP networks from an In-app call. * @param { GetCallResultRequestData } data - The data to provide to the API call. */ - public async get(data: GetCallResultRequestData): Promise { + public async get(data: GetCallResultRequestData): Promise { this.client = this.getSinchClient(); const getParams = this.client.extractQueryParams(data, [] as never[]); const headers: { [key: string]: string | undefined } = { @@ -60,7 +59,7 @@ export class CallsApi extends VoiceDomainApi { = await this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, body || undefined, path); const url = this.client.prepareUrl(requestOptions.basePath, requestOptions.queryParams); - return this.client.processCall({ + return this.client.processCall({ url, requestOptions, apiName: this.apiName, diff --git a/packages/voice/src/rest/v1/enums.ts b/packages/voice/src/rest/v1/enums.ts index 66b8d858..cb0ff5c3 100644 --- a/packages/voice/src/rest/v1/enums.ts +++ b/packages/voice/src/rest/v1/enums.ts @@ -1 +1 @@ -export type { CallLegEnum } from './calls'; +export {}; diff --git a/packages/voice/tests/rest/v1/calls/calls-api.test.ts b/packages/voice/tests/rest/v1/calls/calls-api.test.ts index 2940cd37..e47dd5dc 100644 --- a/packages/voice/tests/rest/v1/calls/calls-api.test.ts +++ b/packages/voice/tests/rest/v1/calls/calls-api.test.ts @@ -2,7 +2,7 @@ import { ApiClientOptions, SigningRequest } from '@sinch/sdk-client'; import { CallsApi, CallsApiFixture, - CallObject, + GetCallInformation, GetCallResultRequestData, ManageWithCallLegRequestData, SvamlAction, @@ -32,7 +32,7 @@ describe('CallsApi', () => { const requestData: GetCallResultRequestData = { callId: 'callId', }; - const expectedResponse: CallObject = { + const expectedResponse: GetCallInformation = { callId: 'callId', to: { type: 'Number', From e37bea068b15123722ca113120dca3b91e0e8ab0 Mon Sep 17 00:00:00 2001 From: Antoine SEIN <142824551+asein-sinch@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:51:47 +0100 Subject: [PATCH 4/4] DEVEXP-269 (Part 2/2): Add helpers for building SVAML actions and instructions (#25) * DEVEXP-269: Add helpers for building SVAML actions and instructions * Add 'call' function for conference API * Add AMD * Add transcription locale --- examples/simple-examples/package.json | 2 +- .../src/voice/callouts/custom.ts | 41 +- .../simple-examples/src/voice/callouts/tts.ts | 2 +- .../webhooks/src/services/voice.service.ts | 62 +- .../conference-dtmf-options.ts | 2 +- packages/voice/src/models/v1/enums.ts | 58 ++ packages/voice/src/models/v1/helper.ts | 239 ++++++++ packages/voice/src/models/v1/index.ts | 1 + .../manage-conference-participant-request.ts | 4 +- .../v1/mod-callbacks/ace-response/index.ts | 2 +- .../callback-response/callback-response.ts | 4 + .../mod-callbacks/callback-response/index.ts | 1 + .../v1/mod-callbacks/ice-response/index.ts | 2 +- .../src/models/v1/mod-callbacks/index.ts | 1 + .../notify-request/notify-request.ts | 21 +- .../v1/mod-callbacks/pie-response/index.ts | 2 +- .../svaml-action-connect-conf/index.ts | 2 +- .../svaml-action-connect-conf.ts | 5 +- .../svaml-action-connect-mxp/index.ts | 2 +- .../svaml-action-connect-mxp.ts | 4 +- .../svaml-action-connect-pstn/index.ts | 2 +- .../svaml-action-connect-pstn.ts | 9 +- .../svaml-action-connect-sip/index.ts | 2 +- .../svaml-action-connect-sip.ts | 7 +- .../v1/mod-svaml/svaml-action-park/index.ts | 2 +- .../svaml-action-park/svaml-action-park.ts | 6 +- .../mod-svaml/svaml-action-run-menu/index.ts | 2 +- .../svaml-action-run-menu.ts | 5 +- .../svaml-instruction-play-files/index.ts | 2 +- .../svaml-instruction-play-files.ts | 6 +- .../mod-svaml/svaml-instruction-say/index.ts | 2 +- .../svaml-instruction-say.ts | 6 +- .../svaml-instruction-send-dtmf/index.ts | 2 +- .../svaml-instruction-send-dtmf.ts | 2 + .../svaml-instruction-set-cookie/index.ts | 2 +- .../svaml-instruction-set-cookie.ts | 2 + .../index.ts | 1 + .../svaml-instruction-start-recording.ts | 47 +- .../tts-callout-request.ts | 3 +- .../conferences-api.jest.fixture.ts | 6 + .../rest/v1/conferences/conferences-api.ts | 14 + packages/voice/tests/models/v1/helper.test.ts | 529 ++++++++++++++++++ .../v1/conferences/conferences-api.test.ts | 36 +- 43 files changed, 1071 insertions(+), 81 deletions(-) create mode 100644 packages/voice/src/models/v1/helper.ts create mode 100644 packages/voice/src/models/v1/mod-callbacks/callback-response/callback-response.ts create mode 100644 packages/voice/src/models/v1/mod-callbacks/callback-response/index.ts create mode 100644 packages/voice/tests/models/v1/helper.test.ts diff --git a/examples/simple-examples/package.json b/examples/simple-examples/package.json index caa6181b..ab7efb5b 100644 --- a/examples/simple-examples/package.json +++ b/examples/simple-examples/package.json @@ -46,7 +46,7 @@ "conversation:templatev1:delete": "ts-node src/conversation/templates-v1/delete.ts", "conversation:templatev2:create": "ts-node src/conversation/templates-v2/create.ts", "conversation:templatev2:get": "ts-node src/conversation/templates-v2/get.ts", - "conversation:templatev2:list": "ts-node src/conversation/templates-v2/list.ts pretty", + "conversation:templatev2:list": "ts-node src/conversation/templates-v2/list.ts", "conversation:templatev2:listTranslations": "ts-node src/conversation/templates-v2/list-translations.ts pretty", "conversation:templatev2:update": "ts-node src/conversation/templates-v2/update.ts", "conversation:templatev2:delete": "ts-node src/conversation/templates-v2/delete.ts", diff --git a/examples/simple-examples/src/voice/callouts/custom.ts b/examples/simple-examples/src/voice/callouts/custom.ts index 955205eb..9e7e96e9 100644 --- a/examples/simple-examples/src/voice/callouts/custom.ts +++ b/examples/simple-examples/src/voice/callouts/custom.ts @@ -1,11 +1,18 @@ import { getPhoneNumberFromConfig, getPrintFormat, - getRecipientPhoneNumberFromConfig, getVoiceCallBackUrl, + getRecipientPhoneNumberFromConfig, + getVoiceCallBackUrl, initApplicationClient, printFullResponse, } from '../../config'; -import { AceResponse, CustomCalloutRequestData, IceResponse } from '@sinch/sdk-core'; +import { + aceActionHelper, + customCalloutHelper, + CustomCalloutRequestData, + iceActionHelper, + iceInstructionHelper, +} from '@sinch/sdk-core'; (async () => { console.log('*********************'); @@ -26,23 +33,27 @@ import { AceResponse, CustomCalloutRequestData, IceResponse } from '@sinch/sdk-c endpoint: recipientPhoneNumber, }, custom: 'Custom text', - ice: JSON.stringify({ - action: { - name: 'connectPstn', + ice: customCalloutHelper.formatIceResponse( + iceActionHelper.connectPstn({ number: recipientPhoneNumber, cli: callingNumber, - }, - } as IceResponse), - ace: JSON.stringify({ - action: { - name: 'runMenu', + }), + iceInstructionHelper.say('Welcome to Sinch.', 'en-US/male'), + iceInstructionHelper.startRecording({ + destinationUrl: 'To specify', + credentials: 'To specify', + }), + ), + ace: customCalloutHelper.formatAceResponse( + aceActionHelper.runMenu({ locale: 'Kimberly', enableVoice: true, + barge: true, menus: [ { id: 'main', - mainPrompt: '#tts[Welcome to the main menu. Press 1 to confirm order or 4 to cancel]', - repeatPrompt: '#tts[Incorrect value, please try again]', + mainPrompt: '#tts[Welcome to the main menu. Press 1 to confirm order or 2 to cancel]', + repeatPrompt: '#tts[We didn\'t get your input, please try again]', timeoutMills: 5000, options: [ { @@ -50,7 +61,7 @@ import { AceResponse, CustomCalloutRequestData, IceResponse } from '@sinch/sdk-c action: 'menu(confirm)', }, { - dtmf: '4', + dtmf: '2', action: 'return(cancel)', }, ], @@ -61,8 +72,8 @@ import { AceResponse, CustomCalloutRequestData, IceResponse } from '@sinch/sdk-c maxDigits: 4, }, ], - }, - } as AceResponse), + }), + ), pie: callbackUrl, }, }, diff --git a/examples/simple-examples/src/voice/callouts/tts.ts b/examples/simple-examples/src/voice/callouts/tts.ts index fb3adfb9..4d78d28b 100644 --- a/examples/simple-examples/src/voice/callouts/tts.ts +++ b/examples/simple-examples/src/voice/callouts/tts.ts @@ -24,7 +24,7 @@ import { TtsCalloutRequestData, VoiceRegion } from '@sinch/sdk-core'; type: 'number', endpoint: recipientPhoneNumber, }, - locale: 'en-US', + locale: 'en-US/male', text: 'Hello, this is a call from Sinch', }, }, diff --git a/examples/webhooks/src/services/voice.service.ts b/examples/webhooks/src/services/voice.service.ts index c0b76e5f..69424f3d 100644 --- a/examples/webhooks/src/services/voice.service.ts +++ b/examples/webhooks/src/services/voice.service.ts @@ -1,14 +1,20 @@ import { Injectable } from '@nestjs/common'; import { Response } from 'express'; import { + aceActionHelper, + aceInstructionHelper, AceRequest, - AceResponse, + AceSvamletBuilder, DiceRequest, + iceActionHelper, + iceInstructionHelper, IceRequest, - IceResponse, + IceSvamletBuilder, NotifyRequest, + pieActionHelper, + pieInstructionHelper, PieRequest, - PieResponse, + PieSvamletBuilder, VoiceCallback, } from '@sinch/sdk-core'; @@ -40,25 +46,17 @@ export class VoiceService { private handleIceRequest(event: IceRequest, res: Response) { console.log(`ICE request: CLI = ${event.cli} - To = ${event.to.endpoint} (${event.to.type})`) - const iceResponse: IceResponse = { - action: { - name: 'hangup' - }, - instructions: [ - { - name: 'say', - text: 'Thank you for calling Sinch! This call will now end.' - } - ] - }; + const iceResponse = new IceSvamletBuilder() + .setAction(iceActionHelper.hangup()) + .addInstruction(iceInstructionHelper.say('Thank you for calling Sinch! This call will now end.', 'en-US')) + .build(); res.status(200).json(iceResponse); } private handleAceRequest(event: AceRequest, res: Response) { - console.log(`ACE request: Call answered at '${event.timestamp}'`); - const aceResponse: AceResponse = { - action: { - name: 'runMenu', + console.log(`ACE request: Call answered at '${event.timestamp.toISOString()}'`); + const aceResponse = new AceSvamletBuilder() + .setAction(aceActionHelper.runMenu({ barge: true, menus: [ { @@ -81,36 +79,30 @@ export class VoiceService { repeatPrompt: '#tts[Please enter your 4-digit pin.]', repeats: 3, maxDigits: 4 - } - ] - } - }; + }, + ], + })) + .build(); res.status(200).json(aceResponse); } private handleDiceRequest(event: DiceRequest, res: Response) { - console.log(`DICE request: Call disconnected at '${event.timestamp}' with the reason '${event.reason}'.`); + console.log(`DICE request: Call disconnected at '${event.timestamp.toISOString()}' with the reason '${event.reason}'.`); res.status(200).send(); } private handlePieRequest(event: PieRequest, res: Response) { console.log(`PIE request: IVR menu choice: '${event.menuResult?.value}'`); - const pieResponse: PieResponse = { - action: { - name: 'hangup' - }, - instructions: [ - { - name: 'say', - text: 'Thanks for your input. The call will now end.' - } - ] - } + const pieResponse = new PieSvamletBuilder() + .setAction(pieActionHelper.hangup()) + .addInstruction(pieInstructionHelper.say('Thanks for your input. The call will end after some music.')) + .addInstruction(pieInstructionHelper.playFiles(['https://samples-files.com/samples/Audio/mp3/sample-file-4.mp3'])) + .build(); res.status(200).send(pieResponse); } private handleNotifyRequest(event: NotifyRequest, res: Response) { - console.log(`Notification received: "${event.type}"`) + console.log(`Notification received: "${event.type}"`); res.status(200).send(); } } diff --git a/packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts b/packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts index 1d833d8c..1a9cdd2f 100644 --- a/packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts +++ b/packages/voice/src/models/v1/conference-dtmf-options/conference-dtmf-options.ts @@ -4,7 +4,7 @@ export interface ConferenceDtmfOptions { /** Determines what DTMF mode the participant will use in the call. */ - mode?: string; + mode?: 'ignore' | 'forward' | 'detect'; /** The maximum number of accepted digits before sending the collected input via a PIE callback. The default value is `1`. If the value is greater than `1`, the PIE callback is triggered by one of the three following events: - No additional digit is entered before the `timeoutMills` timeout period has elapsed. - The `#` character is entered. - The maximum number of digits has been entered. */ maxDigits?: number; /** The number of milliseconds that the system will wait between entered digits before triggering the PIE callback. The default value is `3000`. */ diff --git a/packages/voice/src/models/v1/enums.ts b/packages/voice/src/models/v1/enums.ts index fb313e83..b88b2ac7 100644 --- a/packages/voice/src/models/v1/enums.ts +++ b/packages/voice/src/models/v1/enums.ts @@ -10,3 +10,61 @@ export type ReasonEnum = 'N/A' | 'CANCEL' | 'GENERALERROR' | 'INVALIDSVAMLACTION'; + +export type TtsVoice = 'arb' | 'arb/female' | 'Zeina' + | 'az-AZ' | 'az-AZ/female' | 'az-AZ/male' |'Banu' | 'Babek' + | 'ca-ES' | 'ca-ES/female' | 'Arlet' + | 'zh-HK' | 'zh-HK/female' | 'zh-HK/male' | 'HiuGaai' | 'HiuMaan' | 'WanLung' + | 'cmn-CN' | 'cmn-CN/female' | 'Zhiyu' + | 'hr-HR' | 'hr-HR/female' | 'hr-HR/male' | 'Gabrijela' | 'Srecko' + | 'cs-CZ' | 'cs-CZ/female' | 'cs-CZ/male' | 'Vlasta' | 'Antonin' + | 'da-DK' | 'da-DK/female' | 'da-DK/male' | 'Naja' | 'Mads' + | 'nl-NL' | 'nl-NL/female' | 'nl-NL/male' | 'Lotte' | 'Ruben' + | 'en-AU' | 'en-AU/female' | 'en-AU/male' | 'Nicole' | 'Olivia' | 'Russell' + | 'en-GB' | 'en-GB/female' | 'en-GB/male' | 'Amy' | 'Emma' | 'Brian' | 'Arthur' + | 'en-IN' | 'en-IN/female' | 'Aditi' | 'Raveena' | 'Kajal' + | 'en-NZ' | 'en-NZ/female' | 'Aria' + | 'en-ZA' | 'en-ZA/female' | 'Ayanda' + | 'en-US' | 'en-US/female' | 'en-US/male' | 'Ivy' | 'Joanna' | 'Kendra' | 'Kimberly' + | 'Salli' | 'Joey' | 'Justin' | 'Kevin' | 'Matthew' + | 'en-GB-WLS' | 'en-GB-WLS/male' | 'Geraint' + | 'et-EE' | 'et-EE/female' | 'et-EE/male' | 'Anu' | 'Kert' + | 'fil-PH' | 'fil-PH/female' | 'fil-PH/male' | 'Angelo' | 'Blessica' + | 'fi-FI' | 'fi-FI/female' | 'Suvi' + | 'fr-FR' | 'fr-FR/female' | 'fr-FR/male' | 'Céline' | 'Celine' | 'Léa' | 'Mathieu' + | 'fr-CA' | 'fr-CA/female' | 'fr-CA/male' | 'Chantal' | 'Gabrielle' | 'Liam' + | 'ka-GE' | 'ka-GE/female' | 'ka-GE/male' | 'Eka' | 'Giorgi' + | 'de-DE' | 'de-DE/female' | 'de-DE/male' | 'Marlene' | 'Vicki' | 'Hans' | 'Daniel' + | 'de-AT' | 'de-AT/female' | 'Hannah' + | 'el-GR' | 'el-GR/female' | 'el-GR/male' | 'Athina' | 'Nestoras' + | 'hi-IN' | 'hi-IN/female' | 'Aditi' | 'Kajal' + | 'hu-HU' | 'hu-HU/female' | 'hu-HU/male' | 'Noemi' | 'Tamas' + | 'is-IS' | 'is-IS/female' | 'is-IS/male' | 'Dóra' | 'Dora' | 'Karl' + | 'id-ID' | 'id-ID/female' | 'id-ID/male' | 'Ardi' | 'Gadis' + | 'it-IT' | 'it-IT/female' | 'it-IT/male' | 'Carla' | 'Bianca' | 'Giorgio' + | 'ja-JP' | 'ja-JP/female' | 'ja-JP/male' | 'Mizuki' | 'Takumi' + | 'ko-KR' | 'ko-KR/female' | 'Seoyeon' + | 'mt-MT' | 'mt-MT/female' | 'mt-MT/male' | 'Grace' | 'Joseph' + | 'ms-MY' | 'ms-MY/female' | 'ms-MY/male' | 'Osman' | 'Yasmin' + | 'nb-NO' | 'nb-NO/female' | 'Liv' + | 'lv-LV' | 'lv-LV/female' | 'lv-LV/male' | 'Everita' | 'Nils' + | 'lt-LT' | 'lt-LT/female' | 'lt-LT/male' | 'Ona' | 'Leonas' + | 'pl-PL' | 'pl-PL/female' | 'pl-PL/male' | 'Ewa' | 'Maja' | 'Jacek' | 'Jan' + | 'pt-BR' | 'pt-BR/female' | 'pt-BR/male' | 'Camila' | 'Vitória' | 'Vitoria' | 'Ricardo' + | 'pt-PT' | 'pt-PT/female' | 'pt-PT/male' | 'Inês' | 'Ines' | 'Cristiano' + | 'ro-RO' | 'ro-RO/female' | 'Carmen' + | 'ru-RU' | 'ru-RU/female' | 'ru-RU/male' | 'Tatyana' | 'Maxim' + | 'es-ES' | 'es-ES/female' | 'es-ES/male' | 'Conchita' | 'Lucia' | 'Enrique' + | 'es-MX' | 'es-MX/female' | 'Mia' + | 'es-US' | 'es-US/female' | 'es-US/male' | 'Lupe' | 'Penélope' | 'Penelope' | 'Miguel' | 'Pedro' + | 'sk-SK' | 'sk-SK/female' | 'sk-SK/male' | 'Viktoria' | 'Lukas' + | 'sl-SI' | 'sl-SI/female' | 'sl-SI/male' | 'Petra' | 'Rok' + | 'sv-SE' | 'sv-SE/female' | 'Astrid' + | 'th-TH' | 'th-TH/female' | 'th-TH/male' | 'Achara' | 'Niwat' | 'Premwadee' + | 'tr-TR' | 'tr-TR/male' | 'Filiz' + | 'uk-UA' | 'uk-UA/female' | 'uk-UA/male' | 'Polina' | 'Ostap' + | 'uz-UZ' | 'uz-UZ/female' | 'uz-UZ/male' | 'Madina' | 'Sardor' + | 'vi-VN' | 'vi-VN/female' | 'vi-VN/male' | 'HoaiMy' | 'NamMinh' + | 'cy-GB' | 'cy-GB/female' | 'Gwyneth' + +export type MusicOnHold = 'ring' | 'music1' | 'music2' | 'music3'; diff --git a/packages/voice/src/models/v1/helper.ts b/packages/voice/src/models/v1/helper.ts new file mode 100644 index 00000000..73494f7a --- /dev/null +++ b/packages/voice/src/models/v1/helper.ts @@ -0,0 +1,239 @@ +import { + ConnectConfProps, + ConnectMxpProps, + ConnectPstnProps, + ConnectSipProps, + ParkProps, + RunMenuProps, + StartRecordingOptions, + SvamlActionConnectConf, + SvamlActionConnectMxp, + SvamlActionConnectPstn, + SvamlActionConnectSip, + SvamlActionContinue, + SvamlActionHangup, + SvamlActionPark, + SvamlActionRunMenu, + SvamlInstructionAnswer, + SvamlInstructionPlayFiles, + SvamlInstructionSay, + SvamlInstructionSendDtmf, + SvamlInstructionSetCookie, + SvamlInstructionStartRecording, + SvamlInstructionStopRecording, +} from './mod-svaml'; +import { + AceResponse, + AceSvamlAction, AceSvamlInstruction, + CallbackResponse, + IceResponse, + IceSvamlAction, IceSvamlInstruction, + PieResponse, + PieSvamlAction, PieSvamlInstruction, +} from './mod-callbacks'; +import { TtsVoice } from './enums'; + +class SvamletBuilder> { + protected action: A | undefined; + protected instructions: I[] | undefined; + + setAction = (action: A) => { + this.action = action; + return this; + }; + addInstruction = (instruction: I) => { + if (!this.instructions) { + this.instructions = []; + } + this.instructions.push(instruction); + return this; + }; + build = (): R => { + return { + action: this.action, + instructions: this.instructions, + } as R; + }; +} + +export class AceSvamletBuilder extends SvamletBuilder {} + +export class IceSvamletBuilder extends SvamletBuilder {} + +export class PieSvamletBuilder extends SvamletBuilder {} + +export const customCalloutHelper = { + formatIceResponse: (action?: IceSvamlAction, ...instructions: IceSvamlInstruction[]): string => { + const iceResponse: IceResponse = { + action, + instructions: instructions.length > 0 ? instructions : undefined, + }; + return JSON.stringify(iceResponse); + }, + formatAceResponse:(action?: AceSvamlAction, ...instructions: AceSvamlInstruction[]): string => { + const aceResponse: AceResponse = { + action, + instructions: instructions.length > 0 ? instructions : undefined, + }; + return JSON.stringify(aceResponse); + }, + formatPieResponse:(action?: PieSvamlAction, ...instructions: PieSvamlInstruction[]): string => { + const pieResponse: PieResponse = { + action, + instructions: instructions.length > 0 ? instructions : undefined, + }; + return JSON.stringify(pieResponse); + }, +}; + +export const svamlActionHelper = { + buildConnectConf: (connectConfProps: ConnectConfProps): SvamlActionConnectConf => { + return { + name: 'connectConf', + ...connectConfProps, + }; + }, + buildConnectMxp: (connectMxpProps: ConnectMxpProps): SvamlActionConnectMxp => { + return { + name: 'connectMxp', + ...connectMxpProps, + }; + }, + buildConnectPstn: (connectPstnProps: ConnectPstnProps): SvamlActionConnectPstn => { + return { + name: 'connectPstn', + ...connectPstnProps, + }; + }, + buildConnectSip: (connectSipProps: ConnectSipProps): SvamlActionConnectSip => { + return { + name: 'connectSip', + ...connectSipProps, + }; + }, + buildContinue: (): SvamlActionContinue => { + return { + name: 'continue', + }; + }, + buildHangup: (): SvamlActionHangup => { + return { + name: 'hangup', + }; + }, + buildPark: (parkProps: ParkProps): SvamlActionPark => { + return { + name: 'park', + ...parkProps, + }; + }, + buildRunMenu: (runMenuProps: RunMenuProps): SvamlActionRunMenu => { + return { + name: 'runMenu', + ...runMenuProps, + }; + }, +}; + +export const svamlInstructionHelper = { + buildAnswer: (): SvamlInstructionAnswer => { + return { + name: 'answer', + }; + }, + buildPlayFiles: (ids: string[], locale?: TtsVoice): SvamlInstructionPlayFiles => { + // TODO - check for server limitations + return { + name: 'playFiles', + ids, + locale, + }; + }, + buildSay: (text: string, locale?: TtsVoice): SvamlInstructionSay => { + return { + name: 'say', + text, + locale, + }; + }, + buildSendDtmf: (dtmfValue: string): SvamlInstructionSendDtmf => { + const dtmfRegex = /^[0-9#w]+$/; + if(!dtmfRegex.test(dtmfValue)) { + console.error(`The DTMF value '${dtmfValue}' is incorrect. Valid characters are: 0-9, #, and w.`); + } + return { + name: 'sendDtmf', + value: dtmfValue, + }; + }, + buildSetCookie: (name: string, value: string): SvamlInstructionSetCookie => { + return { + name: 'setCookie', + key: name, + value, + }; + }, + buildStartRecording: (startRecordingOptions: StartRecordingOptions): SvamlInstructionStartRecording => { + return { + name: 'startRecording', + options: { + ...startRecordingOptions, + }, + }; + }, + buildStopRecording: (): SvamlInstructionStopRecording => { + return { + name: 'stopRecording', + }; + }, +}; + +export const aceActionHelper = { + hangup: svamlActionHelper.buildHangup, + continue: svamlActionHelper.buildContinue, + connectConf: svamlActionHelper.buildConnectConf, + runMenu: svamlActionHelper.buildRunMenu, +}; + +export const aceInstructionHelper = { + playFiles: svamlInstructionHelper.buildPlayFiles, + say: svamlInstructionHelper.buildSay, + setCookie: svamlInstructionHelper.buildSetCookie, + startRecording: svamlInstructionHelper.buildStartRecording, +}; + +export const iceActionHelper = { + hangup: svamlActionHelper.buildHangup, + connectPstn: svamlActionHelper.buildConnectPstn, + connectMxp: svamlActionHelper.buildConnectMxp, + connectConf: svamlActionHelper.buildConnectConf, + connectSip: svamlActionHelper.buildConnectSip, + runMenu: svamlActionHelper.buildRunMenu, + park: svamlActionHelper.buildPark, +}; + +export const iceInstructionHelper = { + playFiles: svamlInstructionHelper.buildPlayFiles, + say: svamlInstructionHelper.buildSay, + sendDtmf: svamlInstructionHelper.buildSendDtmf, + setCookie: svamlInstructionHelper.buildSetCookie, + startRecording: svamlInstructionHelper.buildStartRecording, + answer: svamlInstructionHelper.buildAnswer, +}; + +export const pieActionHelper = { + hangup: svamlActionHelper.buildHangup, + continue: svamlActionHelper.buildContinue, + connectConf: svamlActionHelper.buildConnectConf, + connectSip: svamlActionHelper.buildConnectSip, + runMenu: svamlActionHelper.buildRunMenu, +}; + +export const pieInstructionHelper = { + playFiles: svamlInstructionHelper.buildPlayFiles, + say: svamlInstructionHelper.buildSay, + sendDtmf: svamlInstructionHelper.buildSendDtmf, + setCookie: svamlInstructionHelper.buildSetCookie, + startRecording: svamlInstructionHelper.buildStartRecording, + stopRecording: svamlInstructionHelper.buildStopRecording, +}; diff --git a/packages/voice/src/models/v1/index.ts b/packages/voice/src/models/v1/index.ts index cc370696..2b33a55b 100644 --- a/packages/voice/src/models/v1/index.ts +++ b/packages/voice/src/models/v1/index.ts @@ -21,6 +21,7 @@ export * from './unassign-numbers'; export * from './update-callbacks'; export * from './assign-numbers'; export * from './enums'; +export * from './helper'; // Callbacks export * from './mod-callbacks'; // SVAML diff --git a/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts b/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts index 8f2cdd19..a7add3c9 100644 --- a/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts +++ b/packages/voice/src/models/v1/manage-conference-participant-request/manage-conference-participant-request.ts @@ -1,3 +1,5 @@ +import { MusicOnHold } from '../enums'; + /** * */ @@ -6,5 +8,5 @@ export interface ManageConferenceParticipantRequest { /** Action to apply on conference participant. */ command: 'mute' | 'unmute' | 'onhold' | 'resume'; /** Means "music on hold". If this optional parameter is included, plays music to the first participant in a conference while they're alone and waiting for other participants to join. If `moh` isn't specified, the user will only hear silence while alone in the conference. This property is only available to use with the `onhold` command. */ - moh?: 'ring' | 'music1' | 'music2' | 'music3'; + moh?: MusicOnHold; } diff --git a/packages/voice/src/models/v1/mod-callbacks/ace-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/ace-response/index.ts index 672cf0ff..466d85be 100644 --- a/packages/voice/src/models/v1/mod-callbacks/ace-response/index.ts +++ b/packages/voice/src/models/v1/mod-callbacks/ace-response/index.ts @@ -1 +1 @@ -export type { AceResponse, AceSvamlAction } from './ace-response'; +export type { AceResponse, AceSvamlAction, AceSvamlInstruction } from './ace-response'; diff --git a/packages/voice/src/models/v1/mod-callbacks/callback-response/callback-response.ts b/packages/voice/src/models/v1/mod-callbacks/callback-response/callback-response.ts new file mode 100644 index 00000000..83c24ae2 --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/callback-response/callback-response.ts @@ -0,0 +1,4 @@ +export interface CallbackResponse { + action?: A, + instructions?: I[] +} diff --git a/packages/voice/src/models/v1/mod-callbacks/callback-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/callback-response/index.ts new file mode 100644 index 00000000..e4c3642d --- /dev/null +++ b/packages/voice/src/models/v1/mod-callbacks/callback-response/index.ts @@ -0,0 +1 @@ +export type { CallbackResponse } from './callback-response'; diff --git a/packages/voice/src/models/v1/mod-callbacks/ice-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/ice-response/index.ts index d41e3a12..a48c6f2b 100644 --- a/packages/voice/src/models/v1/mod-callbacks/ice-response/index.ts +++ b/packages/voice/src/models/v1/mod-callbacks/ice-response/index.ts @@ -1 +1 @@ -export type { IceResponse, IceSvamlAction } from './ice-response'; +export type { IceResponse, IceSvamlAction, IceSvamlInstruction } from './ice-response'; diff --git a/packages/voice/src/models/v1/mod-callbacks/index.ts b/packages/voice/src/models/v1/mod-callbacks/index.ts index 2a000d80..62e23609 100644 --- a/packages/voice/src/models/v1/mod-callbacks/index.ts +++ b/packages/voice/src/models/v1/mod-callbacks/index.ts @@ -7,3 +7,4 @@ export * from './notify-error-request'; export * from './notify-request'; export * from './pie-request'; export * from './pie-response'; +export * from './callback-response'; diff --git a/packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts b/packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts index 21123dfd..8383d6b0 100644 --- a/packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts +++ b/packages/voice/src/models/v1/mod-callbacks/notify-request/notify-request.ts @@ -12,7 +12,26 @@ export interface NotifyRequest { /** The current API version. */ version?: number; /** The type of information communicated in the notification. */ - type?: 'recording_finished' | 'recording_available' | 'transcription_available' | string; + type?: NotifyRequestType; /** An optional parameter containing notification-specific information. */ custom?: string; + /** The details about the 'amd' or 'amd_beep' event type */ + amd?: AmdStatus; +} + +type NotifyRequestType = + 'recording_finished' + | 'recording_available' + | 'transcription_available' + | 'amd' + | 'amd_beep' + | string; // wildcard as there is no specification of the list of all notifications + +interface AmdStatus { + /** */ + status?: 'machine' | 'human' | string; + /** */ + reason?: 'greeting' | 'beep' | 'n/a' | string; + /** */ + duration?: number; } diff --git a/packages/voice/src/models/v1/mod-callbacks/pie-response/index.ts b/packages/voice/src/models/v1/mod-callbacks/pie-response/index.ts index 05cb6eae..e4a7d3bc 100644 --- a/packages/voice/src/models/v1/mod-callbacks/pie-response/index.ts +++ b/packages/voice/src/models/v1/mod-callbacks/pie-response/index.ts @@ -1 +1 @@ -export type { PieResponse, PieSvamlAction } from './pie-response'; +export type { PieResponse, PieSvamlAction, PieSvamlInstruction } from './pie-response'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/index.ts index 3631ebbe..5b397f14 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/index.ts @@ -1 +1 @@ -export type { SvamlActionConnectConf } from './svaml-action-connect-conf'; +export type { SvamlActionConnectConf, ConnectConfProps } from './svaml-action-connect-conf'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts index 96b52901..ab731ca5 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-conf/svaml-action-connect-conf.ts @@ -1,4 +1,5 @@ import { ConferenceDtmfOptions } from '../../conference-dtmf-options'; +import { MusicOnHold } from '../../enums'; /** * Connects an incoming call to a conference. Available to use in a response to an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. @@ -12,5 +13,7 @@ export interface SvamlActionConnectConf { /** Options to control how DTMF signals are used by the participant in the conference. For information on how to use this feature, read more [here](../../conference-dtmf). */ conferenceDtmfOptions?: ConferenceDtmfOptions; /** Means "music on hold". If this optional parameter is included, plays music to the first participant in a conference while they're alone and waiting for other participants to join. If `moh` isn't specified, the user will only hear silence while alone in the conference. */ - moh?: string; + moh?: MusicOnHold; } + +export type ConnectConfProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/index.ts index 314cab22..b7d20945 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/index.ts @@ -1 +1 @@ -export type { SvamlActionConnectMxp } from './svaml-action-connect-mxp'; +export type { SvamlActionConnectMxp, ConnectMxpProps } from './svaml-action-connect-mxp'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts index 419c48cb..b5425fd2 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-mxp/svaml-action-connect-mxp.ts @@ -11,7 +11,7 @@ export interface SvamlActionConnectMxp { /** Allows you to specify or override the final destination of the call. If the final destination of the call is not dialed, this is a required parameter. */ destination?: Destination; /** An optional parameter that allows you to specify or override call headers provided to the receiving Sinch SDK client. Read more about call headers [here](../../call-headers/). */ - callheaders?: CallHeader[]; + callHeaders?: CallHeader[]; } - +export type ConnectMxpProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts index 592ea1f7..0c46fb38 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/index.ts @@ -1 +1 @@ -export type { SvamlActionConnectPstn, EnableAmd } from './svaml-action-connect-pstn'; +export type { SvamlActionConnectPstn, EnableAmd, ConnectPstnProps } from './svaml-action-connect-pstn'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts index 0898c34a..6d5c1056 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-pstn/svaml-action-connect-pstn.ts @@ -20,7 +20,7 @@ export interface SvamlActionConnectPstn { /** A string that determines the DTMF tones to play to the callee when the call is picked up. Valid characters are: `0-9`, `#`, and `w`. `w` renders a 500ms pause. For example, the string `ww1234#w#`, plays a 1-second pause, the DTMF tones for `1`, `2`, `3`, `4`, and `#`, followed by a 500ms pause and finally the `#` tone. This is useful if the callout destination requires a conference PIN code or an extension. If there is a calling party, it will hear progress while the DTMF is sent. */ dtmf?: string; /** The locale's tone to play while ringing. */ - indications?: string; + indications?: Indication; /** An optional property used to enable [Answering Machine Detection](/docs/voice/api-reference/amd_v2) (AMD). */ amd?: EnableAmd; } @@ -29,5 +29,12 @@ export interface EnableAmd { /** Sets whether AMD is enabled. */ enabled?: boolean; + /** To be set to 'true' in order to be notified when the beep is detected */ + async?: boolean; } +type Indication = 'at' | 'au' | 'bg' | 'br' | 'be' | 'ch' | 'cl' | 'cn' | 'cz' | 'de' | 'dk' | 'ee' | 'es' + | 'fi' | 'fr' | 'gr' | 'hu' | 'il' | 'in' | 'it' | 'lt' | 'jp' | 'mx' | 'my' | 'nl' | 'no' | 'nz' | 'ph' + | 'pl' | 'pt' | 'ru' | 'se' | 'sg' | 'th' | 'uk' | 'us' | 'tw' | 've' | 'za'; + +export type ConnectPstnProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts index aac71bb4..f2f52f85 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/index.ts @@ -1 +1 @@ -export type { SvamlActionConnectSip, SipDestination } from './svaml-action-connect-sip'; +export type { SvamlActionConnectSip, SipDestination, ConnectSipProps } from './svaml-action-connect-sip'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts index 067e02e5..f83678b3 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-connect-sip/svaml-action-connect-sip.ts @@ -1,4 +1,5 @@ import { CallHeader } from '../../call-header'; +import { MusicOnHold } from '../../enums'; /** * Determines how to route a call to a SIP server. Available to use in a response to an [Incoming Call Event](../../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. @@ -14,13 +15,13 @@ export interface SvamlActionConnectSip { /** Used to override the CLI (or caller ID) of the client. The phone number of the person who initiated the call is shown as the CLI. To set your own CLI, you may use your verified number or your Dashboard virtual number. */ cli?: string; /** An optional parameter to specify the SIP transport protocol. If unspecified, UDP is used. */ - transport?: string; + transport?: 'udp' | 'tcp' | 'tls'; /** If enabled, suppresses [ACE](../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) and [DICE](../../voice/tag/Callbacks/#tag/Callbacks/operation/dice) callbacks for the call. */ suppressCallbacks?: boolean; /** [Private SIP headers](../../sip-trunking/#receiving-calls-from-sinch-platform-to-your-sip-infrastructure) to send with the call. */ callHeaders?: CallHeader[]; /** Means \"music on hold\". If this optional parameter is included, plays music to the connected participant if the SIP call is placed on hold. If `moh` isn't specified and the SIP call is placed on hold, the user will only hear silence while during the holding period . */ - moh?: string; + moh?: MusicOnHold; } export interface SipDestination { @@ -30,3 +31,5 @@ export interface SipDestination { /** */ type?: 'Sip' } + +export type ConnectSipProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-park/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/index.ts index cf11773a..7a1eb222 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-park/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/index.ts @@ -1 +1 @@ -export type { SvamlActionPark } from './svaml-action-park'; +export type { SvamlActionPark, ParkProps } from './svaml-action-park'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts index 93cae188..4f386ed7 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-park/svaml-action-park.ts @@ -1,3 +1,5 @@ +import { TtsVoice } from '../../enums'; + /** * Parks the call and places the caller on hold. The caller is placed into a loop, listening to an IVR prompt (either a pre-recorded audio file or generated by text to speech). If the call is unparked, prompts will stop playing immediately. If the max duration is reached, the last prompt will be fully played until the call ends. */ @@ -6,7 +8,7 @@ export interface SvamlActionPark { /** The name property. Must have the value `park`. */ name: 'park'; /** The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../voice-locales). */ - locale?: string; + locale?: TtsVoice; /** That prompt that is played when the call is first answered. You can use text-to-speech using the `#tts[]` element, SSML commands using the `#ssml[]` element. */ introPrompt?: string; /** The prompt that is played on repeat until the call is unparked or the until the `maxDuration` value is reached. You can use text-to-speech using the `#tts[]` element, SSML commands using the `#ssml[]` element. */ @@ -14,3 +16,5 @@ export interface SvamlActionPark { /** The maximum amount of time in seconds that the `holdPrompt` will be played. */ maxDuration?: number; } + +export type ParkProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/index.ts index c1e95303..c7e4ce5a 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/index.ts @@ -1 +1 @@ -export type { SvamlActionRunMenu } from './svaml-action-run-menu'; +export type { SvamlActionRunMenu, RunMenuProps } from './svaml-action-run-menu'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts index 1688ff41..cdd8d1ee 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-action-run-menu/svaml-action-run-menu.ts @@ -1,4 +1,5 @@ import { Menu } from '../../menu'; +import { TtsVoice } from '../../enums'; /** * Plays an interactive voice response (IVR) menu to the callee. This menu can play pre-recorded files or text-to-speech messages, collect DTMF tones, and trigger the [Prompt Input Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/pie) (PIE) callback towards your backend, notifying you of the actions the callee took. Available to use in a response to an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback or an [Answered Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) callback. Also be used in combination with the [Conferences](/docs/voice/api-reference/voice/tag/Conferences/#tag/Conferences) endpoint of the Voice API. @@ -10,7 +11,7 @@ export interface SvamlActionRunMenu { /** 'Barging' means that the user can press a DTMF digit before the prompt has finished playing. If a valid input is pressed, the message will stop playing and accept the input. If `barge` is disabled, the user must listen to the entire prompt before input is accepted. By default, barging is enabled. */ barge?: boolean; /** The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../voice-locales). If using the `enableVoice` to enable voice detection, the `locale` property is required in order to select the input language. */ - locale?: string; + locale?: TtsVoice; /** Selects the menu item from the `menus` array to play first. */ mainMenu?: string; /** Enables voice detection. If enabled, users can say their answers to prompts in addition to entering them using the keypad. */ @@ -18,3 +19,5 @@ export interface SvamlActionRunMenu { /** The list of menus available. The menu with the `id` value of `main` will always play first. If no menu has an `id` value of `main`, an error is returned. */ menus?: Menu[]; } + +export type RunMenuProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/index.ts index ad88d03a..a155dcd9 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/index.ts @@ -1 +1 @@ -export type { SvamlInstructionPlayFiles } from './svaml-instruction-play-files'; +export type { SvamlInstructionPlayFiles, PlayFilesProps } from './svaml-instruction-play-files'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts index bcc09113..c2a624d9 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-play-files/svaml-instruction-play-files.ts @@ -1,3 +1,5 @@ +import { TtsVoice } from '../../enums'; + /** * Plays Interactive Voice Response (IVR) files for the supported locale or SSML commands at the Sinch backend. An IVR message is played only on the caller's side. */ @@ -8,5 +10,7 @@ export interface SvamlInstructionPlayFiles { /** The IDs of the files which will be played. These can be a URL to a file, SSML commands using the `#ssml[]` element, or text using the `#tts[]` element. */ ids: string[]; /** If using SSML or TTS, this is a required field. The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../voice-locales). */ - locale: string; + locale?: TtsVoice; } + +export type PlayFilesProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/index.ts index 444b50be..fa366576 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/index.ts @@ -1 +1 @@ -export type { SvamlInstructionSay } from './svaml-instruction-say'; +export type { SvamlInstructionSay, SayProps } from './svaml-instruction-say'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts index fd24a5f0..6d6c11db 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-say/svaml-instruction-say.ts @@ -1,3 +1,5 @@ +import { TtsVoice } from '../../enums'; + /** * Plays a synthesized text-to-speech message to the end user. The message is provided in the text field. */ @@ -8,5 +10,7 @@ export interface SvamlInstructionSay { /** Contains the message that will be spoken. Default maximum length is 600 characters. To change this limit, please contact support. */ text?: string; /** The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../voice-locales). */ - locale?: string; + locale?: TtsVoice; } + +export type SayProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/index.ts index f621f54e..0112bf85 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/index.ts @@ -1 +1 @@ -export type { SvamlInstructionSendDtmf } from './svaml-instruction-send-dtmf'; +export type { SvamlInstructionSendDtmf, SendDtmfProps } from './svaml-instruction-send-dtmf'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts index 58e6ef23..460e3579 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-send-dtmf/svaml-instruction-send-dtmf.ts @@ -8,3 +8,5 @@ export interface SvamlInstructionSendDtmf { /** A string that determines the DTMF tones to play to the callee when the call is picked up. Valid characters are: `0-9`, `#`, and `w`. `w` renders a 500ms pause. For example, the string `ww1234#w#`, plays a 1 second pause, the DTMF tones for `1`, `2`, `3`, `4`, and `#`, followed by a 500ms pause and finally the `#` tone. This is useful if the callout destination requires a conference PIN code or an extension. If there is a calling party, it will hear progress while the DTMF is sent. */ value?: string; } + +export type SendDtmfProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/index.ts index 70d1510a..043f29f3 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/index.ts @@ -1 +1 @@ -export type { SvamlInstructionSetCookie } from './svaml-instruction-set-cookie'; +export type { SvamlInstructionSetCookie, SetCookieProps } from './svaml-instruction-set-cookie'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts index e34a1e30..01db0292 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-set-cookie/svaml-instruction-set-cookie.ts @@ -10,3 +10,5 @@ export interface SvamlInstructionSetCookie { /** The value of the cookie you want to set. */ value?: string; } + +export type SetCookieProps = Omit; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/index.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/index.ts index e5be833d..1b3d348f 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/index.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/index.ts @@ -2,4 +2,5 @@ export type { SvamlInstructionStartRecording, StartRecordingOptions, TranscriptionOptions, + StartRecordingProps, } from './svaml-instruction-start-recording'; diff --git a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts index 1548ac91..0faccc51 100644 --- a/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts +++ b/packages/voice/src/models/v1/mod-svaml/svaml-instruction-start-recording/svaml-instruction-start-recording.ts @@ -26,5 +26,50 @@ export interface TranscriptionOptions { /** Enable / disable the transcription */ enabled?: boolean; /** The locale of the transcription (e.g.: 'en-US') */ - locale?: string; + locale?: TranscriptionLocale; } + +type TranscriptionLocale = + 'af-ZA' + | 'ar-AE' + | 'ar-SA' + | 'zh-CN' + | 'zh-TW' + | 'da-DK' + | 'nl-NL' + | 'en-AU' + | 'en-GB' + | 'en-IN' + | 'en-IE' + | 'en-NZ' + | 'en-AB' + | 'en-ZA' + | 'en-US' + | 'en-WL' + | 'fr-FR' + | 'fr-CA' + | 'fa-IR' + | 'gd_GB' + | 'de-DE' + | 'de-CH' + | 'he-IL' + | 'hi-IN' + | 'id-ID' + | 'ga-IE' + | 'it-IT' + | 'ja-JP' + | 'ko-KR' + | 'ms-MY' + | 'pt-PT' + | 'pt-BR' + | 'ru-RU' + | 'es-ES' + | 'es-US' + | 'sv-SE' + | 'ta-IN' + | 'te-IN' + | 'th-TH' + | 'tr-TR' + | 'vi-VN'; + +export type StartRecordingProps = Omit; diff --git a/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts b/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts index 54ed199a..94449b89 100644 --- a/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts +++ b/packages/voice/src/models/v1/tts-callout-request/tts-callout-request.ts @@ -1,4 +1,5 @@ import { Destination } from '../destination'; +import { TtsVoice } from '../enums'; /** * The text-to-speech callout calls a phone number and plays a synthesized text messages or pre-recorded sound files. @@ -16,7 +17,7 @@ export interface TtsCalloutRequest { /** Can be used to input custom data. */ custom?: string; /** The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](../../../voice-locales/). */ - locale?: string; + locale?: TtsVoice; /** The text that will be spoken in the text-to-speech message. _Every application's default maximum characters allowed in text-to-speech is 600 characters. Contact support if you wish this limit to be changed._ */ text?: string; /** An advanced alternative to using ```text```. __TTS__ _Text To Speech:_ The equivalent of text but within the prompt property. Example: _```#tts[Hello from Sinch]```_ __TTS with SSML__ _Text To Speech with Speech Synthesis Markup Language (SSML)._ This is an XML-based markup language for assisting the generation of synthetic speech in the Web and other applications. AWS Polly supports a sub-set of SSML. This allows us to use SSML-enhanced text for additional control over how Polly generates speech from the text. Details and examples of supported tags are [here](https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html) __Externally hosted media:__ Provide a URL to your own hosted media. Please check [here](../../../supported-audio-formats/#limits) to read about audio content type and usage limits. _Every application's default maximum allowed in TTS or TTS SSML is 600 characters. Contact support if you wish this limit to be changed._ _Several prompts can be used, separated by a semi-colon_ ```;``` Example: _```#tts[Hello from Sinch];#ssml[Have a great day!]```_ */ diff --git a/packages/voice/src/rest/v1/conferences/conferences-api.jest.fixture.ts b/packages/voice/src/rest/v1/conferences/conferences-api.jest.fixture.ts index b248edf3..8c9eded3 100644 --- a/packages/voice/src/rest/v1/conferences/conferences-api.jest.fixture.ts +++ b/packages/voice/src/rest/v1/conferences/conferences-api.jest.fixture.ts @@ -1,4 +1,5 @@ import { + CalloutResponse, GetConferenceInfoResponse, } from '../../../models'; import { @@ -8,9 +9,14 @@ import { KickParticipantRequestData, ManageParticipantRequestData, } from './conferences-api'; +import { ConferenceCalloutRequestData } from '../callouts'; export class ConferencesApiFixture implements Partial> { + /** + * Fixture associated to function call + */ + public call: jest.Mock, [ConferenceCalloutRequestData]> = jest.fn(); /** * Fixture associated to function get */ diff --git a/packages/voice/src/rest/v1/conferences/conferences-api.ts b/packages/voice/src/rest/v1/conferences/conferences-api.ts index 9861c02a..a98b7013 100644 --- a/packages/voice/src/rest/v1/conferences/conferences-api.ts +++ b/packages/voice/src/rest/v1/conferences/conferences-api.ts @@ -1,4 +1,5 @@ import { + CalloutResponse, GetConferenceInfoResponse, ManageConferenceParticipantRequest, } from '../../../models/'; @@ -7,6 +8,7 @@ import { SinchClientParameters, } from '@sinch/sdk-client'; import { VoiceDomainApi } from '../voice-domain-api'; +import { CalloutsApi, ConferenceCalloutRequestData } from '../callouts'; export interface GetConferenceInfoRequestData { /** The unique identifier of the conference. The user sets this value. */ @@ -33,6 +35,8 @@ export interface ManageParticipantRequestData { export class ConferencesApi extends VoiceDomainApi { + private calloutApi: CalloutsApi; + /** * Initialize your interface * @@ -40,6 +44,16 @@ export class ConferencesApi extends VoiceDomainApi { */ constructor(sinchClientParameters: SinchClientParameters) { super(sinchClientParameters, 'ConferencesApi'); + this.calloutApi = new CalloutsApi(sinchClientParameters); + } + + /** + * Conference Callout Request + * Makes a conference callout to a phone number. + * @param { ConferenceCalloutRequestData } data - The data to provide to the API call. + */ + public async call(data: ConferenceCalloutRequestData): Promise { + return this.calloutApi.conference(data); } /** diff --git a/packages/voice/tests/models/v1/helper.test.ts b/packages/voice/tests/models/v1/helper.test.ts new file mode 100644 index 00000000..a2868efd --- /dev/null +++ b/packages/voice/tests/models/v1/helper.test.ts @@ -0,0 +1,529 @@ +import { + aceActionHelper, + aceInstructionHelper, + AceResponse, + AceSvamletBuilder, + CallHeader, + ConnectConfProps, + ConnectMxpProps, + ConnectPstnProps, + ConnectSipProps, + customCalloutHelper, + iceActionHelper, + iceInstructionHelper, + IceResponse, + IceSvamletBuilder, + ParkProps, + pieActionHelper, + pieInstructionHelper, + PieResponse, + PieSvamletBuilder, + PlayFilesProps, + RunMenuProps, + SayProps, + SendDtmfProps, + SetCookieProps, + StartRecordingOptions, + StartRecordingProps, + SvamlActionConnectConf, + SvamlActionConnectMxp, + SvamlActionConnectPstn, + SvamlActionConnectSip, + SvamlActionContinue, + SvamlActionHangup, + svamlActionHelper, + SvamlActionPark, + SvamlActionRunMenu, + SvamlInstructionAnswer, + svamlInstructionHelper, + SvamlInstructionPlayFiles, + SvamlInstructionSay, + SvamlInstructionSendDtmf, + SvamlInstructionSetCookie, + SvamlInstructionStartRecording, + SvamlInstructionStopRecording, +} from '../../../src'; + +const CONFERENCE_ID = 'conferenceId'; +const NUMBER = '+461234567890'; +const CLI = '+460987654321'; +const CALL_HEADERS: CallHeader[] = [ + { + key: 'foo', + value: 'bar', + }, + { + key: 'baz', + value: 'qux', + }, +]; + +const RECORDING_OPTIONS: StartRecordingOptions = { + destinationUrl: 'azure://my-account/test-container/my-recording.mp3', + credentials: 'dummyAzureCredentials', + format: 'mp3', + notificationEvents: true, + transcriptionOptions: { + enabled: true, + locale: 'en-US', + }, +}; + +describe('Voice models helpers', () => { + + describe('SVAML Actions helper', () => { + it('should build a connectConf action', () => { + const connectConfProps: ConnectConfProps = { + conferenceId:CONFERENCE_ID, + conferenceDtmfOptions: { + mode: 'detect', + maxDigits: 1, + timeoutMills: 5000, + }, + moh: 'music1', + }; + const expectedResult: SvamlActionConnectConf = { + ...connectConfProps, + name: 'connectConf', + }; + const builtAction = svamlActionHelper.buildConnectConf(connectConfProps); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a connectMxp action', () => { + const connectMxpProps: ConnectMxpProps = { + destination: { + type: 'username', + endpoint: 'johndoe', + }, + callHeaders: CALL_HEADERS, + }; + const expectedResult: SvamlActionConnectMxp = { + ...connectMxpProps, + name: 'connectMxp', + }; + const builtAction = svamlActionHelper.buildConnectMxp(connectMxpProps); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a connectPstn action', () => { + const connectPstnProps: ConnectPstnProps = { + number: NUMBER, + locale: 'en-US', + maxDuration: 3000, + dialTimeout: 10, + cli: CLI, + suppressCallbacks: false, + indications: 'se', + dtmf: 'ww1234#w#', + amd: { + enabled: true, + }, + }; + const expectedResult: SvamlActionConnectPstn = { + ...connectPstnProps, + name: 'connectPstn', + }; + const builtAction = svamlActionHelper.buildConnectPstn(connectPstnProps); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a connectSip action', () => { + const connectSipProps: ConnectSipProps = { + destination: { + type: 'Sip', + endpoint: '46708000000@sip.foo.com', + }, + maxDuration: 3000, + cli: 'private', + transport: 'tls', + suppressCallbacks: false, + callHeaders: CALL_HEADERS, + moh: 'music2', + }; + const expectedResult: SvamlActionConnectSip = { + ...connectSipProps, + name: 'connectSip', + }; + const builtAction = svamlActionHelper.buildConnectSip(connectSipProps); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a continue action', () => { + const expectedResult: SvamlActionContinue = { + name: 'continue', + }; + const builtAction = svamlActionHelper.buildContinue(); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a hangup action', () => { + const expectedResult: SvamlActionHangup = { + name: 'hangup', + }; + const builtAction = svamlActionHelper.buildHangup(); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a park action', () => { + const parkProps: ParkProps = { + locale: 'en-US', + introPrompt: '#tts[Welcome]', + holdPrompt: '#tts[Thank you for your patience, your call is very important to us.]', + maxDuration: 180, + }; + const expectedResult: SvamlActionPark = { + ...parkProps, + name: 'park', + }; + const builtAction = svamlActionHelper.buildPark(parkProps); + expect(builtAction).toEqual(expectedResult); + }); + + it('should build a runMenu action', () => { + const runMenuProps: RunMenuProps = { + barge: true, + locale: 'en-US', + enableVoice: true, + mainMenu: 'main', + menus: [ + { + id: 'main', + mainPrompt: '#tts[Welcome to the main menu. Press 1 for support or 2 to continue.]', + repeatPrompt: '#tts[Sorry, please try again. Press 1 for support or 2 to continue.]', + repeats: 2, + maxDigits: 1, + timeoutMills: 5000, + maxTimeoutMills: 20000, + options: [ + { + dtmf: '1', + action: 'return(support)', + }, + { + dtmf: '2', + action: 'menu(sub)', + }, + ], + }, + { + id: 'sub', + mainPrompt: '#tts[Welcome to the sub menu. Enter your 4-digit PIN.]', + options: [ + { + dtmf: '1', + action: 'menu(main)', + }, + ], + }, + ], + }; + const expectedResult: SvamlActionRunMenu = { + ...runMenuProps, + name: 'runMenu', + }; + const builtAction = svamlActionHelper.buildRunMenu(runMenuProps); + expect(builtAction).toEqual(expectedResult); + }); + }); + + describe('SVAML Instructions helper', () => { + it('should build an answer instruction', () => { + const expectedResult: SvamlInstructionAnswer = { + name: 'answer', + }; + const builtInstruction = svamlInstructionHelper.buildAnswer(); + expect(builtInstruction).toEqual(expectedResult); + }); + + it('should build a playFiles instruction', () => { + const ids = [ + '[Welcome]', + ]; + const playFilesProps: PlayFilesProps = { + locale: 'Enrique', + ids, + }; + const expectedResult: SvamlInstructionPlayFiles = { + ...playFilesProps, + name: 'playFiles', + }; + const builtInstruction = svamlInstructionHelper.buildPlayFiles(ids, 'Enrique'); + expect(builtInstruction).toEqual(expectedResult); + }); + + it('should build a say instruction', () => { + const text = 'Hello, this is a text-to-speech message.'; + const sayProps: SayProps = { + text, + locale: 'Ivy', + }; + const expectedResult: SvamlInstructionSay = { + ...sayProps, + name: 'say', + }; + const builtInstruction = svamlInstructionHelper.buildSay(text, 'Ivy'); + expect(builtInstruction).toEqual(expectedResult); + }); + + it('should build a sendDtmf instruction', () => { + const sendDtmfProps: SendDtmfProps = { + value: '1234#', + }; + const expectedResult: SvamlInstructionSendDtmf = { + ...sendDtmfProps, + name: 'sendDtmf', + }; + const builtInstruction = svamlInstructionHelper.buildSendDtmf('1234#'); + expect(builtInstruction).toEqual(expectedResult); + }); + + it('should build a setCookie instruction', () => { + const setCookieProps: SetCookieProps = { + key: 'cookie-name', + value: 'cookie-value', + }; + const expectedResult: SvamlInstructionSetCookie = { + ...setCookieProps, + name: 'setCookie', + }; + const builtInstruction = svamlInstructionHelper.buildSetCookie('cookie-name', 'cookie-value'); + expect(builtInstruction).toEqual(expectedResult); + }); + + it('should build a startRecording instruction', () => { + const startRecordingProps: StartRecordingProps = { + options: { + ...RECORDING_OPTIONS, + }, + }; + const expectedResult: SvamlInstructionStartRecording = { + ...startRecordingProps, + name: 'startRecording', + }; + const builtInstruction = svamlInstructionHelper.buildStartRecording(RECORDING_OPTIONS); + expect(builtInstruction).toEqual(expectedResult); + }); + + it('should build a stopRecording instruction', () => { + const expectedResult: SvamlInstructionStopRecording = { + name: 'stopRecording', + }; + const builtInstruction = svamlInstructionHelper.buildStopRecording(); + expect(builtInstruction).toEqual(expectedResult); + }); + }); + + describe('ACE response builder', () => { + it('should build an ACE response', () => { + const aceResponse = new AceSvamletBuilder() + .setAction(aceActionHelper.hangup()) + .addInstruction(aceInstructionHelper.setCookie('cookie-name', 'cookie-value')) + .addInstruction(aceInstructionHelper.startRecording(RECORDING_OPTIONS)) + .addInstruction(aceInstructionHelper.say('Hello from Sinch.', 'en-US')) + .addInstruction(aceInstructionHelper.playFiles([ + "#tts[Hello from Sinch]", + "#ssml[Have a great day!]", + ], 'en-US')) + .build(); + const expectedResult: AceResponse = { + action: { + name: 'hangup', + }, + instructions: [ + { + name: 'setCookie', + key: 'cookie-name', + value: 'cookie-value', + }, + { + name: 'startRecording', + options: { + ...RECORDING_OPTIONS, + }, + }, + { + name: 'say', + text: 'Hello from Sinch.', + locale: 'en-US', + }, + { + name: 'playFiles', + ids: ["#tts[Hello from Sinch]", "#ssml[Have a great day!]"], + locale: 'en-US', + }, + ], + }; + expect(aceResponse).toEqual(expectedResult); + }); + }); + + describe('ICE response builder', () => { + it('should build an ICE response', () => { + const parkProps: ParkProps = { + introPrompt: '#tts[Welcome]', + holdPrompt: '#tts[Thank you for your patience, your call is very important to us.]', + maxDuration: 180, + }; + const iceResponse = new IceSvamletBuilder() + .setAction(iceActionHelper.park(parkProps)) + .addInstruction(iceInstructionHelper.setCookie('sinch-app', 'app-id-value')) + .build(); + const expectedResult: IceResponse = { + action: { + name: 'park', + ...parkProps, + }, + instructions: [ + { + name: 'setCookie', + key: 'sinch-app', + value: 'app-id-value', + }, + ], + }; + expect(iceResponse).toEqual(expectedResult); + }); + }); + + describe('PIE response builder', () => { + it('should build a PIE response', () => { + const pieResponse = new PieSvamletBuilder() + .setAction(pieActionHelper.continue()) + .addInstruction(pieInstructionHelper.say('The call may be recorded.', 'en-US')) + .addInstruction(pieInstructionHelper.startRecording(RECORDING_OPTIONS)) + .build(); + const expectedResult: PieResponse = { + action: { + name: 'continue', + }, + instructions: [ + { + name: 'say', + text: 'The call may be recorded.', + locale: 'en-US', + }, + { + name: 'startRecording', + options: RECORDING_OPTIONS, + }, + ], + }; + expect(pieResponse).toEqual(expectedResult); + }); + }); + + describe('Custom callout helper', () => { + it('should build a SVAML ICE string with only an action', () => { + const ice = customCalloutHelper.formatIceResponse( + iceActionHelper.park({}), + ); + const expectedResult: IceResponse = { + action: { + name: 'park', + }, + }; + expect(ice).toBe(JSON.stringify(expectedResult)); + }); + + it('should build a SVAML ICE string with an action and instructions', () => { + const ice = customCalloutHelper.formatIceResponse( + iceActionHelper.park({}), + iceInstructionHelper.setCookie('cookie-name', 'cookie-value'), + iceInstructionHelper.say('Hello from Sinch.', 'Gwyneth'), + ); + const expectedResult: IceResponse = { + action: { + name: 'park', + }, + instructions: [ + { + name: 'setCookie', + key: 'cookie-name', + value: 'cookie-value', + }, + { + name: 'say', + text: 'Hello from Sinch.', + locale: 'Gwyneth', + }, + ], + }; + expect(ice).toBe(JSON.stringify(expectedResult)); + }); + + it('should build a SVAML ACE string with only an action', () => { + const ace = customCalloutHelper.formatAceResponse( + aceActionHelper.continue(), + ); + const expectedResult: AceResponse = { + action: { + name: 'continue', + }, + }; + expect(ace).toBe(JSON.stringify(expectedResult)); + }); + + it('should build a SVAML ACE string with an action and instructions', () => { + const ace = customCalloutHelper.formatAceResponse( + aceActionHelper.continue(), + aceInstructionHelper.setCookie('cookie-name', 'cookie-value'), + aceInstructionHelper.say('Hello from Sinch.', 'Geraint'), + ); + const expectedResult: AceResponse = { + action: { + name: 'continue', + }, + instructions: [ + { + name: 'setCookie', + key: 'cookie-name', + value: 'cookie-value', + }, + { + name: 'say', + text: 'Hello from Sinch.', + locale: 'Geraint', + }, + ], + }; + expect(ace).toBe(JSON.stringify(expectedResult)); + }); + + it('should build a SVAML PIE string with only an action', () => { + const pie = customCalloutHelper.formatPieResponse( + pieActionHelper.continue(), + ); + const expectedResult: PieResponse = { + action: { + name: 'continue', + }, + }; + expect(pie).toBe(JSON.stringify(expectedResult)); + }); + + it('should build a SVAML PIE string with an action and instructions', () => { + const pie = customCalloutHelper.formatPieResponse( + pieActionHelper.continue(), + pieInstructionHelper.say('Goodbye.', 'Raveena'), + pieInstructionHelper.stopRecording(), + ); + const expectedResult: PieResponse = { + action: { + name: 'continue', + }, + instructions: [ + { + name: 'say', + text: 'Goodbye.', + locale: 'Raveena', + }, + { + name: 'stopRecording', + }, + ], + }; + expect(pie).toBe(JSON.stringify(expectedResult)); + }); + }); +}); diff --git a/packages/voice/tests/rest/v1/conferences/conferences-api.test.ts b/packages/voice/tests/rest/v1/conferences/conferences-api.test.ts index 628f37f7..3148db87 100644 --- a/packages/voice/tests/rest/v1/conferences/conferences-api.test.ts +++ b/packages/voice/tests/rest/v1/conferences/conferences-api.test.ts @@ -7,6 +7,8 @@ import { KickAllRequestData, KickParticipantRequestData, ManageParticipantRequestData, + ConferenceCalloutRequestData, + CalloutResponse, } from '../../../../src'; @@ -24,7 +26,7 @@ describe('ConferencesApi', () => { }); describe ('getConferenceInfo', () => { - it('should make a GET request to ...', async () => { + it('should make a GET request to get information about a conference', async () => { // Given const requestData: GetConferenceInfoRequestData = { conferenceId: 'conferenceId', @@ -59,6 +61,38 @@ describe('ConferencesApi', () => { }); }); + describe ('Conference callouts', () => { + it('should make a POST request to make a conference callout to a phone number', async () => { + // Given + const requestData: ConferenceCalloutRequestData = { + conferenceCalloutRequestBody: { + method: 'conferenceCallout', + conferenceCallout: { + cli: '+14045001000', + conferenceId: 'conferenceId', + destination: { + type: 'number', + endpoint: '+14045005000', + }, + domain: 'pstn', + }, + }, + }; + const expectedResponse: CalloutResponse = { + callId: 'callId', + }; + + // When + fixture.call.mockResolvedValue(expectedResponse); + conferencesApi.call = fixture.call; + const response = await conferencesApi.call(requestData); + + // Then + expect(response).toEqual(expectedResponse); + expect(fixture.call).toHaveBeenCalledWith(requestData); + }); + }); + describe ('kickConferenceAll', () => { it('should make a DELETE request to remove all participants from a conference', async () => { // Given