bandwidth-sdk 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +3 -3
- package/.github/workflows/test-nightly.yml +49 -54
- package/.github/workflows/test-pr.yml +40 -40
- package/.openapi-generator/VERSION +1 -1
- package/api/calls-api.ts +37 -37
- package/api/conferences-api.ts +62 -62
- package/api/media-api.ts +28 -28
- package/api/messages-api.ts +22 -22
- package/api/mfaapi.ts +28 -28
- package/api/phone-number-lookup-api.ts +18 -18
- package/api/recordings-api.ts +67 -67
- package/api/statistics-api.ts +10 -10
- package/api/transcriptions-api.ts +23 -23
- package/bandwidth.yml +20 -11
- package/base.ts +2 -2
- package/coverage/clover.xml +190 -1582
- package/coverage/coverage-final.json +47 -64
- package/coverage/lcov-report/index.html +24 -69
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/Bxml.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/NestableVerb.ts.html +30 -30
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/Response.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/Root.ts.html +23 -23
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/Verb.ts.html +20 -20
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/index.html +24 -39
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Bridge.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Conference.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/CustomParam.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Forward.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Gather.ts.html +19 -19
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Hangup.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Pause.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/PauseRecording.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/PhoneNumber.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/PlayAudio.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Record.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Redirect.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/ResumeRecording.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Ring.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/SendDtmf.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/SipUri.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/SpeakSentence.ts.html +17 -17
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StartGather.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StartRecording.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StartStream.ts.html +16 -16
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StartTranscription.ts.html +16 -16
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StopGather.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StopRecording.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StopStream.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StopTranscription.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/StreamParam.ts.html +15 -15
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Tag.ts.html +14 -14
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/Transfer.ts.html +16 -16
- package/coverage/lcov-report/{node-sdk/models → models}/bxml/verbs/index.html +12 -27
- package/coverage/lcov-report/{node-sdk/models → models}/call-direction-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/call-state-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/callback-method-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/conference-state-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/file-format-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/index.html +12 -42
- package/coverage/lcov-report/{node-sdk/models → models}/list-message-direction-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/lookup-status-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/machine-detection-mode-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/message-direction-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/message-status-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/message-type-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/priority-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/recording-state-enum.ts.html +11 -11
- package/coverage/lcov-report/{node-sdk/models → models}/redirect-method-enum.ts.html +11 -11
- package/coverage/lcov.info +323 -3571
- package/custom_templates/package.mustache +5 -2
- package/dist/api/calls-api.d.ts +21 -21
- package/dist/api/calls-api.js +69 -40
- package/dist/api/conferences-api.d.ts +34 -34
- package/dist/api/conferences-api.js +117 -72
- package/dist/api/media-api.d.ts +15 -15
- package/dist/api/media-api.js +57 -32
- package/dist/api/messages-api.d.ts +14 -14
- package/dist/api/messages-api.js +33 -16
- package/dist/api/mfaapi.d.ts +16 -16
- package/dist/api/mfaapi.js +45 -24
- package/dist/api/phone-number-lookup-api.d.ts +11 -11
- package/dist/api/phone-number-lookup-api.js +33 -16
- package/dist/api/recordings-api.d.ts +36 -36
- package/dist/api/recordings-api.js +129 -80
- package/dist/api/statistics-api.d.ts +6 -6
- package/dist/api/statistics-api.js +21 -8
- package/dist/api/transcriptions-api.d.ts +13 -13
- package/dist/api/transcriptions-api.js +45 -24
- package/dist/base.d.ts +2 -2
- package/dist/models/answer-callback.d.ts +3 -3
- package/dist/models/bridge-complete-callback.d.ts +2 -2
- package/dist/models/bridge-target-complete-callback.d.ts +2 -2
- package/dist/models/bxml/verbs/Bridge.d.ts +1 -2
- package/dist/models/bxml/verbs/Conference.d.ts +1 -2
- package/dist/models/bxml/verbs/CustomParam.d.ts +1 -2
- package/dist/models/bxml/verbs/Forward.d.ts +1 -2
- package/dist/models/bxml/verbs/Gather.d.ts +2 -2
- package/dist/models/bxml/verbs/Pause.d.ts +1 -2
- package/dist/models/bxml/verbs/PhoneNumber.d.ts +1 -2
- package/dist/models/bxml/verbs/PlayAudio.d.ts +1 -2
- package/dist/models/bxml/verbs/Record.d.ts +1 -2
- package/dist/models/bxml/verbs/Redirect.d.ts +1 -2
- package/dist/models/bxml/verbs/Ring.d.ts +1 -2
- package/dist/models/bxml/verbs/SendDtmf.d.ts +1 -2
- package/dist/models/bxml/verbs/SipUri.d.ts +1 -2
- package/dist/models/bxml/verbs/SpeakSentence.d.ts +1 -2
- package/dist/models/bxml/verbs/StartGather.d.ts +1 -2
- package/dist/models/bxml/verbs/StartRecording.d.ts +1 -2
- package/dist/models/bxml/verbs/StartStream.d.ts +1 -2
- package/dist/models/bxml/verbs/StartTranscription.d.ts +1 -2
- package/dist/models/bxml/verbs/StopStream.d.ts +1 -2
- package/dist/models/bxml/verbs/StopTranscription.d.ts +1 -2
- package/dist/models/bxml/verbs/StreamParam.d.ts +1 -2
- package/dist/models/bxml/verbs/Transfer.d.ts +1 -1
- package/dist/models/call-recording-metadata.d.ts +5 -5
- package/dist/models/call-state.d.ts +1 -1
- package/dist/models/call-transcription-response.d.ts +1 -1
- package/dist/models/conference-member-exit-callback.d.ts +1 -1
- package/dist/models/conference-member-join-callback.d.ts +1 -1
- package/dist/models/conference-recording-available-callback.d.ts +1 -1
- package/dist/models/conference-recording-metadata.d.ts +1 -1
- package/dist/models/conference.d.ts +2 -2
- package/dist/models/create-call-response.d.ts +1 -1
- package/dist/models/create-call.d.ts +10 -4
- package/dist/models/create-lookup-response.d.ts +1 -1
- package/dist/models/create-message-request-error.d.ts +1 -1
- package/dist/models/disconnect-callback.d.ts +2 -2
- package/dist/models/dtmf-callback.d.ts +3 -3
- package/dist/models/gather-callback.d.ts +3 -3
- package/dist/models/inbound-message-callback-message.d.ts +2 -2
- package/dist/models/inbound-message-callback.d.ts +1 -1
- package/dist/models/initiate-callback.d.ts +4 -4
- package/dist/models/list-message-item.d.ts +3 -3
- package/dist/models/lookup-status.d.ts +2 -2
- package/dist/models/machine-detection-complete-callback.d.ts +3 -3
- package/dist/models/machine-detection-configuration.d.ts +3 -3
- package/dist/models/message-delivered-callback-message.d.ts +2 -2
- package/dist/models/message-delivered-callback.d.ts +1 -1
- package/dist/models/message-failed-callback-message.d.ts +2 -2
- package/dist/models/message-failed-callback.d.ts +1 -1
- package/dist/models/message-request.d.ts +1 -1
- package/dist/models/message-sending-callback-message.d.ts +2 -2
- package/dist/models/message-sending-callback.d.ts +1 -1
- package/dist/models/message.d.ts +2 -2
- package/dist/models/messages-list.d.ts +2 -2
- package/dist/models/recording-available-callback.d.ts +4 -4
- package/dist/models/recording-complete-callback.d.ts +4 -4
- package/dist/models/recording-transcriptions.d.ts +1 -1
- package/dist/models/redirect-callback.d.ts +3 -3
- package/dist/models/transcribe-recording.d.ts +1 -1
- package/dist/models/transcription-available-callback.d.ts +5 -5
- package/dist/models/transfer-answer-callback.d.ts +3 -3
- package/dist/models/transfer-complete-callback.d.ts +3 -3
- package/dist/models/transfer-disconnect-callback.d.ts +3 -3
- package/dist/models/update-call-recording.d.ts +1 -1
- package/dist/models/update-call.d.ts +2 -2
- package/dist/models/update-conference.d.ts +2 -2
- package/models/answer-callback.ts +3 -3
- package/models/bridge-complete-callback.ts +2 -2
- package/models/bridge-target-complete-callback.ts +2 -2
- package/models/bxml/verbs/Bridge.ts +1 -1
- package/models/bxml/verbs/Conference.ts +1 -1
- package/models/bxml/verbs/CustomParam.ts +1 -1
- package/models/bxml/verbs/Forward.ts +1 -1
- package/models/bxml/verbs/Gather.ts +2 -2
- package/models/bxml/verbs/Pause.ts +1 -1
- package/models/bxml/verbs/PhoneNumber.ts +1 -1
- package/models/bxml/verbs/PlayAudio.ts +1 -1
- package/models/bxml/verbs/Record.ts +1 -1
- package/models/bxml/verbs/Redirect.ts +1 -1
- package/models/bxml/verbs/Ring.ts +1 -1
- package/models/bxml/verbs/SendDtmf.ts +1 -1
- package/models/bxml/verbs/SipUri.ts +1 -1
- package/models/bxml/verbs/SpeakSentence.ts +1 -1
- package/models/bxml/verbs/StartGather.ts +1 -1
- package/models/bxml/verbs/StartRecording.ts +1 -1
- package/models/bxml/verbs/StartStream.ts +1 -1
- package/models/bxml/verbs/StartTranscription.ts +1 -1
- package/models/bxml/verbs/StopStream.ts +1 -1
- package/models/bxml/verbs/StopTranscription.ts +1 -1
- package/models/bxml/verbs/StreamParam.ts +1 -1
- package/models/bxml/verbs/Transfer.ts +1 -1
- package/models/call-recording-metadata.ts +5 -5
- package/models/call-state.ts +1 -1
- package/models/call-transcription-response.ts +1 -1
- package/models/conference-member-exit-callback.ts +1 -1
- package/models/conference-member-join-callback.ts +1 -1
- package/models/conference-recording-available-callback.ts +1 -1
- package/models/conference-recording-metadata.ts +1 -1
- package/models/conference.ts +2 -2
- package/models/create-call-response.ts +1 -1
- package/models/create-call.ts +10 -4
- package/models/create-lookup-response.ts +1 -1
- package/models/create-message-request-error.ts +1 -1
- package/models/disconnect-callback.ts +2 -2
- package/models/dtmf-callback.ts +3 -3
- package/models/gather-callback.ts +3 -3
- package/models/inbound-message-callback-message.ts +2 -2
- package/models/inbound-message-callback.ts +1 -1
- package/models/initiate-callback.ts +4 -4
- package/models/list-message-item.ts +3 -3
- package/models/lookup-status.ts +2 -2
- package/models/machine-detection-complete-callback.ts +3 -3
- package/models/machine-detection-configuration.ts +3 -3
- package/models/message-delivered-callback-message.ts +2 -2
- package/models/message-delivered-callback.ts +1 -1
- package/models/message-failed-callback-message.ts +2 -2
- package/models/message-failed-callback.ts +1 -1
- package/models/message-request.ts +1 -1
- package/models/message-sending-callback-message.ts +2 -2
- package/models/message-sending-callback.ts +1 -1
- package/models/message.ts +2 -2
- package/models/messages-list.ts +2 -2
- package/models/recording-available-callback.ts +4 -4
- package/models/recording-complete-callback.ts +4 -4
- package/models/recording-transcriptions.ts +1 -1
- package/models/redirect-callback.ts +3 -3
- package/models/transcribe-recording.ts +1 -1
- package/models/transcription-available-callback.ts +5 -5
- package/models/transfer-answer-callback.ts +3 -3
- package/models/transfer-complete-callback.ts +3 -3
- package/models/transfer-disconnect-callback.ts +3 -3
- package/models/update-call-recording.ts +1 -1
- package/models/update-call.ts +2 -2
- package/models/update-conference.ts +2 -2
- package/openapitools.json +1 -1
- package/package.json +6 -3
- package/tests/callUtils.ts +84 -0
- package/tests/{integration/bxml.test.js → smoke/bxml.test.ts} +59 -40
- package/tests/{integration/calls-api.test.js → smoke/calls-api.test.ts} +56 -48
- package/tests/{integration/conferences-api.test.js → smoke/conferences-api.test.ts} +28 -29
- package/tests/{integration/media-api.test.js → smoke/media-api.test.ts} +18 -17
- package/tests/smoke/messages-api.test.ts +115 -0
- package/tests/{integration/mfaapi.test.js → smoke/mfaapi.test.ts} +27 -25
- package/tests/{integration/phone-number-lookup-api.test.js → smoke/phone-number-lookup-api.test.ts} +9 -7
- package/tests/{integration/recordings-api.test.js → smoke/recordings-api.test.ts} +37 -37
- package/tests/{integration/statistics-api.test.js → smoke/statistics-api.test.ts} +9 -8
- package/tests/{integration/transcriptions-api.test.js → smoke/transcriptions-api.test.ts} +25 -25
- package/tests/unit/{bxml/Bxml.test.js → models/bxml/Bxml.test.ts} +3 -3
- package/tests/unit/{bxml/NestableVerb.test.js → models/bxml/NestableVerb.test.ts} +2 -2
- package/tests/unit/{bxml/Response.test.js → models/bxml/Response.test.ts} +3 -3
- package/tests/unit/{bxml/Verb.test.js → models/bxml/Verb.test.ts} +1 -1
- package/tests/unit/{bxml/verbs/Bridge.test.js → models/bxml/verbs/Bridge.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/Conference.test.js → models/bxml/verbs/Conference.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/CustomParam.test.js → models/bxml/verbs/CustomParam.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/Forward.test.js → models/bxml/verbs/Forward.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/Gather.test.js → models/bxml/verbs/Gather.test.ts} +5 -5
- package/tests/unit/{bxml/verbs/Hangup.test.js → models/bxml/verbs/Hangup.test.ts} +2 -2
- package/tests/unit/{bxml/verbs/Pause.test.js → models/bxml/verbs/Pause.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/PauseRecording.test.js → models/bxml/verbs/PauseRecording.test.ts} +2 -2
- package/tests/unit/{bxml/verbs/PhoneNumber.test.js → models/bxml/verbs/PhoneNumber.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/PlayAudio.test.js → models/bxml/verbs/PlayAudio.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/Record.test.js → models/bxml/verbs/Record.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/Redirect.test.js → models/bxml/verbs/Redirect.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/ResumeRecording.test.js → models/bxml/verbs/ResumeRecording.test.ts} +2 -2
- package/tests/unit/{bxml/verbs/Ring.test.js → models/bxml/verbs/Ring.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/SendDtmf.test.js → models/bxml/verbs/SendDtmf.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/SipUri.test.js → models/bxml/verbs/SipUri.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/SpeakSentence.test.js → models/bxml/verbs/SpeakSentence.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/StartGather.test.js → models/bxml/verbs/StartGather.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/StartRecording.test.js → models/bxml/verbs/StartRecording.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/StartStream.test.js → models/bxml/verbs/StartStream.test.ts} +4 -4
- package/tests/unit/{bxml/verbs/StartTranscription.test.js → models/bxml/verbs/StartTranscription.test.ts} +4 -4
- package/tests/unit/{bxml/verbs/StopGather.test.js → models/bxml/verbs/StopGather.test.ts} +2 -2
- package/tests/unit/{bxml/verbs/StopRecording.test.js → models/bxml/verbs/StopRecording.test.ts} +2 -2
- package/tests/unit/{bxml/verbs/StopStream.test.js → models/bxml/verbs/StopStream.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/StopTranscription.test.js → models/bxml/verbs/StopTranscription.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/StreamParam.test.js → models/bxml/verbs/StreamParam.test.ts} +3 -3
- package/tests/unit/{bxml/verbs/Tag.test.js → models/bxml/verbs/Tag.test.ts} +2 -2
- package/tests/unit/{bxml/verbs/Transfer.test.js → models/bxml/verbs/Transfer.test.ts} +5 -5
- package/tests/unit/{call-direction-enum.test.js → models/call-direction-enum.test.ts} +1 -1
- package/tests/unit/{call-state-enum.test.js → models/call-state-enum.test.ts} +1 -1
- package/tests/unit/{callback-method-enum.test.js → models/callback-method-enum.test.ts} +1 -1
- package/tests/unit/{conference-state-enum.test.js → models/conference-state-enum.test.ts} +1 -1
- package/tests/unit/{file-format-enum.test.js → models/file-format-enum.test.ts} +1 -1
- package/tests/unit/{list-message-direction-enum.test.js → models/list-message-direction-enum.test.ts} +1 -1
- package/tests/unit/{lookup-status-enum.test.js → models/lookup-status-enum.test.ts} +1 -1
- package/tests/unit/{machine-detection-mode-enum.test.js → models/machine-detection-mode-enum.test.ts} +1 -1
- package/tests/unit/{message-direction-enum.test.js → models/message-direction-enum.test.ts} +1 -1
- package/tests/unit/{message-status-enum.test.js → models/message-status-enum.test.ts} +1 -1
- package/tests/unit/{message-type-enum.test.js → models/message-type-enum.test.ts} +1 -1
- package/tests/unit/{priority-enum.test.js → models/priority-enum.test.ts} +1 -1
- package/tests/unit/{recording-state-enum.test.js → models/recording-state-enum.test.ts} +1 -1
- package/tests/unit/{redirect-method-enum.test.js → models/redirect-method-enum.test.ts} +1 -1
- package/coverage/lcov-report/node-sdk/api/calls-api.ts.html +0 -1702
- package/coverage/lcov-report/node-sdk/api/conferences-api.ts.html +0 -2725
- package/coverage/lcov-report/node-sdk/api/index.html +0 -236
- package/coverage/lcov-report/node-sdk/api/media-api.ts.html +0 -1315
- package/coverage/lcov-report/node-sdk/api/messages-api.ts.html +0 -1138
- package/coverage/lcov-report/node-sdk/api/mfaapi.ts.html +0 -1051
- package/coverage/lcov-report/node-sdk/api/phone-number-lookup-api.ts.html +0 -775
- package/coverage/lcov-report/node-sdk/api/recordings-api.ts.html +0 -2971
- package/coverage/lcov-report/node-sdk/api/statistics-api.ts.html +0 -496
- package/coverage/lcov-report/node-sdk/api/transcriptions-api.ts.html +0 -1045
- package/coverage/lcov-report/node-sdk/base.ts.html +0 -1045
- package/coverage/lcov-report/node-sdk/common.ts.html +0 -535
- package/coverage/lcov-report/node-sdk/configuration.ts.html +0 -415
- package/coverage/lcov-report/node-sdk/index.html +0 -146
- package/coverage/lcov-report/node-sdk/models/bxml/index.ts.html +0 -94
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.ts.html +0 -175
- package/coverage/lcov-report/node-sdk/models/call-transcription.ts.html +0 -274
- package/coverage/lcov-report/node-sdk/models/index.ts.html +0 -361
- package/coverage/lcov-report/node-sdk/tests/callUtils.js.html +0 -334
- package/coverage/lcov-report/node-sdk/tests/index.html +0 -116
- package/tests/callUtils.js +0 -83
- package/tests/integration/messages-api.test.js +0 -114
|
@@ -1,15 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { CallsApi } from '../../api';
|
|
3
|
+
import { Configuration } from '../../configuration';
|
|
4
|
+
import { Bxml, CallStateEnum } from '../../models';
|
|
5
|
+
import {
|
|
6
|
+
BridgeAttributes,
|
|
7
|
+
ConferenceAttributes,
|
|
8
|
+
ForwardAttributes,
|
|
9
|
+
GatherAttributes,
|
|
10
|
+
RecordAttributes,
|
|
11
|
+
RedirectAttributes,
|
|
12
|
+
RingAttributes,
|
|
13
|
+
SendDtmfAttributes,
|
|
14
|
+
SpeakSentenceAttributes,
|
|
15
|
+
StartGatherAttributes,
|
|
16
|
+
StartRecordingAttributes,
|
|
17
|
+
StartStreamAttributes,
|
|
18
|
+
StartTranscriptionAttributes,
|
|
19
|
+
StopStreamAttributes,
|
|
20
|
+
StopTranscriptionAttributes,
|
|
21
|
+
TransferAttributes
|
|
22
|
+
} from '../../models/bxml/verbs';
|
|
23
|
+
import { sleep, createMantecaCall, cleanupCalls } from '../callUtils';
|
|
5
24
|
|
|
6
25
|
describe('BXML Integration Tests', () => {
|
|
7
26
|
jest.setTimeout(20000);
|
|
8
|
-
|
|
9
|
-
const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
|
|
27
|
+
|
|
28
|
+
const config = new Configuration({username: globalThis.BW_USERNAME, password: globalThis.BW_PASSWORD});
|
|
10
29
|
const callsApi = new CallsApi(config);
|
|
11
|
-
let activeCalls = [];
|
|
12
|
-
|
|
30
|
+
let activeCalls: string[] = [];
|
|
31
|
+
|
|
13
32
|
afterAll(async () => {
|
|
14
33
|
await cleanupCalls(activeCalls, callsApi);
|
|
15
34
|
});
|
|
@@ -18,9 +37,9 @@ describe('BXML Integration Tests', () => {
|
|
|
18
37
|
const updateCallId = await createMantecaCall(callsApi);
|
|
19
38
|
const bridgeCallId = await createMantecaCall(callsApi);
|
|
20
39
|
activeCalls.push(updateCallId, bridgeCallId);
|
|
21
|
-
await sleep(SLEEP_TIME_S);
|
|
40
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
22
41
|
|
|
23
|
-
const conferenceAttributes = {
|
|
42
|
+
const conferenceAttributes: ConferenceAttributes = {
|
|
24
43
|
mute: true,
|
|
25
44
|
hold: true,
|
|
26
45
|
callIdsToCoach: updateCallId,
|
|
@@ -36,7 +55,7 @@ describe('BXML Integration Tests', () => {
|
|
|
36
55
|
callbackTimeout: 1.1
|
|
37
56
|
};
|
|
38
57
|
|
|
39
|
-
const gatherAttributes = {
|
|
58
|
+
const gatherAttributes: GatherAttributes = {
|
|
40
59
|
gatherUrl: 'https://initial.com',
|
|
41
60
|
gatherMethod: 'POST',
|
|
42
61
|
gatherFallbackUrl: 'https://initial.com',
|
|
@@ -53,13 +72,13 @@ describe('BXML Integration Tests', () => {
|
|
|
53
72
|
repeatCount: 1
|
|
54
73
|
};
|
|
55
74
|
|
|
56
|
-
const speakSentenceAttributes = {
|
|
75
|
+
const speakSentenceAttributes: SpeakSentenceAttributes = {
|
|
57
76
|
voice: 'julie',
|
|
58
77
|
gender: 'female',
|
|
59
78
|
locale: 'en_US'
|
|
60
79
|
};
|
|
61
80
|
|
|
62
|
-
const recordAttributes = {
|
|
81
|
+
const recordAttributes: RecordAttributes = {
|
|
63
82
|
recordCompleteUrl: 'https://initial.com',
|
|
64
83
|
recordCompleteMethod: 'POST',
|
|
65
84
|
recordCompleteFallbackUrl: 'https://initial.com',
|
|
@@ -80,17 +99,17 @@ describe('BXML Integration Tests', () => {
|
|
|
80
99
|
fileFormat: 'wav'
|
|
81
100
|
};
|
|
82
101
|
|
|
83
|
-
const sendDtmfAttributes = {
|
|
102
|
+
const sendDtmfAttributes: SendDtmfAttributes = {
|
|
84
103
|
toneDuration: 50,
|
|
85
104
|
toneInterval: 50
|
|
86
105
|
};
|
|
87
106
|
|
|
88
|
-
const ringAttributes = {
|
|
107
|
+
const ringAttributes: RingAttributes = {
|
|
89
108
|
duration: 5.1,
|
|
90
109
|
answerCall: true
|
|
91
110
|
};
|
|
92
111
|
|
|
93
|
-
const bridgeAttributes = {
|
|
112
|
+
const bridgeAttributes: BridgeAttributes = {
|
|
94
113
|
bridgeCompleteUrl: 'https://initial.com',
|
|
95
114
|
bridgeCompleteMethod: 'POST',
|
|
96
115
|
bridgeCompleteFallbackUrl: 'https://initial.com',
|
|
@@ -106,7 +125,7 @@ describe('BXML Integration Tests', () => {
|
|
|
106
125
|
tag: 'initialTag'
|
|
107
126
|
};
|
|
108
127
|
|
|
109
|
-
const transferAttributes = {
|
|
128
|
+
const transferAttributes: TransferAttributes = {
|
|
110
129
|
transferCallerId: '+19195551234',
|
|
111
130
|
transferCallerDisplayName: 'initialDisplayName',
|
|
112
131
|
callTimeout: 5,
|
|
@@ -143,21 +162,21 @@ describe('BXML Integration Tests', () => {
|
|
|
143
162
|
const bxml = new Bxml.Response([tag, conference, speakSentence, gather, sendDtmf, nestedGather, pause, record, playAudio, sendDtmf, ring, bridge, transfer, hangup]);
|
|
144
163
|
|
|
145
164
|
const { status: updateStatus } =
|
|
146
|
-
await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
165
|
+
await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
147
166
|
expect(updateStatus).toEqual(204);
|
|
148
|
-
await sleep(SLEEP_TIME_S);
|
|
167
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
149
168
|
|
|
150
169
|
const { status: completeStatus } =
|
|
151
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
170
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
152
171
|
expect(completeStatus).toEqual(200);
|
|
153
172
|
});
|
|
154
173
|
|
|
155
174
|
test('test start and stop verbs', async () => {
|
|
156
175
|
const updateCallId = await createMantecaCall(callsApi);
|
|
157
176
|
activeCalls.push(updateCallId);
|
|
158
|
-
await sleep(SLEEP_TIME_S);
|
|
177
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
159
178
|
|
|
160
|
-
const startGatherAttributes = {
|
|
179
|
+
const startGatherAttributes: StartGatherAttributes = {
|
|
161
180
|
dtmfUrl: 'https://initial.com',
|
|
162
181
|
dtmfMethod: 'POST',
|
|
163
182
|
username: 'initialUsername',
|
|
@@ -165,7 +184,7 @@ describe('BXML Integration Tests', () => {
|
|
|
165
184
|
tag: 'initialTag'
|
|
166
185
|
};
|
|
167
186
|
|
|
168
|
-
const startRecordingAttributes = {
|
|
187
|
+
const startRecordingAttributes: StartRecordingAttributes = {
|
|
169
188
|
recordingAvailableUrl: 'https://initial.com',
|
|
170
189
|
recordingAvailableMethod: 'POST',
|
|
171
190
|
transcribe: true,
|
|
@@ -178,7 +197,7 @@ describe('BXML Integration Tests', () => {
|
|
|
178
197
|
multiChannel: true
|
|
179
198
|
};
|
|
180
199
|
|
|
181
|
-
const startStreamAttributes = {
|
|
200
|
+
const startStreamAttributes: StartStreamAttributes = {
|
|
182
201
|
name: 'initialName',
|
|
183
202
|
tracks: 'inbound',
|
|
184
203
|
destination: 'wss://initial.com',
|
|
@@ -188,7 +207,7 @@ describe('BXML Integration Tests', () => {
|
|
|
188
207
|
password: 'initialPassword'
|
|
189
208
|
};
|
|
190
209
|
|
|
191
|
-
const startTranscriptionAttributes = {
|
|
210
|
+
const startTranscriptionAttributes: StartTranscriptionAttributes = {
|
|
192
211
|
name: 'initialName',
|
|
193
212
|
tracks: 'inbound',
|
|
194
213
|
transcriptionEventUrl: 'https://initial.com',
|
|
@@ -199,11 +218,11 @@ describe('BXML Integration Tests', () => {
|
|
|
199
218
|
stabilized: true
|
|
200
219
|
};
|
|
201
220
|
|
|
202
|
-
const stopStreamAttributes = {
|
|
221
|
+
const stopStreamAttributes: StopStreamAttributes = {
|
|
203
222
|
name: 'initialName'
|
|
204
223
|
};
|
|
205
224
|
|
|
206
|
-
const stopTranscriptionAttributes = {
|
|
225
|
+
const stopTranscriptionAttributes: StopTranscriptionAttributes = {
|
|
207
226
|
name: 'initialName'
|
|
208
227
|
};
|
|
209
228
|
|
|
@@ -224,21 +243,21 @@ describe('BXML Integration Tests', () => {
|
|
|
224
243
|
const bxml = new Bxml.Bxml([startGather, stopGather, startRecording, pauseRecording, resumeRecording, stopRecording, startStream, stopStream, startTranscription, stopTranscription]);
|
|
225
244
|
|
|
226
245
|
const { status: updateStatus } =
|
|
227
|
-
await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
246
|
+
await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
228
247
|
expect(updateStatus).toEqual(204);
|
|
229
|
-
await sleep(SLEEP_TIME_S);
|
|
248
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
230
249
|
|
|
231
250
|
const { status: completeStatus } =
|
|
232
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
251
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
233
252
|
expect(completeStatus).toEqual(200);
|
|
234
253
|
});
|
|
235
254
|
|
|
236
255
|
test('test forward', async () => {
|
|
237
256
|
const updateCallId = await createMantecaCall(callsApi);
|
|
238
257
|
activeCalls.push(updateCallId);
|
|
239
|
-
await sleep(SLEEP_TIME_S);
|
|
258
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
240
259
|
|
|
241
|
-
const forwardAttributes = {
|
|
260
|
+
const forwardAttributes: ForwardAttributes = {
|
|
242
261
|
to: '+19195551234',
|
|
243
262
|
from: '+19195554321',
|
|
244
263
|
callTimeout: 5,
|
|
@@ -252,12 +271,12 @@ describe('BXML Integration Tests', () => {
|
|
|
252
271
|
const bxml = new Bxml.Response([forward]);
|
|
253
272
|
|
|
254
273
|
const { status: updateStatus } =
|
|
255
|
-
await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
274
|
+
await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
256
275
|
expect(updateStatus).toEqual(204);
|
|
257
|
-
await sleep(SLEEP_TIME_S);
|
|
276
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
258
277
|
|
|
259
278
|
const { status: completeStatus } =
|
|
260
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
279
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
261
280
|
expect(completeStatus).toEqual(200);
|
|
262
281
|
|
|
263
282
|
});
|
|
@@ -265,9 +284,9 @@ describe('BXML Integration Tests', () => {
|
|
|
265
284
|
test('test redirect', async () => {
|
|
266
285
|
const updateCallId = await createMantecaCall(callsApi);
|
|
267
286
|
activeCalls.push(updateCallId);
|
|
268
|
-
await sleep(SLEEP_TIME_S);
|
|
287
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
269
288
|
|
|
270
|
-
const redirectAttributes = {
|
|
289
|
+
const redirectAttributes: RedirectAttributes = {
|
|
271
290
|
redirectUrl: 'https://initial.com',
|
|
272
291
|
redirectMethod: 'POST',
|
|
273
292
|
redirectFallbackUrl: 'https://initial.com',
|
|
@@ -284,12 +303,12 @@ describe('BXML Integration Tests', () => {
|
|
|
284
303
|
const bxml = new Bxml.Response([redirect]);
|
|
285
304
|
|
|
286
305
|
const { status: updateStatus } =
|
|
287
|
-
await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
306
|
+
await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
|
|
288
307
|
expect(updateStatus).toEqual(204);
|
|
289
|
-
await sleep(SLEEP_TIME_S);
|
|
308
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
290
309
|
|
|
291
310
|
const { status: completeStatus } =
|
|
292
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
311
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
293
312
|
expect(completeStatus).toEqual(200);
|
|
294
313
|
});
|
|
295
314
|
});
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { CallsApi } from '../../api';
|
|
3
|
+
import { Configuration } from '../../configuration';
|
|
4
|
+
import {
|
|
5
|
+
CallbackMethodEnum,
|
|
6
|
+
CallDirectionEnum,
|
|
7
|
+
CallStateEnum,
|
|
8
|
+
CreateCall,
|
|
9
|
+
MachineDetectionConfiguration,
|
|
10
|
+
UpdateCall
|
|
11
|
+
} from '../../models';
|
|
12
|
+
import { createMantecaCall, sleep, cleanupCalls } from '../callUtils';
|
|
6
13
|
|
|
7
14
|
describe('CallsApi', () => {
|
|
8
15
|
jest.setTimeout(45000);
|
|
9
|
-
const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
|
|
16
|
+
const config = new Configuration({username: globalThis.BW_USERNAME, password: globalThis.BW_PASSWORD});
|
|
10
17
|
const callsApi = new CallsApi(config);
|
|
11
18
|
|
|
12
19
|
const displayName = 'NodeJS SDK';
|
|
13
20
|
const answerMethod = CallbackMethodEnum.Post;
|
|
14
|
-
const answerUrl = `${BASE_CALLBACK_URL}/callbacks/answer`;
|
|
21
|
+
const answerUrl = `${globalThis.BASE_CALLBACK_URL}/callbacks/answer`;
|
|
15
22
|
const answerFallbackMethod = CallbackMethodEnum.Post;
|
|
16
23
|
const disconnectMethod = CallbackMethodEnum.Get;
|
|
17
|
-
const disconnectUrl = `${BASE_CALLBACK_URL}/callbacks/disconnect`;
|
|
24
|
+
const disconnectUrl = `${globalThis.BASE_CALLBACK_URL}/callbacks/disconnect`;
|
|
18
25
|
const priority = 5;
|
|
19
26
|
const direction = CallDirectionEnum.Outbound;
|
|
20
27
|
const callTimeout = 30.0;
|
|
21
28
|
const callbackTimeout = 15.0;
|
|
22
29
|
|
|
23
|
-
let callId;
|
|
24
|
-
let activeCalls = [];
|
|
30
|
+
let callId: string;
|
|
31
|
+
let activeCalls: string[] = [];
|
|
25
32
|
|
|
26
33
|
afterAll(async () => {
|
|
27
34
|
await cleanupCalls(activeCalls, callsApi);
|
|
@@ -29,21 +36,22 @@ describe('CallsApi', () => {
|
|
|
29
36
|
|
|
30
37
|
describe('createCall', () => {
|
|
31
38
|
test('should create a call', async () => {
|
|
32
|
-
const amdConfig = {
|
|
39
|
+
const amdConfig: MachineDetectionConfiguration = {
|
|
33
40
|
mode: 'async',
|
|
34
41
|
detectionTimeout: 5.0,
|
|
35
42
|
silenceTimeout: 5.0,
|
|
36
43
|
speechThreshold: 5.0,
|
|
37
|
-
|
|
44
|
+
speechEndThreshold: 5.0,
|
|
38
45
|
delayResult: true,
|
|
39
|
-
callbackUrl: BASE_CALLBACK_URL + '/machineDetection',
|
|
46
|
+
callbackUrl: globalThis.BASE_CALLBACK_URL + '/machineDetection',
|
|
40
47
|
callbackMethod: CallbackMethodEnum.Post
|
|
41
48
|
};
|
|
42
49
|
|
|
43
|
-
const callBody = {
|
|
44
|
-
applicationId: BW_VOICE_APPLICATION_ID,
|
|
45
|
-
to: USER_NUMBER,
|
|
46
|
-
from: BW_NUMBER,
|
|
50
|
+
const callBody: CreateCall = {
|
|
51
|
+
applicationId: globalThis.BW_VOICE_APPLICATION_ID,
|
|
52
|
+
to: globalThis.USER_NUMBER,
|
|
53
|
+
from: globalThis.BW_NUMBER,
|
|
54
|
+
privacy: false,
|
|
47
55
|
displayName: displayName,
|
|
48
56
|
answerUrl: answerUrl,
|
|
49
57
|
answerMethod: answerMethod,
|
|
@@ -54,14 +62,14 @@ describe('CallsApi', () => {
|
|
|
54
62
|
callbackTimeout: callbackTimeout
|
|
55
63
|
};
|
|
56
64
|
|
|
57
|
-
const { status, data } = await callsApi.createCall(BW_ACCOUNT_ID, callBody);
|
|
65
|
+
const { status, data } = await callsApi.createCall(globalThis.BW_ACCOUNT_ID, callBody);
|
|
58
66
|
|
|
59
67
|
expect(status).toEqual(201);
|
|
60
|
-
expect(data.applicationId).toEqual(BW_VOICE_APPLICATION_ID);
|
|
61
|
-
expect(data.accountId).toEqual(BW_ACCOUNT_ID);
|
|
68
|
+
expect(data.applicationId).toEqual(globalThis.BW_VOICE_APPLICATION_ID);
|
|
69
|
+
expect(data.accountId).toEqual(globalThis.BW_ACCOUNT_ID);
|
|
62
70
|
expect(data.callId).toHaveLength(47);
|
|
63
|
-
expect(data.to).toEqual(USER_NUMBER);
|
|
64
|
-
expect(data.from).toEqual(BW_NUMBER);
|
|
71
|
+
expect(data.to).toEqual(globalThis.USER_NUMBER);
|
|
72
|
+
expect(data.from).toEqual(globalThis.BW_NUMBER);
|
|
65
73
|
expect(data.callTimeout).toEqual(callTimeout);
|
|
66
74
|
expect(data.callbackTimeout).toEqual(callbackTimeout);
|
|
67
75
|
expect(data.answerMethod).toEqual(answerMethod);
|
|
@@ -79,25 +87,25 @@ describe('CallsApi', () => {
|
|
|
79
87
|
describe('getCall', () => {
|
|
80
88
|
test('should return a call', async () => {
|
|
81
89
|
await sleep(40); // wait 40s for voice API to update call status
|
|
82
|
-
const { status, data } = await callsApi.getCallState(BW_ACCOUNT_ID, callId);
|
|
90
|
+
const { status, data } = await callsApi.getCallState(globalThis.BW_ACCOUNT_ID, callId);
|
|
83
91
|
|
|
84
92
|
expect(status).toEqual(200);
|
|
85
|
-
expect(data.accountId).toEqual(BW_ACCOUNT_ID);
|
|
86
|
-
expect(data.applicationId).toEqual(BW_VOICE_APPLICATION_ID);
|
|
93
|
+
expect(data.accountId).toEqual(globalThis.BW_ACCOUNT_ID);
|
|
94
|
+
expect(data.applicationId).toEqual(globalThis.BW_VOICE_APPLICATION_ID);
|
|
87
95
|
expect(data.callId).toHaveLength(47);
|
|
88
|
-
expect(data.to).toEqual(USER_NUMBER);
|
|
89
|
-
expect(data.from).toEqual(BW_NUMBER);
|
|
96
|
+
expect(data.to).toEqual(globalThis.USER_NUMBER);
|
|
97
|
+
expect(data.from).toEqual(globalThis.BW_NUMBER);
|
|
90
98
|
expect(data.direction).toEqual(direction);
|
|
91
99
|
});
|
|
92
100
|
});
|
|
93
101
|
|
|
94
102
|
describe('getCalls', () => {
|
|
95
103
|
test('should return an array of calls', async () => {
|
|
96
|
-
const { status, data } = await callsApi.listCalls(BW_ACCOUNT_ID);
|
|
104
|
+
const { status, data } = await callsApi.listCalls(globalThis.BW_ACCOUNT_ID);
|
|
97
105
|
|
|
98
106
|
expect(status).toEqual(200);
|
|
99
107
|
expect(data).toBeInstanceOf(Array);
|
|
100
|
-
expect(data[0].accountId).toEqual(BW_ACCOUNT_ID);
|
|
108
|
+
expect(data[0].accountId).toEqual(globalThis.BW_ACCOUNT_ID);
|
|
101
109
|
expect(data[0].applicationId).toHaveLength(36);
|
|
102
110
|
expect(data[0].callId).toHaveLength(47);
|
|
103
111
|
});
|
|
@@ -105,22 +113,22 @@ describe('CallsApi', () => {
|
|
|
105
113
|
|
|
106
114
|
describe('updateCall', () => {
|
|
107
115
|
test('should update a call', async () => {
|
|
108
|
-
const updateCallBody = {
|
|
116
|
+
const updateCallBody: UpdateCall = {
|
|
109
117
|
state: CallStateEnum.Active,
|
|
110
|
-
redirectUrl: `${MANTECA_BASE_URL}/bxml/pause`
|
|
118
|
+
redirectUrl: `${globalThis.MANTECA_BASE_URL}/bxml/pause`
|
|
111
119
|
};
|
|
112
120
|
|
|
113
121
|
const updateCallId = await createMantecaCall(callsApi);
|
|
114
122
|
activeCalls.push(updateCallId);
|
|
115
|
-
await sleep(SLEEP_TIME_S);
|
|
123
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
116
124
|
|
|
117
125
|
const { status: updateStatus } =
|
|
118
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, updateCallBody);
|
|
126
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, updateCallBody);
|
|
119
127
|
expect(updateStatus).toEqual(200);
|
|
120
|
-
await sleep(SLEEP_TIME_S);
|
|
128
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
121
129
|
|
|
122
130
|
const { status: completeStatus } =
|
|
123
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
131
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
124
132
|
expect(completeStatus).toEqual(200);
|
|
125
133
|
});
|
|
126
134
|
});
|
|
@@ -131,52 +139,52 @@ describe('CallsApi', () => {
|
|
|
131
139
|
|
|
132
140
|
const updateCallId = await createMantecaCall(callsApi);
|
|
133
141
|
activeCalls.push(updateCallId);
|
|
134
|
-
await sleep(SLEEP_TIME_S);
|
|
142
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
135
143
|
|
|
136
144
|
const { status: updateStatus } =
|
|
137
|
-
await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, updateBxml);
|
|
145
|
+
await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, updateBxml);
|
|
138
146
|
expect(updateStatus).toEqual(204);
|
|
139
|
-
await sleep(SLEEP_TIME_S);
|
|
147
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
140
148
|
|
|
141
149
|
const { status: completeStatus } =
|
|
142
|
-
await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
150
|
+
await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
|
|
143
151
|
expect(completeStatus).toEqual(200);
|
|
144
152
|
});
|
|
145
153
|
});
|
|
146
154
|
|
|
147
155
|
describe('HTTP Errors', () => {
|
|
148
156
|
test('400', async () => {
|
|
149
|
-
const callBodyBad = {
|
|
150
|
-
applicationId: BW_VOICE_APPLICATION_ID,
|
|
157
|
+
const callBodyBad: CreateCall = {
|
|
158
|
+
applicationId: globalThis.BW_VOICE_APPLICATION_ID,
|
|
151
159
|
to: '+1invalid',
|
|
152
|
-
from: BW_NUMBER,
|
|
160
|
+
from: globalThis.BW_NUMBER,
|
|
153
161
|
answerUrl: answerUrl
|
|
154
162
|
};
|
|
155
163
|
|
|
156
164
|
try {
|
|
157
|
-
await callsApi.createCall(BW_ACCOUNT_ID, callBodyBad);
|
|
165
|
+
await callsApi.createCall(globalThis.BW_ACCOUNT_ID, callBodyBad);
|
|
158
166
|
} catch (e) {
|
|
159
167
|
expect(e.response.status).toEqual(400);
|
|
160
168
|
}
|
|
161
169
|
});
|
|
162
170
|
|
|
163
171
|
test('401', async () => {
|
|
164
|
-
const configBad = new Configuration({username: UNAUTHORIZED_USERNAME, password: UNAUTHORIZED_PASSWORD});
|
|
172
|
+
const configBad = new Configuration({username: globalThis.UNAUTHORIZED_USERNAME, password: globalThis.UNAUTHORIZED_PASSWORD});
|
|
165
173
|
const callsApiBad = new CallsApi(configBad);
|
|
166
174
|
|
|
167
175
|
try {
|
|
168
|
-
await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
|
|
176
|
+
await callsApiBad.getCallState(globalThis.BW_ACCOUNT_ID, callId);
|
|
169
177
|
} catch (e) {
|
|
170
178
|
expect(e.response.status).toEqual(401);
|
|
171
179
|
}
|
|
172
180
|
});
|
|
173
181
|
|
|
174
182
|
test('403', async () => {
|
|
175
|
-
const configBad = new Configuration({username: FORBIDDEN_USERNAME, password: FORBIDDEN_PASSWORD});
|
|
183
|
+
const configBad = new Configuration({username: globalThis.FORBIDDEN_USERNAME, password: globalThis.FORBIDDEN_PASSWORD});
|
|
176
184
|
const callsApiBad = new CallsApi(configBad);
|
|
177
185
|
|
|
178
186
|
try {
|
|
179
|
-
await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
|
|
187
|
+
await callsApiBad.getCallState(globalThis.BW_ACCOUNT_ID, callId);
|
|
180
188
|
} catch (e) {
|
|
181
189
|
expect(e.response.status).toEqual(403);
|
|
182
190
|
}
|
|
@@ -184,7 +192,7 @@ describe('CallsApi', () => {
|
|
|
184
192
|
|
|
185
193
|
test('404', async () => {
|
|
186
194
|
try {
|
|
187
|
-
await callsApi.getCallState(BW_ACCOUNT_ID, 'does-not-exist');
|
|
195
|
+
await callsApi.getCallState(globalThis.BW_ACCOUNT_ID, 'does-not-exist');
|
|
188
196
|
} catch (e) {
|
|
189
197
|
expect(e.response.status).toEqual(404);
|
|
190
198
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { CallsApi, ConferencesApi } from '../../api';
|
|
3
|
+
import { Configuration } from '../../configuration';
|
|
4
|
+
import { ConferenceStateEnum, RedirectMethodEnum, FileFormatEnum, UpdateConference } from '../../models';
|
|
5
|
+
import { setupManteca, createMantecaCall, cleanupCalls, getMantecaTestStatus, sleep } from '../callUtils';
|
|
7
6
|
|
|
8
7
|
describe('ConferencesApi', () => {
|
|
9
8
|
jest.setTimeout(125000);
|
|
10
|
-
const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
|
|
9
|
+
const config = new Configuration({username: globalThis.BW_USERNAME, password: globalThis.BW_PASSWORD});
|
|
11
10
|
const callsApi = new CallsApi(config);
|
|
12
11
|
const conferencesApi = new ConferencesApi(config);
|
|
13
12
|
|
|
14
|
-
let conferenceId, recordingId, mantecaTestId, mantecaCallId;
|
|
15
|
-
let activeCalls = [];
|
|
13
|
+
let conferenceId: string, recordingId: string, mantecaTestId: string, mantecaCallId: string;
|
|
14
|
+
let activeCalls: string[] = [];
|
|
16
15
|
|
|
17
16
|
beforeAll(async () => {
|
|
18
17
|
mantecaTestId = await setupManteca('conference');
|
|
@@ -26,20 +25,20 @@ describe('ConferencesApi', () => {
|
|
|
26
25
|
|
|
27
26
|
describe('listConferences', () => {
|
|
28
27
|
test('should list conferences', async () => {
|
|
29
|
-
await sleep(SLEEP_TIME_S);
|
|
30
|
-
const { status, data } = await conferencesApi.listConferences(BW_ACCOUNT_ID, mantecaTestId);
|
|
28
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
29
|
+
const { status, data } = await conferencesApi.listConferences(globalThis.BW_ACCOUNT_ID, mantecaTestId);
|
|
31
30
|
|
|
32
31
|
expect(status).toEqual(200);
|
|
33
32
|
expect(data).toBeInstanceOf(Array);
|
|
34
33
|
expect(data[0].id).toHaveLength(50);
|
|
35
34
|
|
|
36
|
-
conferenceId = data[0].id
|
|
35
|
+
conferenceId = data[0].id!;
|
|
37
36
|
});
|
|
38
37
|
});
|
|
39
38
|
|
|
40
39
|
describe('getConference', () => {
|
|
41
40
|
test('should get a conference', async () => {
|
|
42
|
-
const { status, data } = await conferencesApi.getConference(BW_ACCOUNT_ID, conferenceId);
|
|
41
|
+
const { status, data } = await conferencesApi.getConference(globalThis.BW_ACCOUNT_ID, conferenceId);
|
|
43
42
|
|
|
44
43
|
expect(status).toEqual(200);
|
|
45
44
|
expect(data.id).toEqual(conferenceId);
|
|
@@ -50,7 +49,7 @@ describe('ConferencesApi', () => {
|
|
|
50
49
|
|
|
51
50
|
describe('getConferenceMember', () => {
|
|
52
51
|
test('should get conference member', async () => {
|
|
53
|
-
const { status, data } = await conferencesApi.getConferenceMember(BW_ACCOUNT_ID, conferenceId, mantecaCallId);
|
|
52
|
+
const { status, data } = await conferencesApi.getConferenceMember(globalThis.BW_ACCOUNT_ID, conferenceId, mantecaCallId);
|
|
54
53
|
|
|
55
54
|
expect(status).toEqual(200);
|
|
56
55
|
expect(data.conferenceId).toEqual(conferenceId);
|
|
@@ -63,7 +62,7 @@ describe('ConferencesApi', () => {
|
|
|
63
62
|
const updateConferenceMember = { mute: false };
|
|
64
63
|
|
|
65
64
|
const { status } =
|
|
66
|
-
await conferencesApi.updateConferenceMember(BW_ACCOUNT_ID, conferenceId, mantecaCallId, updateConferenceMember);
|
|
65
|
+
await conferencesApi.updateConferenceMember(globalThis.BW_ACCOUNT_ID, conferenceId, mantecaCallId, updateConferenceMember);
|
|
67
66
|
|
|
68
67
|
expect(status).toEqual(204);
|
|
69
68
|
});
|
|
@@ -71,20 +70,20 @@ describe('ConferencesApi', () => {
|
|
|
71
70
|
|
|
72
71
|
describe('updateConference', () => {
|
|
73
72
|
test('should update conference', async () => {
|
|
74
|
-
const updateConferenceBody = {
|
|
73
|
+
const updateConferenceBody: UpdateConference = {
|
|
75
74
|
status: ConferenceStateEnum.Active,
|
|
76
|
-
redirectUrl: `${MANTECA_BASE_URL}/bxml/pause`,
|
|
75
|
+
redirectUrl: `${globalThis.MANTECA_BASE_URL}/bxml/pause`,
|
|
77
76
|
redirectMethod: RedirectMethodEnum.Post,
|
|
78
77
|
username: 'username',
|
|
79
78
|
password: 'password',
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
redirectFallbackUrl: `${globalThis.MANTECA_BASE_URL}/bxml/pause`,
|
|
80
|
+
redirectFallbackMethod: RedirectMethodEnum.Post,
|
|
82
81
|
fallbackUsername: 'username',
|
|
83
82
|
fallbackPassword: 'password'
|
|
84
83
|
};
|
|
85
84
|
|
|
86
85
|
const { status } =
|
|
87
|
-
await conferencesApi.updateConference(BW_ACCOUNT_ID, conferenceId, updateConferenceBody);
|
|
86
|
+
await conferencesApi.updateConference(globalThis.BW_ACCOUNT_ID, conferenceId, updateConferenceBody);
|
|
88
87
|
|
|
89
88
|
expect(status).toEqual(204);
|
|
90
89
|
});
|
|
@@ -95,18 +94,18 @@ describe('ConferencesApi', () => {
|
|
|
95
94
|
const updateBxml = '<?xml version="1.0" encoding="UTF-8"?><Bxml><StartRecording/><SpeakSentence locale="en_US" gender="female" voice="susan">This should be a conference recording.</SpeakSentence><StopRecording/></Bxml>';
|
|
96
95
|
|
|
97
96
|
const { status } =
|
|
98
|
-
await conferencesApi.updateConferenceBxml(BW_ACCOUNT_ID, conferenceId, updateBxml);
|
|
97
|
+
await conferencesApi.updateConferenceBxml(globalThis.BW_ACCOUNT_ID, conferenceId, updateBxml);
|
|
99
98
|
|
|
100
99
|
expect(status).toEqual(204);
|
|
101
100
|
|
|
102
101
|
let retries = 0;
|
|
103
102
|
let recordingComplete = false;
|
|
104
103
|
try {
|
|
105
|
-
while (!recordingComplete && retries < MAX_RETRIES) {
|
|
104
|
+
while (!recordingComplete && retries < globalThis.MAX_RETRIES) {
|
|
106
105
|
const { callRecorded } = await getMantecaTestStatus(mantecaTestId);
|
|
107
106
|
recordingComplete = callRecorded;
|
|
108
107
|
retries++;
|
|
109
|
-
await sleep(SLEEP_TIME_S);
|
|
108
|
+
await sleep(globalThis.SLEEP_TIME_S);
|
|
110
109
|
}
|
|
111
110
|
} catch (e) {
|
|
112
111
|
console.log(e);
|
|
@@ -118,28 +117,28 @@ describe('ConferencesApi', () => {
|
|
|
118
117
|
|
|
119
118
|
describe('listConferenceRecordings', () => {
|
|
120
119
|
test('should list conference recordings', async () => {
|
|
121
|
-
const { status, data } = await conferencesApi.listConferenceRecordings(BW_ACCOUNT_ID, conferenceId);
|
|
120
|
+
const { status, data } = await conferencesApi.listConferenceRecordings(globalThis.BW_ACCOUNT_ID, conferenceId);
|
|
122
121
|
|
|
123
122
|
expect(status).toEqual(200);
|
|
124
123
|
expect(data).toBeInstanceOf(Array);
|
|
125
124
|
expect(data[0].conferenceId).toEqual(conferenceId);
|
|
126
|
-
expect(data[0].accountId).toEqual(BW_ACCOUNT_ID);
|
|
125
|
+
expect(data[0].accountId).toEqual(globalThis.BW_ACCOUNT_ID);
|
|
127
126
|
expect(data[0].name).toEqual(mantecaTestId);
|
|
128
127
|
expect(['partial', 'complete']).toContain(data[0].status);
|
|
129
128
|
expect(data[0].recordingId).toHaveLength(47);
|
|
130
129
|
expect(data[0].fileFormat).toEqual(FileFormatEnum.Wav);
|
|
131
130
|
|
|
132
|
-
recordingId = data[0].recordingId
|
|
131
|
+
recordingId = data[0].recordingId!;
|
|
133
132
|
});
|
|
134
133
|
});
|
|
135
134
|
|
|
136
135
|
describe('getConferenceRecording', () => {
|
|
137
136
|
test('should get conference recording', async () => {
|
|
138
|
-
const { status, data } = await conferencesApi.getConferenceRecording(BW_ACCOUNT_ID, conferenceId, recordingId);
|
|
137
|
+
const { status, data } = await conferencesApi.getConferenceRecording(globalThis.BW_ACCOUNT_ID, conferenceId, recordingId);
|
|
139
138
|
|
|
140
139
|
expect(status).toEqual(200);
|
|
141
140
|
expect(data.conferenceId).toEqual(conferenceId);
|
|
142
|
-
expect(data.accountId).toEqual(BW_ACCOUNT_ID);
|
|
141
|
+
expect(data.accountId).toEqual(globalThis.BW_ACCOUNT_ID);
|
|
143
142
|
expect(data.name).toEqual(mantecaTestId);
|
|
144
143
|
expect(['partial', 'complete']).toContain(data.status);
|
|
145
144
|
expect(data.recordingId).toEqual(recordingId);
|
|
@@ -149,7 +148,7 @@ describe('ConferencesApi', () => {
|
|
|
149
148
|
|
|
150
149
|
describe('downloadConferenceRecording', () => {
|
|
151
150
|
test('should download conference recording', async () => {
|
|
152
|
-
const { status, data } = await conferencesApi.downloadConferenceRecording(BW_ACCOUNT_ID, conferenceId, recordingId);
|
|
151
|
+
const { status, data } = await conferencesApi.downloadConferenceRecording(globalThis.BW_ACCOUNT_ID, conferenceId, recordingId);
|
|
153
152
|
|
|
154
153
|
expect(status).toEqual(200);
|
|
155
154
|
expect(data).toBeDefined();
|