@azure/communication-call-automation 1.6.0-beta.2 → 1.6.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/dist/commonjs/callAutomationClient.d.ts.map +1 -1
- package/dist/commonjs/callAutomationClient.js +328 -271
- package/dist/commonjs/callAutomationClient.js.map +7 -1
- package/dist/commonjs/callAutomationEventParser.d.ts.map +1 -1
- package/dist/commonjs/callAutomationEventParser.js +193 -184
- package/dist/commonjs/callAutomationEventParser.js.map +7 -1
- package/dist/commonjs/callConnection.d.ts +5 -5
- package/dist/commonjs/callConnection.d.ts.map +1 -1
- package/dist/commonjs/callConnection.js +339 -287
- package/dist/commonjs/callConnection.js.map +7 -1
- package/dist/commonjs/callMedia.d.ts +3 -8
- package/dist/commonjs/callMedia.d.ts.map +1 -1
- package/dist/commonjs/callMedia.js +402 -429
- package/dist/commonjs/callMedia.js.map +7 -1
- package/dist/commonjs/callRecording.js +214 -190
- package/dist/commonjs/callRecording.js.map +7 -1
- package/dist/commonjs/contentDownloader.d.ts +12 -0
- package/dist/commonjs/contentDownloader.d.ts.map +1 -1
- package/dist/commonjs/contentDownloader.js +139 -101
- package/dist/commonjs/contentDownloader.js.map +7 -1
- package/dist/commonjs/generated/src/callAutomationApiClient.d.ts +1 -1
- package/dist/commonjs/generated/src/callAutomationApiClient.js +258 -222
- package/dist/commonjs/generated/src/callAutomationApiClient.js.map +7 -1
- package/dist/commonjs/generated/src/index.js +36 -19
- package/dist/commonjs/generated/src/index.js.map +7 -1
- package/dist/commonjs/generated/src/models/index.d.ts +243 -457
- package/dist/commonjs/generated/src/models/index.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/index.js +278 -367
- package/dist/commonjs/generated/src/models/index.js.map +7 -1
- package/dist/commonjs/generated/src/models/mappers.d.ts +21 -26
- package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/mappers.js +4240 -4281
- package/dist/commonjs/generated/src/models/mappers.js.map +7 -1
- package/dist/commonjs/generated/src/models/parameters.d.ts +0 -1
- package/dist/commonjs/generated/src/models/parameters.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/parameters.js +287 -211
- package/dist/commonjs/generated/src/models/parameters.js.map +7 -1
- package/dist/commonjs/generated/src/operations/callConnection.d.ts +1 -1
- package/dist/commonjs/generated/src/operations/callConnection.js +454 -382
- package/dist/commonjs/generated/src/operations/callConnection.js.map +7 -1
- package/dist/commonjs/generated/src/operations/callMedia.d.ts +1 -8
- package/dist/commonjs/generated/src/operations/callMedia.d.ts.map +1 -1
- package/dist/commonjs/generated/src/operations/callMedia.js +394 -354
- package/dist/commonjs/generated/src/operations/callMedia.js.map +7 -1
- package/dist/commonjs/generated/src/operations/callRecording.js +180 -139
- package/dist/commonjs/generated/src/operations/callRecording.js.map +7 -1
- package/dist/commonjs/generated/src/operations/index.js +26 -14
- package/dist/commonjs/generated/src/operations/index.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/callConnection.d.ts +1 -1
- package/dist/commonjs/generated/src/operationsInterfaces/callConnection.js +16 -10
- package/dist/commonjs/generated/src/operationsInterfaces/callConnection.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/callMedia.d.ts +1 -8
- package/dist/commonjs/generated/src/operationsInterfaces/callMedia.d.ts.map +1 -1
- package/dist/commonjs/generated/src/operationsInterfaces/callMedia.js +16 -10
- package/dist/commonjs/generated/src/operationsInterfaces/callMedia.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/callRecording.js +16 -10
- package/dist/commonjs/generated/src/operationsInterfaces/callRecording.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/index.js +26 -14
- package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +7 -1
- package/dist/commonjs/generated/src/pagingHelper.js +40 -30
- package/dist/commonjs/generated/src/pagingHelper.js.map +7 -1
- package/dist/commonjs/index.d.ts +3 -3
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +36 -17
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/models/events.d.ts +297 -237
- package/dist/commonjs/models/events.d.ts.map +1 -1
- package/dist/commonjs/models/events.js +16 -5
- package/dist/commonjs/models/events.js.map +7 -1
- package/dist/commonjs/models/logger.js +29 -11
- package/dist/commonjs/models/logger.js.map +7 -1
- package/dist/commonjs/models/mapper.js +99 -78
- package/dist/commonjs/models/mapper.js.map +7 -1
- package/dist/commonjs/models/models.d.ts +8 -29
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +68 -61
- package/dist/commonjs/models/models.js.map +7 -1
- package/dist/commonjs/models/options.d.ts +11 -65
- package/dist/commonjs/models/options.d.ts.map +1 -1
- package/dist/commonjs/models/options.js +16 -5
- package/dist/commonjs/models/options.js.map +7 -1
- package/dist/commonjs/models/responses.js +16 -5
- package/dist/commonjs/models/responses.js.map +7 -1
- package/dist/commonjs/models/streaming.d.ts +1 -12
- package/dist/commonjs/models/streaming.d.ts.map +1 -1
- package/dist/commonjs/models/streaming.js +55 -39
- package/dist/commonjs/models/streaming.js.map +7 -1
- package/dist/commonjs/streamingData.d.ts.map +1 -1
- package/dist/commonjs/streamingData.js +112 -99
- package/dist/commonjs/streamingData.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utli/converters.d.ts.map +1 -1
- package/dist/commonjs/utli/converters.js +285 -275
- package/dist/commonjs/utli/converters.js.map +7 -1
- package/dist/commonjs/utli/recordingUrlValidator.d.ts +9 -0
- package/dist/commonjs/utli/recordingUrlValidator.d.ts.map +1 -0
- package/dist/commonjs/utli/recordingUrlValidator.js +56 -0
- package/dist/commonjs/utli/recordingUrlValidator.js.map +7 -0
- package/dist/esm/callAutomationClient.d.ts.map +1 -1
- package/dist/esm/callAutomationClient.js +1 -4
- package/dist/esm/callAutomationClient.js.map +1 -1
- package/dist/esm/callAutomationEventParser.d.ts.map +1 -1
- package/dist/esm/callAutomationEventParser.js +8 -15
- package/dist/esm/callAutomationEventParser.js.map +1 -1
- package/dist/esm/callConnection.d.ts +5 -5
- package/dist/esm/callConnection.d.ts.map +1 -1
- package/dist/esm/callConnection.js +11 -10
- package/dist/esm/callConnection.js.map +1 -1
- package/dist/esm/callMedia.d.ts +3 -8
- package/dist/esm/callMedia.d.ts.map +1 -1
- package/dist/esm/callMedia.js +7 -35
- package/dist/esm/callMedia.js.map +1 -1
- package/dist/esm/contentDownloader.d.ts +12 -0
- package/dist/esm/contentDownloader.d.ts.map +1 -1
- package/dist/esm/contentDownloader.js +37 -8
- package/dist/esm/contentDownloader.js.map +1 -1
- package/dist/esm/generated/src/callAutomationApiClient.d.ts +1 -1
- package/dist/esm/generated/src/callAutomationApiClient.js +3 -3
- package/dist/esm/generated/src/callAutomationApiClient.js.map +1 -1
- package/dist/esm/generated/src/models/index.d.ts +243 -457
- package/dist/esm/generated/src/models/index.d.ts.map +1 -1
- package/dist/esm/generated/src/models/index.js +28 -40
- package/dist/esm/generated/src/models/index.js.map +1 -1
- package/dist/esm/generated/src/models/mappers.d.ts +21 -26
- package/dist/esm/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/esm/generated/src/models/mappers.js +327 -602
- package/dist/esm/generated/src/models/mappers.js.map +1 -1
- package/dist/esm/generated/src/models/parameters.d.ts +0 -1
- package/dist/esm/generated/src/models/parameters.d.ts.map +1 -1
- package/dist/esm/generated/src/models/parameters.js +2 -6
- package/dist/esm/generated/src/models/parameters.js.map +1 -1
- package/dist/esm/generated/src/operations/callConnection.d.ts +1 -1
- package/dist/esm/generated/src/operations/callConnection.js +1 -1
- package/dist/esm/generated/src/operations/callConnection.js.map +1 -1
- package/dist/esm/generated/src/operations/callMedia.d.ts +1 -8
- package/dist/esm/generated/src/operations/callMedia.d.ts.map +1 -1
- package/dist/esm/generated/src/operations/callMedia.js +0 -25
- package/dist/esm/generated/src/operations/callMedia.js.map +1 -1
- package/dist/esm/generated/src/operationsInterfaces/callConnection.d.ts +1 -1
- package/dist/esm/generated/src/operationsInterfaces/callConnection.js.map +1 -1
- package/dist/esm/generated/src/operationsInterfaces/callMedia.d.ts +1 -8
- package/dist/esm/generated/src/operationsInterfaces/callMedia.d.ts.map +1 -1
- package/dist/esm/generated/src/operationsInterfaces/callMedia.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/events.d.ts +297 -237
- package/dist/esm/models/events.d.ts.map +1 -1
- package/dist/esm/models/events.js.map +1 -1
- package/dist/esm/models/models.d.ts +8 -29
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/models/options.d.ts +11 -65
- package/dist/esm/models/options.d.ts.map +1 -1
- package/dist/esm/models/options.js.map +1 -1
- package/dist/esm/models/streaming.d.ts +1 -12
- package/dist/esm/models/streaming.d.ts.map +1 -1
- package/dist/esm/models/streaming.js.map +1 -1
- package/dist/esm/streamingData.d.ts.map +1 -1
- package/dist/esm/streamingData.js +0 -5
- package/dist/esm/streamingData.js.map +1 -1
- package/dist/esm/utli/converters.d.ts.map +1 -1
- package/dist/esm/utli/converters.js +1 -1
- package/dist/esm/utli/converters.js.map +1 -1
- package/dist/esm/utli/recordingUrlValidator.d.ts +9 -0
- package/dist/esm/utli/recordingUrlValidator.d.ts.map +1 -0
- package/dist/esm/utli/recordingUrlValidator.js +45 -0
- package/dist/esm/utli/recordingUrlValidator.js.map +1 -0
- package/package.json +37 -50
- package/dist/browser/callAutomationClient.d.ts +0 -98
- package/dist/browser/callAutomationClient.d.ts.map +0 -1
- package/dist/browser/callAutomationClient.js +0 -275
- package/dist/browser/callAutomationClient.js.map +0 -1
- package/dist/browser/callAutomationEventParser.d.ts +0 -6
- package/dist/browser/callAutomationEventParser.d.ts.map +0 -1
- package/dist/browser/callAutomationEventParser.js +0 -189
- package/dist/browser/callAutomationEventParser.js.map +0 -1
- package/dist/browser/callConnection.d.ts +0 -83
- package/dist/browser/callConnection.d.ts.map +0 -1
- package/dist/browser/callConnection.js +0 -289
- package/dist/browser/callConnection.js.map +0 -1
- package/dist/browser/callMedia.d.ts +0 -114
- package/dist/browser/callMedia.d.ts.map +0 -1
- package/dist/browser/callMedia.js +0 -433
- package/dist/browser/callMedia.js.map +0 -1
- package/dist/browser/callRecording.d.ts +0 -70
- package/dist/browser/callRecording.d.ts.map +0 -1
- package/dist/browser/callRecording.js +0 -195
- package/dist/browser/callRecording.js.map +0 -1
- package/dist/browser/contentDownloader.d.ts +0 -25
- package/dist/browser/contentDownloader.d.ts.map +0 -1
- package/dist/browser/contentDownloader.js +0 -103
- package/dist/browser/contentDownloader.js.map +0 -1
- package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.d.ts +0 -10
- package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +0 -1
- package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.js +0 -38
- package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.js.map +0 -1
- package/dist/browser/credential/callAutomationAuthPolicy.d.ts +0 -22
- package/dist/browser/credential/callAutomationAuthPolicy.d.ts.map +0 -1
- package/dist/browser/credential/callAutomationAuthPolicy.js +0 -53
- package/dist/browser/credential/callAutomationAuthPolicy.js.map +0 -1
- package/dist/browser/credential/cryptoUtils-browser.d.mts.map +0 -1
- package/dist/browser/credential/cryptoUtils-browser.mjs.map +0 -1
- package/dist/browser/credential/cryptoUtils.d.ts +0 -3
- package/dist/browser/credential/cryptoUtils.js +0 -20
- package/dist/browser/credential/encodeUtils.browser.d.ts +0 -4
- package/dist/browser/credential/encodeUtils.browser.d.ts.map +0 -1
- package/dist/browser/credential/encodeUtils.browser.js +0 -26
- package/dist/browser/credential/encodeUtils.browser.js.map +0 -1
- package/dist/browser/generated/src/callAutomationApiClient.d.ts +0 -49
- package/dist/browser/generated/src/callAutomationApiClient.d.ts.map +0 -1
- package/dist/browser/generated/src/callAutomationApiClient.js +0 -235
- package/dist/browser/generated/src/callAutomationApiClient.js.map +0 -1
- package/dist/browser/generated/src/index.d.ts +0 -5
- package/dist/browser/generated/src/index.d.ts.map +0 -1
- package/dist/browser/generated/src/index.js +0 -13
- package/dist/browser/generated/src/index.js.map +0 -1
- package/dist/browser/generated/src/models/index.d.ts +0 -2342
- package/dist/browser/generated/src/models/index.d.ts.map +0 -1
- package/dist/browser/generated/src/models/index.js +0 -364
- package/dist/browser/generated/src/models/index.js.map +0 -1
- package/dist/browser/generated/src/models/mappers.d.ts +0 -123
- package/dist/browser/generated/src/models/mappers.d.ts.map +0 -1
- package/dist/browser/generated/src/models/mappers.js +0 -4395
- package/dist/browser/generated/src/models/mappers.js.map +0 -1
- package/dist/browser/generated/src/models/parameters.d.ts +0 -36
- package/dist/browser/generated/src/models/parameters.d.ts.map +0 -1
- package/dist/browser/generated/src/models/parameters.js +0 -208
- package/dist/browser/generated/src/models/parameters.js.map +0 -1
- package/dist/browser/generated/src/operations/callConnection.d.ts +0 -103
- package/dist/browser/generated/src/operations/callConnection.d.ts.map +0 -1
- package/dist/browser/generated/src/operations/callConnection.js +0 -417
- package/dist/browser/generated/src/operations/callConnection.js.map +0 -1
- package/dist/browser/generated/src/operations/callMedia.d.ts +0 -110
- package/dist/browser/generated/src/operations/callMedia.d.ts.map +0 -1
- package/dist/browser/generated/src/operations/callMedia.js +0 -378
- package/dist/browser/generated/src/operations/callMedia.js.map +0 -1
- package/dist/browser/generated/src/operations/callRecording.d.ts +0 -43
- package/dist/browser/generated/src/operations/callRecording.d.ts.map +0 -1
- package/dist/browser/generated/src/operations/callRecording.js +0 -148
- package/dist/browser/generated/src/operations/callRecording.js.map +0 -1
- package/dist/browser/generated/src/operations/index.d.ts +0 -4
- package/dist/browser/generated/src/operations/index.d.ts.map +0 -1
- package/dist/browser/generated/src/operations/index.js +0 -11
- package/dist/browser/generated/src/operations/index.js.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/callConnection.d.ts +0 -80
- package/dist/browser/generated/src/operationsInterfaces/callConnection.d.ts.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/callConnection.js +0 -9
- package/dist/browser/generated/src/operationsInterfaces/callConnection.js.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/callMedia.d.ts +0 -102
- package/dist/browser/generated/src/operationsInterfaces/callMedia.d.ts.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/callMedia.js +0 -9
- package/dist/browser/generated/src/operationsInterfaces/callMedia.js.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/callRecording.d.ts +0 -35
- package/dist/browser/generated/src/operationsInterfaces/callRecording.d.ts.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/callRecording.js +0 -9
- package/dist/browser/generated/src/operationsInterfaces/callRecording.js.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/index.d.ts +0 -4
- package/dist/browser/generated/src/operationsInterfaces/index.d.ts.map +0 -1
- package/dist/browser/generated/src/operationsInterfaces/index.js +0 -11
- package/dist/browser/generated/src/operationsInterfaces/index.js.map +0 -1
- package/dist/browser/generated/src/pagingHelper.d.ts +0 -13
- package/dist/browser/generated/src/pagingHelper.d.ts.map +0 -1
- package/dist/browser/generated/src/pagingHelper.js +0 -30
- package/dist/browser/generated/src/pagingHelper.js.map +0 -1
- package/dist/browser/index.d.ts +0 -12
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -14
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/models/constants.d.ts +0 -2
- package/dist/browser/models/constants.d.ts.map +0 -1
- package/dist/browser/models/constants.js +0 -4
- package/dist/browser/models/constants.js.map +0 -1
- package/dist/browser/models/events.d.ts +0 -689
- package/dist/browser/models/events.d.ts.map +0 -1
- package/dist/browser/models/events.js +0 -4
- package/dist/browser/models/events.js.map +0 -1
- package/dist/browser/models/logger.d.ts +0 -5
- package/dist/browser/models/logger.d.ts.map +0 -1
- package/dist/browser/models/logger.js +0 -8
- package/dist/browser/models/logger.js.map +0 -1
- package/dist/browser/models/mapper.d.ts +0 -3
- package/dist/browser/models/mapper.d.ts.map +0 -1
- package/dist/browser/models/mapper.js +0 -76
- package/dist/browser/models/mapper.js.map +0 -1
- package/dist/browser/models/models.d.ts +0 -305
- package/dist/browser/models/models.d.ts.map +0 -1
- package/dist/browser/models/models.js +0 -54
- package/dist/browser/models/models.js.map +0 -1
- package/dist/browser/models/options.d.ts +0 -463
- package/dist/browser/models/options.d.ts.map +0 -1
- package/dist/browser/models/options.js +0 -4
- package/dist/browser/models/options.js.map +0 -1
- package/dist/browser/models/responses.d.ts +0 -81
- package/dist/browser/models/responses.d.ts.map +0 -1
- package/dist/browser/models/responses.js +0 -4
- package/dist/browser/models/responses.js.map +0 -1
- package/dist/browser/models/streaming.d.ts +0 -128
- package/dist/browser/models/streaming.d.ts.map +0 -1
- package/dist/browser/models/streaming.js +0 -38
- package/dist/browser/models/streaming.js.map +0 -1
- package/dist/browser/package.json +0 -3
- package/dist/browser/streamingData.d.ts +0 -13
- package/dist/browser/streamingData.d.ts.map +0 -1
- package/dist/browser/streamingData.js +0 -99
- package/dist/browser/streamingData.js.map +0 -1
- package/dist/browser/utli/converters.d.ts +0 -46
- package/dist/browser/utli/converters.d.ts.map +0 -1
- package/dist/browser/utli/converters.js +0 -294
- package/dist/browser/utli/converters.js.map +0 -1
- package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.d.ts +0 -10
- package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +0 -1
- package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.js +0 -41
- package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.js.map +0 -1
- package/dist/commonjs/credential/callAutomationAuthPolicy.d.ts +0 -22
- package/dist/commonjs/credential/callAutomationAuthPolicy.d.ts.map +0 -1
- package/dist/commonjs/credential/callAutomationAuthPolicy.js +0 -57
- package/dist/commonjs/credential/callAutomationAuthPolicy.js.map +0 -1
- package/dist/commonjs/credential/cryptoUtils.d.ts +0 -3
- package/dist/commonjs/credential/cryptoUtils.d.ts.map +0 -1
- package/dist/commonjs/credential/cryptoUtils.js +0 -14
- package/dist/commonjs/credential/cryptoUtils.js.map +0 -1
- package/dist/commonjs/credential/encodeUtils.browser.d.ts +0 -4
- package/dist/commonjs/credential/encodeUtils.browser.d.ts.map +0 -1
- package/dist/commonjs/credential/encodeUtils.browser.js +0 -32
- package/dist/commonjs/credential/encodeUtils.browser.js.map +0 -1
- package/dist/commonjs/models/constants.d.ts +0 -2
- package/dist/commonjs/models/constants.d.ts.map +0 -1
- package/dist/commonjs/models/constants.js +0 -7
- package/dist/commonjs/models/constants.js.map +0 -1
- package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.d.ts +0 -10
- package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +0 -1
- package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.js +0 -38
- package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.js.map +0 -1
- package/dist/esm/credential/callAutomationAuthPolicy.d.ts +0 -22
- package/dist/esm/credential/callAutomationAuthPolicy.d.ts.map +0 -1
- package/dist/esm/credential/callAutomationAuthPolicy.js +0 -53
- package/dist/esm/credential/callAutomationAuthPolicy.js.map +0 -1
- package/dist/esm/credential/cryptoUtils.d.ts +0 -3
- package/dist/esm/credential/cryptoUtils.d.ts.map +0 -1
- package/dist/esm/credential/cryptoUtils.js +0 -9
- package/dist/esm/credential/cryptoUtils.js.map +0 -1
- package/dist/esm/credential/encodeUtils.browser.d.ts +0 -4
- package/dist/esm/credential/encodeUtils.browser.d.ts.map +0 -1
- package/dist/esm/credential/encodeUtils.browser.js +0 -26
- package/dist/esm/credential/encodeUtils.browser.js.map +0 -1
- package/dist/esm/models/constants.d.ts +0 -2
- package/dist/esm/models/constants.d.ts.map +0 -1
- package/dist/esm/models/constants.js +0 -4
- package/dist/esm/models/constants.js.map +0 -1
- package/dist/react-native/callAutomationClient.d.ts +0 -98
- package/dist/react-native/callAutomationClient.d.ts.map +0 -1
- package/dist/react-native/callAutomationClient.js +0 -275
- package/dist/react-native/callAutomationClient.js.map +0 -1
- package/dist/react-native/callAutomationEventParser.d.ts +0 -6
- package/dist/react-native/callAutomationEventParser.d.ts.map +0 -1
- package/dist/react-native/callAutomationEventParser.js +0 -189
- package/dist/react-native/callAutomationEventParser.js.map +0 -1
- package/dist/react-native/callConnection.d.ts +0 -83
- package/dist/react-native/callConnection.d.ts.map +0 -1
- package/dist/react-native/callConnection.js +0 -289
- package/dist/react-native/callConnection.js.map +0 -1
- package/dist/react-native/callMedia.d.ts +0 -114
- package/dist/react-native/callMedia.d.ts.map +0 -1
- package/dist/react-native/callMedia.js +0 -433
- package/dist/react-native/callMedia.js.map +0 -1
- package/dist/react-native/callRecording.d.ts +0 -70
- package/dist/react-native/callRecording.d.ts.map +0 -1
- package/dist/react-native/callRecording.js +0 -195
- package/dist/react-native/callRecording.js.map +0 -1
- package/dist/react-native/contentDownloader.d.ts +0 -25
- package/dist/react-native/contentDownloader.d.ts.map +0 -1
- package/dist/react-native/contentDownloader.js +0 -103
- package/dist/react-native/contentDownloader.js.map +0 -1
- package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.d.ts +0 -10
- package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +0 -1
- package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.js +0 -38
- package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.js.map +0 -1
- package/dist/react-native/credential/callAutomationAuthPolicy.d.ts +0 -22
- package/dist/react-native/credential/callAutomationAuthPolicy.d.ts.map +0 -1
- package/dist/react-native/credential/callAutomationAuthPolicy.js +0 -53
- package/dist/react-native/credential/callAutomationAuthPolicy.js.map +0 -1
- package/dist/react-native/credential/cryptoUtils.d.ts +0 -3
- package/dist/react-native/credential/cryptoUtils.d.ts.map +0 -1
- package/dist/react-native/credential/cryptoUtils.js +0 -9
- package/dist/react-native/credential/cryptoUtils.js.map +0 -1
- package/dist/react-native/credential/encodeUtils.browser.d.ts +0 -4
- package/dist/react-native/credential/encodeUtils.browser.d.ts.map +0 -1
- package/dist/react-native/credential/encodeUtils.browser.js +0 -26
- package/dist/react-native/credential/encodeUtils.browser.js.map +0 -1
- package/dist/react-native/generated/src/callAutomationApiClient.d.ts +0 -49
- package/dist/react-native/generated/src/callAutomationApiClient.d.ts.map +0 -1
- package/dist/react-native/generated/src/callAutomationApiClient.js +0 -235
- package/dist/react-native/generated/src/callAutomationApiClient.js.map +0 -1
- package/dist/react-native/generated/src/index.d.ts +0 -5
- package/dist/react-native/generated/src/index.d.ts.map +0 -1
- package/dist/react-native/generated/src/index.js +0 -13
- package/dist/react-native/generated/src/index.js.map +0 -1
- package/dist/react-native/generated/src/models/index.d.ts +0 -2342
- package/dist/react-native/generated/src/models/index.d.ts.map +0 -1
- package/dist/react-native/generated/src/models/index.js +0 -364
- package/dist/react-native/generated/src/models/index.js.map +0 -1
- package/dist/react-native/generated/src/models/mappers.d.ts +0 -123
- package/dist/react-native/generated/src/models/mappers.d.ts.map +0 -1
- package/dist/react-native/generated/src/models/mappers.js +0 -4395
- package/dist/react-native/generated/src/models/mappers.js.map +0 -1
- package/dist/react-native/generated/src/models/parameters.d.ts +0 -36
- package/dist/react-native/generated/src/models/parameters.d.ts.map +0 -1
- package/dist/react-native/generated/src/models/parameters.js +0 -208
- package/dist/react-native/generated/src/models/parameters.js.map +0 -1
- package/dist/react-native/generated/src/operations/callConnection.d.ts +0 -103
- package/dist/react-native/generated/src/operations/callConnection.d.ts.map +0 -1
- package/dist/react-native/generated/src/operations/callConnection.js +0 -417
- package/dist/react-native/generated/src/operations/callConnection.js.map +0 -1
- package/dist/react-native/generated/src/operations/callMedia.d.ts +0 -110
- package/dist/react-native/generated/src/operations/callMedia.d.ts.map +0 -1
- package/dist/react-native/generated/src/operations/callMedia.js +0 -378
- package/dist/react-native/generated/src/operations/callMedia.js.map +0 -1
- package/dist/react-native/generated/src/operations/callRecording.d.ts +0 -43
- package/dist/react-native/generated/src/operations/callRecording.d.ts.map +0 -1
- package/dist/react-native/generated/src/operations/callRecording.js +0 -148
- package/dist/react-native/generated/src/operations/callRecording.js.map +0 -1
- package/dist/react-native/generated/src/operations/index.d.ts +0 -4
- package/dist/react-native/generated/src/operations/index.d.ts.map +0 -1
- package/dist/react-native/generated/src/operations/index.js +0 -11
- package/dist/react-native/generated/src/operations/index.js.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/callConnection.d.ts +0 -80
- package/dist/react-native/generated/src/operationsInterfaces/callConnection.d.ts.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/callConnection.js +0 -9
- package/dist/react-native/generated/src/operationsInterfaces/callConnection.js.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/callMedia.d.ts +0 -102
- package/dist/react-native/generated/src/operationsInterfaces/callMedia.d.ts.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/callMedia.js +0 -9
- package/dist/react-native/generated/src/operationsInterfaces/callMedia.js.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/callRecording.d.ts +0 -35
- package/dist/react-native/generated/src/operationsInterfaces/callRecording.d.ts.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/callRecording.js +0 -9
- package/dist/react-native/generated/src/operationsInterfaces/callRecording.js.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/index.d.ts +0 -4
- package/dist/react-native/generated/src/operationsInterfaces/index.d.ts.map +0 -1
- package/dist/react-native/generated/src/operationsInterfaces/index.js +0 -11
- package/dist/react-native/generated/src/operationsInterfaces/index.js.map +0 -1
- package/dist/react-native/generated/src/pagingHelper.d.ts +0 -13
- package/dist/react-native/generated/src/pagingHelper.d.ts.map +0 -1
- package/dist/react-native/generated/src/pagingHelper.js +0 -30
- package/dist/react-native/generated/src/pagingHelper.js.map +0 -1
- package/dist/react-native/index.d.ts +0 -12
- package/dist/react-native/index.d.ts.map +0 -1
- package/dist/react-native/index.js +0 -14
- package/dist/react-native/index.js.map +0 -1
- package/dist/react-native/models/constants.d.ts +0 -2
- package/dist/react-native/models/constants.d.ts.map +0 -1
- package/dist/react-native/models/constants.js +0 -4
- package/dist/react-native/models/constants.js.map +0 -1
- package/dist/react-native/models/events.d.ts +0 -689
- package/dist/react-native/models/events.d.ts.map +0 -1
- package/dist/react-native/models/events.js +0 -4
- package/dist/react-native/models/events.js.map +0 -1
- package/dist/react-native/models/logger.d.ts +0 -5
- package/dist/react-native/models/logger.d.ts.map +0 -1
- package/dist/react-native/models/logger.js +0 -8
- package/dist/react-native/models/logger.js.map +0 -1
- package/dist/react-native/models/mapper.d.ts +0 -3
- package/dist/react-native/models/mapper.d.ts.map +0 -1
- package/dist/react-native/models/mapper.js +0 -76
- package/dist/react-native/models/mapper.js.map +0 -1
- package/dist/react-native/models/models.d.ts +0 -305
- package/dist/react-native/models/models.d.ts.map +0 -1
- package/dist/react-native/models/models.js +0 -54
- package/dist/react-native/models/models.js.map +0 -1
- package/dist/react-native/models/options.d.ts +0 -463
- package/dist/react-native/models/options.d.ts.map +0 -1
- package/dist/react-native/models/options.js +0 -4
- package/dist/react-native/models/options.js.map +0 -1
- package/dist/react-native/models/responses.d.ts +0 -81
- package/dist/react-native/models/responses.d.ts.map +0 -1
- package/dist/react-native/models/responses.js +0 -4
- package/dist/react-native/models/responses.js.map +0 -1
- package/dist/react-native/models/streaming.d.ts +0 -128
- package/dist/react-native/models/streaming.d.ts.map +0 -1
- package/dist/react-native/models/streaming.js +0 -38
- package/dist/react-native/models/streaming.js.map +0 -1
- package/dist/react-native/package.json +0 -3
- package/dist/react-native/streamingData.d.ts +0 -13
- package/dist/react-native/streamingData.d.ts.map +0 -1
- package/dist/react-native/streamingData.js +0 -99
- package/dist/react-native/streamingData.js.map +0 -1
- package/dist/react-native/utli/converters.d.ts +0 -46
- package/dist/react-native/utli/converters.d.ts.map +0 -1
- package/dist/react-native/utli/converters.js +0 -294
- package/dist/react-native/utli/converters.js.map +0 -1
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { createSerializer } from "@azure/core-client";
|
|
4
|
-
import { communicationIdentifierConverter, callParticipantConverter } from "./utli/converters.js";
|
|
5
|
-
import { CloudEventMapper } from "./models/mapper.js";
|
|
6
|
-
const serializer = createSerializer();
|
|
7
|
-
/**
|
|
8
|
-
* Helper function for parsing Acs callback events.
|
|
9
|
-
*/
|
|
10
|
-
export function parseCallAutomationEvent(encodedEvents) {
|
|
11
|
-
const decodedInput = parseAndWrap(encodedEvents);
|
|
12
|
-
// parse cloudevent
|
|
13
|
-
const deserialized = serializer.deserialize(CloudEventMapper, decodedInput, "");
|
|
14
|
-
const data = deserialized.data;
|
|
15
|
-
const eventType = deserialized.type;
|
|
16
|
-
// get proper callbackevent and its parser
|
|
17
|
-
let callbackEvent;
|
|
18
|
-
let parsed = data;
|
|
19
|
-
switch (eventType) {
|
|
20
|
-
case "Microsoft.Communication.AddParticipantSucceeded":
|
|
21
|
-
callbackEvent = { kind: "AddParticipantSucceeded" };
|
|
22
|
-
parsed.participant = communicationIdentifierConverter(data.participant);
|
|
23
|
-
break;
|
|
24
|
-
case "Microsoft.Communication.AddParticipantFailed":
|
|
25
|
-
callbackEvent = { kind: "AddParticipantFailed" };
|
|
26
|
-
parsed.participant = communicationIdentifierConverter(data.participant);
|
|
27
|
-
break;
|
|
28
|
-
case "Microsoft.Communication.RemoveParticipantSucceeded":
|
|
29
|
-
callbackEvent = { kind: "RemoveParticipantSucceeded" };
|
|
30
|
-
parsed.participant = communicationIdentifierConverter(data.participant);
|
|
31
|
-
break;
|
|
32
|
-
case "Microsoft.Communication.RemoveParticipantFailed":
|
|
33
|
-
callbackEvent = { kind: "RemoveParticipantFailed" };
|
|
34
|
-
parsed.participant = communicationIdentifierConverter(data.participant);
|
|
35
|
-
break;
|
|
36
|
-
case "Microsoft.Communication.CallConnected":
|
|
37
|
-
callbackEvent = { kind: "CallConnected" };
|
|
38
|
-
break;
|
|
39
|
-
case "Microsoft.Communication.CallDisconnected":
|
|
40
|
-
callbackEvent = { kind: "CallDisconnected" };
|
|
41
|
-
break;
|
|
42
|
-
case "Microsoft.Communication.CallTransferAccepted":
|
|
43
|
-
callbackEvent = { kind: "CallTransferAccepted" };
|
|
44
|
-
break;
|
|
45
|
-
case "Microsoft.Communication.CallTransferFailed":
|
|
46
|
-
callbackEvent = { kind: "CallTransferFailed" };
|
|
47
|
-
break;
|
|
48
|
-
case "Microsoft.Communication.ParticipantsUpdated":
|
|
49
|
-
callbackEvent = { kind: "ParticipantsUpdated" };
|
|
50
|
-
parsed = participantsParserForEvent(data);
|
|
51
|
-
break;
|
|
52
|
-
case "Microsoft.Communication.RecordingStateChanged":
|
|
53
|
-
callbackEvent = { kind: "RecordingStateChanged" };
|
|
54
|
-
break;
|
|
55
|
-
case "Microsoft.Communication.PlayCompleted":
|
|
56
|
-
callbackEvent = { kind: "PlayCompleted" };
|
|
57
|
-
break;
|
|
58
|
-
case "Microsoft.Communication.PlayFailed":
|
|
59
|
-
callbackEvent = { kind: "PlayFailed" };
|
|
60
|
-
break;
|
|
61
|
-
case "Microsoft.Communication.PlayCanceled":
|
|
62
|
-
callbackEvent = { kind: "PlayCanceled" };
|
|
63
|
-
break;
|
|
64
|
-
case "Microsoft.Communication.RecognizeCompleted":
|
|
65
|
-
callbackEvent = { kind: "RecognizeCompleted" };
|
|
66
|
-
break;
|
|
67
|
-
case "Microsoft.Communication.RecognizeCanceled":
|
|
68
|
-
callbackEvent = { kind: "RecognizeCanceled" };
|
|
69
|
-
break;
|
|
70
|
-
case "Microsoft.Communication.RecognizeFailed":
|
|
71
|
-
callbackEvent = { kind: "RecognizeFailed" };
|
|
72
|
-
break;
|
|
73
|
-
case "Microsoft.Communication.ContinuousDtmfRecognitionToneReceived":
|
|
74
|
-
callbackEvent = {
|
|
75
|
-
kind: "ContinuousDtmfRecognitionToneReceived",
|
|
76
|
-
};
|
|
77
|
-
break;
|
|
78
|
-
case "Microsoft.Communication.ContinuousDtmfRecognitionToneFailed":
|
|
79
|
-
callbackEvent = {
|
|
80
|
-
kind: "ContinuousDtmfRecognitionToneFailed",
|
|
81
|
-
};
|
|
82
|
-
break;
|
|
83
|
-
case "Microsoft.Communication.ContinuousDtmfRecognitionStopped":
|
|
84
|
-
callbackEvent = {
|
|
85
|
-
kind: "ContinuousDtmfRecognitionStopped",
|
|
86
|
-
};
|
|
87
|
-
break;
|
|
88
|
-
case "Microsoft.Communication.SendDtmfTonesCompleted":
|
|
89
|
-
callbackEvent = { kind: "SendDtmfTonesCompleted" };
|
|
90
|
-
break;
|
|
91
|
-
case "Microsoft.Communication.SendDtmfTonesFailed":
|
|
92
|
-
callbackEvent = { kind: "SendDtmfTonesFailed" };
|
|
93
|
-
break;
|
|
94
|
-
case "Microsoft.Communication.CancelAddParticipantSucceeded":
|
|
95
|
-
callbackEvent = { kind: "CancelAddParticipantSucceeded" };
|
|
96
|
-
break;
|
|
97
|
-
case "Microsoft.Communication.CancelAddParticipantFailed":
|
|
98
|
-
callbackEvent = { kind: "CancelAddParticipantFailed" };
|
|
99
|
-
break;
|
|
100
|
-
case "Microsoft.Communication.TranscriptionStarted":
|
|
101
|
-
callbackEvent = { kind: "TranscriptionStarted" };
|
|
102
|
-
break;
|
|
103
|
-
case "Microsoft.Communication.TranscriptionStopped":
|
|
104
|
-
callbackEvent = { kind: "TranscriptionStopped" };
|
|
105
|
-
break;
|
|
106
|
-
case "Microsoft.Communication.TranscriptionUpdated":
|
|
107
|
-
callbackEvent = { kind: "TranscriptionUpdated" };
|
|
108
|
-
break;
|
|
109
|
-
case "Microsoft.Communication.TranscriptionFailed":
|
|
110
|
-
callbackEvent = { kind: "TranscriptionFailed" };
|
|
111
|
-
break;
|
|
112
|
-
case "Microsoft.Communication.TranscriptionCallSummaryUpdated":
|
|
113
|
-
callbackEvent = {
|
|
114
|
-
kind: "TranscriptionCallSummaryUpdated",
|
|
115
|
-
};
|
|
116
|
-
break;
|
|
117
|
-
case "Microsoft.Communication.CreateCallFailed":
|
|
118
|
-
callbackEvent = { kind: "CreateCallFailed" };
|
|
119
|
-
break;
|
|
120
|
-
case "Microsoft.Communication.AnswerFailed":
|
|
121
|
-
callbackEvent = { kind: "AnswerFailed" };
|
|
122
|
-
break;
|
|
123
|
-
case "Microsoft.Communication.HoldFailed":
|
|
124
|
-
callbackEvent = { kind: "HoldFailed" };
|
|
125
|
-
break;
|
|
126
|
-
case "Microsoft.Communication.ConnectFailed":
|
|
127
|
-
callbackEvent = { kind: "ConnectFailed" };
|
|
128
|
-
break;
|
|
129
|
-
case "Microsoft.Communication.MediaStreamingStarted":
|
|
130
|
-
callbackEvent = { kind: "MediaStreamingStarted" };
|
|
131
|
-
break;
|
|
132
|
-
case "Microsoft.Communication.MediaStreamingStopped":
|
|
133
|
-
callbackEvent = { kind: "MediaStreamingStopped" };
|
|
134
|
-
break;
|
|
135
|
-
case "Microsoft.Communication.MediaStreamingFailed":
|
|
136
|
-
callbackEvent = { kind: "MediaStreamingFailed" };
|
|
137
|
-
break;
|
|
138
|
-
case "Microsoft.Communication.PlayStarted":
|
|
139
|
-
callbackEvent = { kind: "PlayStarted" };
|
|
140
|
-
break;
|
|
141
|
-
case "Microsoft.Communication.StartRecordingFailed":
|
|
142
|
-
callbackEvent = { kind: "StartRecordingFailed" };
|
|
143
|
-
break;
|
|
144
|
-
case "Microsoft.Communication.MoveParticipantSucceeded":
|
|
145
|
-
callbackEvent = { kind: "MoveParticipantSucceeded" };
|
|
146
|
-
parsed.participant = communicationIdentifierConverter(data.participant);
|
|
147
|
-
parsed.fromCall = data.fromCall;
|
|
148
|
-
break;
|
|
149
|
-
case "Microsoft.Communication.MoveParticipantFailed":
|
|
150
|
-
callbackEvent = { kind: "MoveParticipantFailed" };
|
|
151
|
-
parsed.participant = communicationIdentifierConverter(data.participant);
|
|
152
|
-
parsed.fromCall = data.fromCall;
|
|
153
|
-
break;
|
|
154
|
-
default:
|
|
155
|
-
throw new TypeError(`Unknown Call Automation Event type: ${eventType}`);
|
|
156
|
-
}
|
|
157
|
-
return { ...parsed, ...callbackEvent };
|
|
158
|
-
}
|
|
159
|
-
function parseAndWrap(jsonStringOrObject) {
|
|
160
|
-
if (typeof jsonStringOrObject === "string") {
|
|
161
|
-
const o = JSON.parse(jsonStringOrObject);
|
|
162
|
-
if (Array.isArray(o)) {
|
|
163
|
-
if (o.length === 0) {
|
|
164
|
-
throw Error("Empty event array.");
|
|
165
|
-
}
|
|
166
|
-
return o[0];
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
return o;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (Array.isArray(jsonStringOrObject)) {
|
|
173
|
-
if (jsonStringOrObject.length === 0) {
|
|
174
|
-
throw Error("Empty event array.");
|
|
175
|
-
}
|
|
176
|
-
return jsonStringOrObject[0];
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
return jsonStringOrObject;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function participantsParserForEvent(data) {
|
|
183
|
-
const { participants, ...rest } = data;
|
|
184
|
-
return {
|
|
185
|
-
...rest,
|
|
186
|
-
participants: participants?.map((participant) => callParticipantConverter(participant)),
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=callAutomationEventParser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callAutomationEventParser.js","sourceRoot":"","sources":["../../src/callAutomationEventParser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AA4ClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC;;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,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACd,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACtC,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,kBAAkB,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,IAAS;IAC3C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACvC,OAAO;QACL,GAAG,IAAI;QACP,YAAY,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,WAAoC,EAAE,EAAE,CACvE,wBAAwB,CAAC,WAAW,CAAC,CACtC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { communicationIdentifierConverter, callParticipantConverter } from \"./utli/converters.js\";\nimport type {\n CallAutomationEvent,\n AddParticipantSucceeded,\n AddParticipantFailed,\n CallConnected,\n CallDisconnected,\n CallTransferAccepted,\n CallTransferFailed,\n ParticipantsUpdated,\n RecordingStateChanged,\n PlayCompleted,\n PlayFailed,\n PlayCanceled,\n RecognizeCompleted,\n RecognizeCanceled,\n RecognizeFailed,\n RemoveParticipantSucceeded,\n RemoveParticipantFailed,\n ContinuousDtmfRecognitionToneReceived,\n ContinuousDtmfRecognitionToneFailed,\n ContinuousDtmfRecognitionStopped,\n SendDtmfTonesCompleted,\n SendDtmfTonesFailed,\n CancelAddParticipantSucceeded,\n CancelAddParticipantFailed,\n TranscriptionStarted,\n TranscriptionStopped,\n TranscriptionUpdated,\n TranscriptionFailed,\n CreateCallFailed,\n AnswerFailed,\n HoldFailed,\n ConnectFailed,\n MediaStreamingStarted,\n MediaStreamingStopped,\n MediaStreamingFailed,\n PlayStarted,\n StartRecordingFailed,\n MoveParticipantSucceeded,\n MoveParticipantFailed,\n TranscriptionCallSummaryUpdated,\n} from \"./models/events.js\";\n\nimport { CloudEventMapper } from \"./models/mapper.js\";\nimport type { CallParticipantInternal } from \"./generated/src/index.js\";\n\nconst serializer = createSerializer();\n\n/**\n * Helper function for parsing Acs callback events.\n */\nexport function parseCallAutomationEvent(\n encodedEvents: string | Record<string, unknown>,\n): CallAutomationEvent {\n const decodedInput = parseAndWrap(encodedEvents);\n\n // parse cloudevent\n const deserialized = serializer.deserialize(CloudEventMapper, decodedInput, \"\");\n const data = deserialized.data;\n const eventType = deserialized.type;\n\n // get proper callbackevent and its parser\n let callbackEvent: CallAutomationEvent;\n let parsed: any = data;\n switch (eventType) {\n case \"Microsoft.Communication.AddParticipantSucceeded\":\n callbackEvent = { kind: \"AddParticipantSucceeded\" } as AddParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.AddParticipantFailed\":\n callbackEvent = { kind: \"AddParticipantFailed\" } as AddParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.RemoveParticipantSucceeded\":\n callbackEvent = { kind: \"RemoveParticipantSucceeded\" } as RemoveParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.RemoveParticipantFailed\":\n callbackEvent = { kind: \"RemoveParticipantFailed\" } as RemoveParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.CallConnected\":\n callbackEvent = { kind: \"CallConnected\" } as CallConnected;\n break;\n case \"Microsoft.Communication.CallDisconnected\":\n callbackEvent = { kind: \"CallDisconnected\" } as CallDisconnected;\n break;\n case \"Microsoft.Communication.CallTransferAccepted\":\n callbackEvent = { kind: \"CallTransferAccepted\" } as CallTransferAccepted;\n break;\n case \"Microsoft.Communication.CallTransferFailed\":\n callbackEvent = { kind: \"CallTransferFailed\" } as CallTransferFailed;\n break;\n case \"Microsoft.Communication.ParticipantsUpdated\":\n callbackEvent = { kind: \"ParticipantsUpdated\" } as ParticipantsUpdated;\n parsed = participantsParserForEvent(data);\n break;\n case \"Microsoft.Communication.RecordingStateChanged\":\n callbackEvent = { kind: \"RecordingStateChanged\" } as RecordingStateChanged;\n break;\n case \"Microsoft.Communication.PlayCompleted\":\n callbackEvent = { kind: \"PlayCompleted\" } as PlayCompleted;\n break;\n case \"Microsoft.Communication.PlayFailed\":\n callbackEvent = { kind: \"PlayFailed\" } as PlayFailed;\n break;\n case \"Microsoft.Communication.PlayCanceled\":\n callbackEvent = { kind: \"PlayCanceled\" } as PlayCanceled;\n break;\n case \"Microsoft.Communication.RecognizeCompleted\":\n callbackEvent = { kind: \"RecognizeCompleted\" } as RecognizeCompleted;\n break;\n case \"Microsoft.Communication.RecognizeCanceled\":\n callbackEvent = { kind: \"RecognizeCanceled\" } as RecognizeCanceled;\n break;\n case \"Microsoft.Communication.RecognizeFailed\":\n callbackEvent = { kind: \"RecognizeFailed\" } as RecognizeFailed;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionToneReceived\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionToneReceived\",\n } as ContinuousDtmfRecognitionToneReceived;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionToneFailed\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionToneFailed\",\n } as ContinuousDtmfRecognitionToneFailed;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionStopped\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionStopped\",\n } as ContinuousDtmfRecognitionStopped;\n break;\n case \"Microsoft.Communication.SendDtmfTonesCompleted\":\n callbackEvent = { kind: \"SendDtmfTonesCompleted\" } as SendDtmfTonesCompleted;\n break;\n case \"Microsoft.Communication.SendDtmfTonesFailed\":\n callbackEvent = { kind: \"SendDtmfTonesFailed\" } as SendDtmfTonesFailed;\n break;\n case \"Microsoft.Communication.CancelAddParticipantSucceeded\":\n callbackEvent = { kind: \"CancelAddParticipantSucceeded\" } as CancelAddParticipantSucceeded;\n break;\n case \"Microsoft.Communication.CancelAddParticipantFailed\":\n callbackEvent = { kind: \"CancelAddParticipantFailed\" } as CancelAddParticipantFailed;\n break;\n case \"Microsoft.Communication.TranscriptionStarted\":\n callbackEvent = { kind: \"TranscriptionStarted\" } as TranscriptionStarted;\n break;\n case \"Microsoft.Communication.TranscriptionStopped\":\n callbackEvent = { kind: \"TranscriptionStopped\" } as TranscriptionStopped;\n break;\n case \"Microsoft.Communication.TranscriptionUpdated\":\n callbackEvent = { kind: \"TranscriptionUpdated\" } as TranscriptionUpdated;\n break;\n case \"Microsoft.Communication.TranscriptionFailed\":\n callbackEvent = { kind: \"TranscriptionFailed\" } as TranscriptionFailed;\n break;\n case \"Microsoft.Communication.TranscriptionCallSummaryUpdated\":\n callbackEvent = {\n kind: \"TranscriptionCallSummaryUpdated\",\n } as TranscriptionCallSummaryUpdated;\n break;\n case \"Microsoft.Communication.CreateCallFailed\":\n callbackEvent = { kind: \"CreateCallFailed\" } as CreateCallFailed;\n break;\n case \"Microsoft.Communication.AnswerFailed\":\n callbackEvent = { kind: \"AnswerFailed\" } as AnswerFailed;\n break;\n case \"Microsoft.Communication.HoldFailed\":\n callbackEvent = { kind: \"HoldFailed\" } as HoldFailed;\n break;\n case \"Microsoft.Communication.ConnectFailed\":\n callbackEvent = { kind: \"ConnectFailed\" } as ConnectFailed;\n break;\n case \"Microsoft.Communication.MediaStreamingStarted\":\n callbackEvent = { kind: \"MediaStreamingStarted\" } as MediaStreamingStarted;\n break;\n case \"Microsoft.Communication.MediaStreamingStopped\":\n callbackEvent = { kind: \"MediaStreamingStopped\" } as MediaStreamingStopped;\n break;\n case \"Microsoft.Communication.MediaStreamingFailed\":\n callbackEvent = { kind: \"MediaStreamingFailed\" } as MediaStreamingFailed;\n break;\n case \"Microsoft.Communication.PlayStarted\":\n callbackEvent = { kind: \"PlayStarted\" } as PlayStarted;\n break;\n case \"Microsoft.Communication.StartRecordingFailed\":\n callbackEvent = { kind: \"StartRecordingFailed\" } as StartRecordingFailed;\n break;\n case \"Microsoft.Communication.MoveParticipantSucceeded\":\n callbackEvent = { kind: \"MoveParticipantSucceeded\" } as MoveParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n parsed.fromCall = data.fromCall;\n break;\n case \"Microsoft.Communication.MoveParticipantFailed\":\n callbackEvent = { kind: \"MoveParticipantFailed\" } as MoveParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n parsed.fromCall = data.fromCall;\n break;\n default:\n throw new TypeError(`Unknown Call Automation Event type: ${eventType}`);\n }\n\n return { ...parsed, ...callbackEvent } as CallAutomationEvent;\n}\n\nfunction parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n if (o.length === 0) {\n throw Error(\"Empty event array.\");\n }\n return o[0];\n } else {\n return o;\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n if (jsonStringOrObject.length === 0) {\n throw Error(\"Empty event array.\");\n }\n return jsonStringOrObject[0];\n } else {\n return jsonStringOrObject;\n }\n}\n\nfunction participantsParserForEvent(data: any): any {\n const { participants, ...rest } = data;\n return {\n ...rest,\n participants: participants?.map((participant: CallParticipantInternal) =>\n callParticipantConverter(participant),\n ),\n };\n}\n"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { CommunicationIdentifier } from "@azure/communication-common";
|
|
2
|
-
import { CallMedia } from "./callMedia.js";
|
|
3
|
-
import { CallAutomationApiClientOptionalParams } from "./generated/src/index.js";
|
|
4
|
-
import { type CallConnectionProperties, type CallInvite, type CallParticipant } from "./models/models.js";
|
|
5
|
-
import type { AddParticipantOptions, CancelAddParticipantOperationOptions, GetCallConnectionPropertiesOptions, GetParticipantOptions, HangUpOptions, MoveParticipantsOptions, MuteParticipantOption, RemoveParticipantsOption, TransferCallToParticipantOptions } from "./models/options.js";
|
|
6
|
-
import type { ListParticipantsResult, TransferCallResult, AddParticipantResult, RemoveParticipantResult, MuteParticipantResult, CancelAddParticipantOperationResult, MoveParticipantsResult } from "./models/responses.js";
|
|
7
|
-
import type { KeyCredential, TokenCredential } from "@azure/core-auth";
|
|
8
|
-
/**
|
|
9
|
-
* CallConnection class represents call connection based APIs.
|
|
10
|
-
*/
|
|
11
|
-
export declare class CallConnection {
|
|
12
|
-
private readonly callConnectionId;
|
|
13
|
-
private readonly callConnection;
|
|
14
|
-
private readonly callAutomationApiClient;
|
|
15
|
-
private readonly endpoint;
|
|
16
|
-
private readonly credential;
|
|
17
|
-
private readonly callAutomationApiClientOptions?;
|
|
18
|
-
constructor(callConnectionId: string, endpoint: string, credential: KeyCredential | TokenCredential, options?: CallAutomationApiClientOptionalParams);
|
|
19
|
-
/**
|
|
20
|
-
* Initializes a new instance of CallMedia.
|
|
21
|
-
*/
|
|
22
|
-
getCallMedia(): CallMedia;
|
|
23
|
-
/**
|
|
24
|
-
* Get call connection properties of the call
|
|
25
|
-
*/
|
|
26
|
-
getCallConnectionProperties(options?: GetCallConnectionPropertiesOptions): Promise<CallConnectionProperties>;
|
|
27
|
-
/**
|
|
28
|
-
* Hang up the call for itself or terminate the whole call.
|
|
29
|
-
*
|
|
30
|
-
* @param isForEveryOne - Determine if every one in the call would be hung up or not.
|
|
31
|
-
*/
|
|
32
|
-
hangUp(isForEveryone: boolean, options?: HangUpOptions): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Get a participant from the call
|
|
35
|
-
*
|
|
36
|
-
* @param targetParticipant - The communication identifier of requested participant.
|
|
37
|
-
*/
|
|
38
|
-
getParticipant(targetParticipant: CommunicationIdentifier, options?: GetParticipantOptions): Promise<CallParticipant>;
|
|
39
|
-
/**
|
|
40
|
-
* Get all participants from the call
|
|
41
|
-
*/
|
|
42
|
-
listParticipants(options?: GetParticipantOptions): Promise<ListParticipantsResult>;
|
|
43
|
-
private createCustomCallingContextInternal;
|
|
44
|
-
/**
|
|
45
|
-
* Add a participant to the call
|
|
46
|
-
*
|
|
47
|
-
* @param participant - The participant is going to be added.
|
|
48
|
-
*/
|
|
49
|
-
addParticipant(targetParticipant: CallInvite, options?: AddParticipantOptions): Promise<AddParticipantResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Transfer the call to a target participant
|
|
52
|
-
*
|
|
53
|
-
* @param targetParticipant - The target to be transferred to.
|
|
54
|
-
*/
|
|
55
|
-
transferCallToParticipant(targetParticipant: CommunicationIdentifier, options?: TransferCallToParticipantOptions): Promise<TransferCallResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Remove a participant from the call
|
|
58
|
-
*
|
|
59
|
-
* @param participant - The participant is going to be removed from the call.
|
|
60
|
-
*/
|
|
61
|
-
removeParticipant(participant: CommunicationIdentifier, options?: RemoveParticipantsOption): Promise<RemoveParticipantResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Mute participant from the call.
|
|
64
|
-
*
|
|
65
|
-
* @param participant - Participant to be muted from the call.
|
|
66
|
-
* @param options - Additional attributes for mute participant.
|
|
67
|
-
*/
|
|
68
|
-
muteParticipant(participant: CommunicationIdentifier, options?: MuteParticipantOption): Promise<MuteParticipantResult>;
|
|
69
|
-
/** Cancel add participant request.
|
|
70
|
-
*
|
|
71
|
-
* @param invitationId - Invitation ID used to cancel the add participant request.
|
|
72
|
-
*/
|
|
73
|
-
cancelAddParticipantOperation(invitationId: string, options?: CancelAddParticipantOperationOptions): Promise<CancelAddParticipantOperationResult>;
|
|
74
|
-
/**
|
|
75
|
-
* Move participants to the call
|
|
76
|
-
*
|
|
77
|
-
* @param targetParticipants - The participants to be moved to the call.
|
|
78
|
-
* @param fromCall - The CallConnectionId for the call you want to move the participant from.
|
|
79
|
-
* @param options - Additional attributes for move participants.
|
|
80
|
-
*/
|
|
81
|
-
moveParticipants(targetParticipants: CommunicationIdentifier[], fromCall: string, options?: MoveParticipantsOptions): Promise<MoveParticipantsResult>;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=callConnection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callConnection.d.ts","sourceRoot":"","sources":["../../src/callConnection.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EAExB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAGL,qCAAqC,EAMtC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,qBAAqB,EACrB,oCAAoC,EACpC,kCAAkC,EAClC,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,gCAAgC,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mCAAmC,EACnC,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA0B;IAClE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC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C;;;;;;OAMG;IACU,gBAAgB,CAC3B,kBAAkB,EAAE,uBAAuB,EAAE,EAC7C,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC;CA4BnC"}
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { createCommunicationAuthPolicy, } from "@azure/communication-common";
|
|
4
|
-
import { CallMedia } from "./callMedia.js";
|
|
5
|
-
import { CallAutomationApiClient, } from "./generated/src/index.js";
|
|
6
|
-
import { CallConnectionImpl } from "./generated/src/operations/index.js";
|
|
7
|
-
import { callParticipantConverter, communicationIdentifierConverter, communicationIdentifierModelConverter, communicationUserIdentifierConverter, phoneNumberIdentifierConverter, PhoneNumberIdentifierModelConverter, teamsPhoneCallDetailsModelConverter, } from "./utli/converters.js";
|
|
8
|
-
import { randomUUID } from "@azure/core-util";
|
|
9
|
-
/**
|
|
10
|
-
* CallConnection class represents call connection based APIs.
|
|
11
|
-
*/
|
|
12
|
-
export class CallConnection {
|
|
13
|
-
callConnectionId;
|
|
14
|
-
callConnection;
|
|
15
|
-
callAutomationApiClient;
|
|
16
|
-
endpoint;
|
|
17
|
-
credential;
|
|
18
|
-
callAutomationApiClientOptions;
|
|
19
|
-
constructor(callConnectionId, endpoint, credential, options) {
|
|
20
|
-
this.callAutomationApiClient = new CallAutomationApiClient(endpoint, options);
|
|
21
|
-
const authPolicy = createCommunicationAuthPolicy(credential);
|
|
22
|
-
this.callAutomationApiClient.pipeline.addPolicy(authPolicy);
|
|
23
|
-
this.callConnectionId = callConnectionId;
|
|
24
|
-
this.callConnection = new CallConnectionImpl(this.callAutomationApiClient);
|
|
25
|
-
this.endpoint = endpoint;
|
|
26
|
-
this.credential = credential;
|
|
27
|
-
this.callAutomationApiClientOptions = options;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Initializes a new instance of CallMedia.
|
|
31
|
-
*/
|
|
32
|
-
getCallMedia() {
|
|
33
|
-
return new CallMedia(this.callConnectionId, this.endpoint, this.credential, this.callAutomationApiClientOptions);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Get call connection properties of the call
|
|
37
|
-
*/
|
|
38
|
-
async getCallConnectionProperties(options = {}) {
|
|
39
|
-
const { targets, sourceCallerIdNumber, answeredBy, source, answeredFor, ...result } = await this.callConnection.getCall(this.callConnectionId, options);
|
|
40
|
-
const callConnectionProperties = {
|
|
41
|
-
...result,
|
|
42
|
-
source: source ? communicationIdentifierConverter(source) : undefined,
|
|
43
|
-
answeredby: communicationUserIdentifierConverter(answeredBy),
|
|
44
|
-
answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,
|
|
45
|
-
targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),
|
|
46
|
-
sourceCallerIdNumber: sourceCallerIdNumber
|
|
47
|
-
? phoneNumberIdentifierConverter(sourceCallerIdNumber)
|
|
48
|
-
: undefined,
|
|
49
|
-
};
|
|
50
|
-
return callConnectionProperties;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Hang up the call for itself or terminate the whole call.
|
|
54
|
-
*
|
|
55
|
-
* @param isForEveryOne - Determine if every one in the call would be hung up or not.
|
|
56
|
-
*/
|
|
57
|
-
async hangUp(isForEveryone, options = {}) {
|
|
58
|
-
if (isForEveryone) {
|
|
59
|
-
const optionsInternal = {
|
|
60
|
-
...options,
|
|
61
|
-
repeatabilityFirstSent: new Date(),
|
|
62
|
-
repeatabilityRequestID: randomUUID(),
|
|
63
|
-
};
|
|
64
|
-
await this.callConnection.terminateCall(this.callConnectionId, optionsInternal);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
await this.callConnection.hangupCall(this.callConnectionId, options);
|
|
68
|
-
}
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Get a participant from the call
|
|
73
|
-
*
|
|
74
|
-
* @param targetParticipant - The communication identifier of requested participant.
|
|
75
|
-
*/
|
|
76
|
-
async getParticipant(targetParticipant, options = {}) {
|
|
77
|
-
let rawId = communicationIdentifierModelConverter(targetParticipant).rawId;
|
|
78
|
-
rawId = rawId === undefined ? "" : rawId;
|
|
79
|
-
const result = await this.callConnection.getParticipant(this.callConnectionId, rawId, options);
|
|
80
|
-
const callParticipant = {
|
|
81
|
-
identifier: result.identifier
|
|
82
|
-
? communicationIdentifierConverter(result.identifier)
|
|
83
|
-
: undefined,
|
|
84
|
-
isMuted: result.isMuted,
|
|
85
|
-
isOnHold: result.isOnHold,
|
|
86
|
-
};
|
|
87
|
-
return callParticipant;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get all participants from the call
|
|
91
|
-
*/
|
|
92
|
-
async listParticipants(options = {}) {
|
|
93
|
-
const result = this.callConnection.listParticipants(this.callConnectionId, options);
|
|
94
|
-
const participants = [];
|
|
95
|
-
const pages = result?.byPage();
|
|
96
|
-
for await (const page of pages) {
|
|
97
|
-
for (const participant of page) {
|
|
98
|
-
participants.push(callParticipantConverter(participant));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const listParticipantResponse = {
|
|
102
|
-
...result,
|
|
103
|
-
values: participants,
|
|
104
|
-
};
|
|
105
|
-
return listParticipantResponse;
|
|
106
|
-
}
|
|
107
|
-
createCustomCallingContextInternal(customCallingContext) {
|
|
108
|
-
const sipHeaders = {};
|
|
109
|
-
const voipHeaders = {};
|
|
110
|
-
let teamsPhoneCallDetails = undefined;
|
|
111
|
-
if (customCallingContext) {
|
|
112
|
-
for (const header of customCallingContext) {
|
|
113
|
-
if (header.kind === "sipuui") {
|
|
114
|
-
sipHeaders[`User-To-User`] = header.value;
|
|
115
|
-
}
|
|
116
|
-
else if (header.kind === "sipx") {
|
|
117
|
-
if (header.sipHeaderPrefix === "X-") {
|
|
118
|
-
sipHeaders[`X-${header.key}`] = header.value;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
sipHeaders[`X-MS-Custom-${header.key}`] = header.value;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
else if (header.kind === "voip") {
|
|
125
|
-
voipHeaders[`${header.key}`] = header.value;
|
|
126
|
-
}
|
|
127
|
-
else if (header.kind === "teamsPhoneCallDetails") {
|
|
128
|
-
teamsPhoneCallDetails = teamsPhoneCallDetailsModelConverter(header);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
sipHeaders: sipHeaders,
|
|
134
|
-
voipHeaders: voipHeaders,
|
|
135
|
-
teamsPhoneCallDetails: teamsPhoneCallDetails,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Add a participant to the call
|
|
140
|
-
*
|
|
141
|
-
* @param participant - The participant is going to be added.
|
|
142
|
-
*/
|
|
143
|
-
async addParticipant(targetParticipant, options = {}) {
|
|
144
|
-
const addParticipantRequest = {
|
|
145
|
-
participantToAdd: communicationIdentifierModelConverter(targetParticipant.targetParticipant),
|
|
146
|
-
sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(targetParticipant.sourceCallIdNumber),
|
|
147
|
-
sourceDisplayName: targetParticipant.sourceDisplayName,
|
|
148
|
-
invitationTimeoutInSeconds: options.invitationTimeoutInSeconds,
|
|
149
|
-
operationContext: options.operationContext,
|
|
150
|
-
operationCallbackUri: options.operationCallbackUrl,
|
|
151
|
-
customCallingContext: this.createCustomCallingContextInternal(targetParticipant.customCallingContext),
|
|
152
|
-
};
|
|
153
|
-
const optionsInternal = {
|
|
154
|
-
...options,
|
|
155
|
-
repeatabilityFirstSent: new Date(),
|
|
156
|
-
repeatabilityRequestID: randomUUID(),
|
|
157
|
-
};
|
|
158
|
-
const result = await this.callConnection.addParticipant(this.callConnectionId, addParticipantRequest, optionsInternal);
|
|
159
|
-
const addParticipantsResult = {
|
|
160
|
-
...result,
|
|
161
|
-
participant: {
|
|
162
|
-
...result.participant,
|
|
163
|
-
identifier: result.participant?.identifier
|
|
164
|
-
? communicationIdentifierConverter(result.participant?.identifier)
|
|
165
|
-
: undefined,
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
return addParticipantsResult;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Transfer the call to a target participant
|
|
172
|
-
*
|
|
173
|
-
* @param targetParticipant - The target to be transferred to.
|
|
174
|
-
*/
|
|
175
|
-
async transferCallToParticipant(targetParticipant, options = {}) {
|
|
176
|
-
const transferToParticipantRequest = {
|
|
177
|
-
targetParticipant: communicationIdentifierModelConverter(targetParticipant),
|
|
178
|
-
operationContext: options.operationContext ? options.operationContext : randomUUID(),
|
|
179
|
-
operationCallbackUri: options.operationCallbackUrl,
|
|
180
|
-
transferee: options.transferee && communicationIdentifierModelConverter(options.transferee),
|
|
181
|
-
customCallingContext: this.createCustomCallingContextInternal(options.customCallingContext),
|
|
182
|
-
sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(options.sourceCallIdNumber),
|
|
183
|
-
};
|
|
184
|
-
const optionsInternal = {
|
|
185
|
-
...options,
|
|
186
|
-
repeatabilityFirstSent: new Date(),
|
|
187
|
-
repeatabilityRequestID: randomUUID(),
|
|
188
|
-
};
|
|
189
|
-
const result = await this.callConnection.transferToParticipant(this.callConnectionId, transferToParticipantRequest, optionsInternal);
|
|
190
|
-
const transferCallResult = {
|
|
191
|
-
...result,
|
|
192
|
-
};
|
|
193
|
-
return transferCallResult;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Remove a participant from the call
|
|
197
|
-
*
|
|
198
|
-
* @param participant - The participant is going to be removed from the call.
|
|
199
|
-
*/
|
|
200
|
-
async removeParticipant(participant, options = {}) {
|
|
201
|
-
const removeParticipantRequest = {
|
|
202
|
-
participantToRemove: communicationIdentifierModelConverter(participant),
|
|
203
|
-
operationContext: options.operationContext ? options.operationContext : randomUUID(),
|
|
204
|
-
operationCallbackUri: options.operationCallbackUrl,
|
|
205
|
-
};
|
|
206
|
-
const optionsInternal = {
|
|
207
|
-
...options,
|
|
208
|
-
repeatabilityFirstSent: new Date(),
|
|
209
|
-
repeatabilityRequestID: randomUUID(),
|
|
210
|
-
};
|
|
211
|
-
const result = await this.callConnection.removeParticipant(this.callConnectionId, removeParticipantRequest, optionsInternal);
|
|
212
|
-
const removeParticipantsResult = {
|
|
213
|
-
...result,
|
|
214
|
-
};
|
|
215
|
-
return removeParticipantsResult;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Mute participant from the call.
|
|
219
|
-
*
|
|
220
|
-
* @param participant - Participant to be muted from the call.
|
|
221
|
-
* @param options - Additional attributes for mute participant.
|
|
222
|
-
*/
|
|
223
|
-
async muteParticipant(participant, options = {}) {
|
|
224
|
-
const muteParticipantsRequest = {
|
|
225
|
-
targetParticipants: [communicationIdentifierModelConverter(participant)],
|
|
226
|
-
operationContext: options.operationContext,
|
|
227
|
-
};
|
|
228
|
-
const optionsInternal = {
|
|
229
|
-
...options,
|
|
230
|
-
repeatabilityFirstSent: new Date(),
|
|
231
|
-
repeatabilityRequestID: randomUUID(),
|
|
232
|
-
};
|
|
233
|
-
const result = await this.callConnection.mute(this.callConnectionId, muteParticipantsRequest, optionsInternal);
|
|
234
|
-
const muteParticipantResult = {
|
|
235
|
-
...result,
|
|
236
|
-
};
|
|
237
|
-
return muteParticipantResult;
|
|
238
|
-
}
|
|
239
|
-
/** Cancel add participant request.
|
|
240
|
-
*
|
|
241
|
-
* @param invitationId - Invitation ID used to cancel the add participant request.
|
|
242
|
-
*/
|
|
243
|
-
async cancelAddParticipantOperation(invitationId, options = {}) {
|
|
244
|
-
const { operationContext, operationCallbackUrl: operationCallbackUri, ...operationOptions } = options;
|
|
245
|
-
const cancelAddParticipantRequest = {
|
|
246
|
-
invitationId,
|
|
247
|
-
operationContext: operationContext ? operationContext : randomUUID(),
|
|
248
|
-
operationCallbackUri,
|
|
249
|
-
};
|
|
250
|
-
const optionsInternal = {
|
|
251
|
-
...operationOptions,
|
|
252
|
-
repeatabilityFirstSent: new Date(),
|
|
253
|
-
repeatabilityRequestID: randomUUID(),
|
|
254
|
-
};
|
|
255
|
-
const result = await this.callConnection.cancelAddParticipant(this.callConnectionId, cancelAddParticipantRequest, optionsInternal);
|
|
256
|
-
const cancelAddParticipantResult = {
|
|
257
|
-
...result,
|
|
258
|
-
};
|
|
259
|
-
return cancelAddParticipantResult;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Move participants to the call
|
|
263
|
-
*
|
|
264
|
-
* @param targetParticipants - The participants to be moved to the call.
|
|
265
|
-
* @param fromCall - The CallConnectionId for the call you want to move the participant from.
|
|
266
|
-
* @param options - Additional attributes for move participants.
|
|
267
|
-
*/
|
|
268
|
-
async moveParticipants(targetParticipants, fromCall, options = {}) {
|
|
269
|
-
const moveParticipantsRequest = {
|
|
270
|
-
targetParticipants: targetParticipants.map((participant) => communicationIdentifierModelConverter(participant)),
|
|
271
|
-
fromCall: fromCall,
|
|
272
|
-
operationContext: options.operationContext ? options.operationContext : randomUUID(),
|
|
273
|
-
operationCallbackUri: options.operationCallbackUrl,
|
|
274
|
-
};
|
|
275
|
-
const optionsInternal = {
|
|
276
|
-
...options,
|
|
277
|
-
repeatabilityFirstSent: new Date(),
|
|
278
|
-
repeatabilityRequestID: randomUUID(),
|
|
279
|
-
};
|
|
280
|
-
const result = await this.callConnection.moveParticipants(this.callConnectionId, moveParticipantsRequest, optionsInternal);
|
|
281
|
-
const moveParticipantsResult = {
|
|
282
|
-
...result,
|
|
283
|
-
participants: result.participants?.map((participant) => callParticipantConverter(participant)),
|
|
284
|
-
fromCall: fromCall,
|
|
285
|
-
};
|
|
286
|
-
return moveParticipantsResult;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
//# sourceMappingURL=callConnection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callConnection.js","sourceRoot":"","sources":["../../src/call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GAAwC;YACtE,GAAG,MAAM;SACV,CAAC;QAEF,OAAO,0BAA0B,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,gBAAgB,CAC3B,kBAA6C,EAC7C,QAAgB,EAChB,UAAmC,EAAE;QAErC,MAAM,uBAAuB,GAA4B;YACvD,kBAAkB,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACzD,qCAAqC,CAAC,WAAW,CAAC,CACnD;YACD,QAAQ,EAAE,QAAQ;YAClB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,EAAE;YACpF,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;SACnD,CAAC;QACF,MAAM,eAAe,GAAG;YACtB,GAAG,OAAO;YACV,sBAAsB,EAAE,IAAI,IAAI,EAAE;YAClC,sBAAsB,EAAE,UAAU,EAAE;SACrC,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CACvD,IAAI,CAAC,gBAAgB,EACrB,uBAAuB,EACvB,eAAe,CAChB,CAAC;QACF,MAAM,sBAAsB,GAA2B;YACrD,GAAG,MAAM;YACT,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACrD,wBAAwB,CAAC,WAAW,CAAC,CACtC;YACD,QAAQ,EAAE,QAAQ;SACnB,CAAC;QACF,OAAO,sBAAsB,CAAC;IAChC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n CommunicationIdentifier,\n createCommunicationAuthPolicy,\n} from \"@azure/communication-common\";\nimport { CallMedia } from \"./callMedia.js\";\nimport {\n AddParticipantRequest,\n CallAutomationApiClient,\n CallAutomationApiClientOptionalParams,\n CustomCallingContextInternal,\n MoveParticipantsRequest,\n MuteParticipantsRequest,\n RemoveParticipantRequest,\n TransferToParticipantRequest,\n} from \"./generated/src/index.js\";\nimport { CallConnectionImpl } from \"./generated/src/operations/index.js\";\nimport {\n type CallConnectionProperties,\n type CallInvite,\n type CallParticipant,\n type CustomCallingContext,\n} from \"./models/models.js\";\nimport type {\n AddParticipantOptions,\n CancelAddParticipantOperationOptions,\n GetCallConnectionPropertiesOptions,\n GetParticipantOptions,\n HangUpOptions,\n MoveParticipantsOptions,\n MuteParticipantOption,\n RemoveParticipantsOption,\n TransferCallToParticipantOptions,\n} from \"./models/options.js\";\nimport type {\n ListParticipantsResult,\n TransferCallResult,\n AddParticipantResult,\n RemoveParticipantResult,\n MuteParticipantResult,\n CancelAddParticipantOperationResult,\n MoveParticipantsResult,\n} from \"./models/responses.js\";\nimport {\n callParticipantConverter,\n communicationIdentifierConverter,\n communicationIdentifierModelConverter,\n communicationUserIdentifierConverter,\n phoneNumberIdentifierConverter,\n PhoneNumberIdentifierModelConverter,\n teamsPhoneCallDetailsModelConverter,\n} from \"./utli/converters.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\n\n/**\n * CallConnection class represents call connection based APIs.\n */\nexport class CallConnection {\n private readonly callConnectionId: string;\n private readonly callConnection: CallConnectionImpl;\n private readonly callAutomationApiClient: CallAutomationApiClient;\n private readonly endpoint: string;\n private readonly credential: TokenCredential | KeyCredential;\n private readonly callAutomationApiClientOptions?: CallAutomationApiClientOptionalParams;\n constructor(\n callConnectionId: string,\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options?: CallAutomationApiClientOptionalParams,\n ) {\n this.callAutomationApiClient = new CallAutomationApiClient(endpoint, options);\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.callAutomationApiClient.pipeline.addPolicy(authPolicy);\n this.callConnectionId = callConnectionId;\n this.callConnection = new CallConnectionImpl(this.callAutomationApiClient);\n this.endpoint = endpoint;\n this.credential = credential;\n this.callAutomationApiClientOptions = options;\n }\n\n /**\n * Initializes a new instance of CallMedia.\n */\n public getCallMedia(): CallMedia {\n return new CallMedia(\n this.callConnectionId,\n this.endpoint,\n this.credential,\n this.callAutomationApiClientOptions,\n );\n }\n\n /**\n * Get call connection properties of the call\n */\n public async getCallConnectionProperties(\n options: GetCallConnectionPropertiesOptions = {},\n ): Promise<CallConnectionProperties> {\n const { targets, sourceCallerIdNumber, answeredBy, source, answeredFor, ...result } =\n await this.callConnection.getCall(this.callConnectionId, options);\n const callConnectionProperties: CallConnectionProperties = {\n ...result,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: communicationUserIdentifierConverter(answeredBy),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n return callConnectionProperties;\n }\n\n /**\n * Hang up the call for itself or terminate the whole call.\n *\n * @param isForEveryOne - Determine if every one in the call would be hung up or not.\n */\n public async hangUp(isForEveryone: boolean, options: HangUpOptions = {}): Promise<void> {\n if (isForEveryone) {\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n await this.callConnection.terminateCall(this.callConnectionId, optionsInternal);\n } else {\n await this.callConnection.hangupCall(this.callConnectionId, options);\n }\n return;\n }\n\n /**\n * Get a participant from the call\n *\n * @param targetParticipant - The communication identifier of requested participant.\n */\n public async getParticipant(\n targetParticipant: CommunicationIdentifier,\n options: GetParticipantOptions = {},\n ): Promise<CallParticipant> {\n let rawId: string | undefined = communicationIdentifierModelConverter(targetParticipant).rawId;\n rawId = rawId === undefined ? \"\" : rawId;\n\n const result = await this.callConnection.getParticipant(this.callConnectionId, rawId, options);\n const callParticipant: CallParticipant = {\n identifier: result.identifier\n ? communicationIdentifierConverter(result.identifier)\n : undefined,\n isMuted: result.isMuted,\n isOnHold: result.isOnHold,\n };\n return callParticipant;\n }\n\n /**\n * Get all participants from the call\n */\n public async listParticipants(\n options: GetParticipantOptions = {},\n ): Promise<ListParticipantsResult> {\n const result = this.callConnection.listParticipants(this.callConnectionId, options);\n const participants = [];\n const pages = result?.byPage();\n\n for await (const page of pages) {\n for (const participant of page) {\n participants.push(callParticipantConverter(participant));\n }\n }\n\n const listParticipantResponse: ListParticipantsResult = {\n ...result,\n values: participants,\n };\n return listParticipantResponse;\n }\n\n private createCustomCallingContextInternal(\n customCallingContext: CustomCallingContext,\n ): CustomCallingContextInternal {\n const sipHeaders: { [key: string]: string } = {};\n const voipHeaders: { [key: string]: string } = {};\n let teamsPhoneCallDetails: any = undefined;\n if (customCallingContext) {\n for (const header of customCallingContext) {\n if (header.kind === \"sipuui\") {\n sipHeaders[`User-To-User`] = header.value;\n } else if (header.kind === \"sipx\") {\n if (header.sipHeaderPrefix === \"X-\") {\n sipHeaders[`X-${header.key}`] = header.value;\n } else {\n sipHeaders[`X-MS-Custom-${header.key}`] = header.value;\n }\n } else if (header.kind === \"voip\") {\n voipHeaders[`${header.key}`] = header.value;\n } else if (header.kind === \"teamsPhoneCallDetails\") {\n teamsPhoneCallDetails = teamsPhoneCallDetailsModelConverter(header);\n }\n }\n }\n return {\n sipHeaders: sipHeaders,\n voipHeaders: voipHeaders,\n teamsPhoneCallDetails: teamsPhoneCallDetails,\n };\n }\n\n /**\n * Add a participant to the call\n *\n * @param participant - The participant is going to be added.\n */\n public async addParticipant(\n targetParticipant: CallInvite,\n options: AddParticipantOptions = {},\n ): Promise<AddParticipantResult> {\n const addParticipantRequest: AddParticipantRequest = {\n participantToAdd: communicationIdentifierModelConverter(targetParticipant.targetParticipant),\n sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(\n targetParticipant.sourceCallIdNumber,\n ),\n sourceDisplayName: targetParticipant.sourceDisplayName,\n invitationTimeoutInSeconds: options.invitationTimeoutInSeconds,\n operationContext: options.operationContext,\n operationCallbackUri: options.operationCallbackUrl,\n customCallingContext: this.createCustomCallingContextInternal(\n targetParticipant.customCallingContext!,\n ),\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const result = await this.callConnection.addParticipant(\n this.callConnectionId,\n addParticipantRequest,\n optionsInternal,\n );\n const addParticipantsResult: AddParticipantResult = {\n ...result,\n participant: {\n ...result.participant,\n identifier: result.participant?.identifier\n ? communicationIdentifierConverter(result.participant?.identifier)\n : undefined,\n },\n };\n return addParticipantsResult;\n }\n\n /**\n * Transfer the call to a target participant\n *\n * @param targetParticipant - The target to be transferred to.\n */\n public async transferCallToParticipant(\n targetParticipant: CommunicationIdentifier,\n options: TransferCallToParticipantOptions = {},\n ): Promise<TransferCallResult> {\n const transferToParticipantRequest: TransferToParticipantRequest = {\n targetParticipant: communicationIdentifierModelConverter(targetParticipant),\n operationContext: options.operationContext ? options.operationContext : randomUUID(),\n operationCallbackUri: options.operationCallbackUrl,\n transferee: options.transferee && communicationIdentifierModelConverter(options.transferee),\n customCallingContext: this.createCustomCallingContextInternal(options.customCallingContext!),\n sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(options.sourceCallIdNumber),\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const result = await this.callConnection.transferToParticipant(\n this.callConnectionId,\n transferToParticipantRequest,\n optionsInternal,\n );\n const transferCallResult: TransferCallResult = {\n ...result,\n };\n return transferCallResult;\n }\n\n /**\n * Remove a participant from the call\n *\n * @param participant - The participant is going to be removed from the call.\n */\n public async removeParticipant(\n participant: CommunicationIdentifier,\n options: RemoveParticipantsOption = {},\n ): Promise<RemoveParticipantResult> {\n const removeParticipantRequest: RemoveParticipantRequest = {\n participantToRemove: communicationIdentifierModelConverter(participant),\n operationContext: options.operationContext ? options.operationContext : randomUUID(),\n operationCallbackUri: options.operationCallbackUrl,\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const result = await this.callConnection.removeParticipant(\n this.callConnectionId,\n removeParticipantRequest,\n optionsInternal,\n );\n const removeParticipantsResult: RemoveParticipantResult = {\n ...result,\n };\n return removeParticipantsResult;\n }\n\n /**\n * Mute participant from the call.\n *\n * @param participant - Participant to be muted from the call.\n * @param options - Additional attributes for mute participant.\n */\n public async muteParticipant(\n participant: CommunicationIdentifier,\n options: MuteParticipantOption = {},\n ): Promise<MuteParticipantResult> {\n const muteParticipantsRequest: MuteParticipantsRequest = {\n targetParticipants: [communicationIdentifierModelConverter(participant)],\n operationContext: options.operationContext,\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const result = await this.callConnection.mute(\n this.callConnectionId,\n muteParticipantsRequest,\n optionsInternal,\n );\n const muteParticipantResult: MuteParticipantResult = {\n ...result,\n };\n return muteParticipantResult;\n }\n\n /** Cancel add participant request.\n *\n * @param invitationId - Invitation ID used to cancel the add participant request.\n */\n public async cancelAddParticipantOperation(\n invitationId: string,\n options: CancelAddParticipantOperationOptions = {},\n ): Promise<CancelAddParticipantOperationResult> {\n const {\n operationContext,\n operationCallbackUrl: operationCallbackUri,\n ...operationOptions\n } = options;\n const cancelAddParticipantRequest = {\n invitationId,\n operationContext: operationContext ? operationContext : randomUUID(),\n operationCallbackUri,\n };\n const optionsInternal = {\n ...operationOptions,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n const result = await this.callConnection.cancelAddParticipant(\n this.callConnectionId,\n cancelAddParticipantRequest,\n optionsInternal,\n );\n\n const cancelAddParticipantResult: CancelAddParticipantOperationResult = {\n ...result,\n };\n\n return cancelAddParticipantResult;\n }\n\n /**\n * Move participants to the call\n *\n * @param targetParticipants - The participants to be moved to the call.\n * @param fromCall - The CallConnectionId for the call you want to move the participant from.\n * @param options - Additional attributes for move participants.\n */\n public async moveParticipants(\n targetParticipants: CommunicationIdentifier[],\n fromCall: string,\n options: MoveParticipantsOptions = {},\n ): Promise<MoveParticipantsResult> {\n const moveParticipantsRequest: MoveParticipantsRequest = {\n targetParticipants: targetParticipants.map((participant) =>\n communicationIdentifierModelConverter(participant),\n ),\n fromCall: fromCall,\n operationContext: options.operationContext ? options.operationContext : randomUUID(),\n operationCallbackUri: options.operationCallbackUrl,\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const result = await this.callConnection.moveParticipants(\n this.callConnectionId,\n moveParticipantsRequest,\n optionsInternal,\n );\n const moveParticipantsResult: MoveParticipantsResult = {\n ...result,\n participants: result.participants?.map((participant) =>\n callParticipantConverter(participant),\n ),\n fromCall: fromCall,\n };\n return moveParticipantsResult;\n }\n}\n"]}
|