@fonoster/apiserver 0.27.0 → 0.31.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/applications/buildService.d.ts +5 -1
- package/dist/applications/buildService.js +10 -7
- package/dist/applications/createCreateApplication.d.ts +6 -2
- package/dist/applications/createCreateApplication.js +24 -16
- package/dist/applications/createCreateTestToken.d.ts +3 -1
- package/dist/applications/createCreateTestToken.js +18 -13
- package/dist/applications/createGetApplication.js +2 -2
- package/dist/applications/createGetFnUtil.d.ts +22 -18
- package/dist/applications/createGetFnUtil.js +3 -5
- package/dist/applications/createListApplications.js +3 -4
- package/dist/applications/createRotateSigningSecret.d.ts +9 -0
- package/dist/{calls/createFetchSingleCall.js → applications/createRotateSigningSecret.js} +23 -20
- package/dist/applications/createUpdateApplication.d.ts +6 -2
- package/dist/applications/createUpdateApplication.js +35 -36
- package/dist/applications/evalKeys.d.ts +9 -0
- package/dist/{voice/handlers/dial/recordChannel.js → applications/evalKeys.js} +17 -12
- package/dist/applications/session/appModel.d.ts +225 -0
- package/dist/applications/session/appModel.js +331 -0
- package/dist/applications/types.d.ts +1 -27
- package/dist/billing/buildService.d.ts +24 -0
- package/dist/billing/buildService.js +116 -0
- package/dist/bin/entrypoint.d.ts +1 -0
- package/dist/bin/entrypoint.js +180 -0
- package/dist/bin/healthcheck.d.ts +2 -0
- package/dist/{voice/utils/VoiceServiceClientConstructor.js → bin/healthcheck.js} +24 -9
- package/dist/bin/regionHubSetup.d.ts +2 -0
- package/dist/bin/regionHubSetup.js +67 -0
- package/dist/bin/usage.d.ts +2 -0
- package/dist/bin/usage.js +119 -0
- package/dist/calls/buildService.d.ts +1 -20
- package/dist/calls/buildService.js +59 -6
- package/dist/calls/createCall.d.ts +17 -2
- package/dist/calls/createCall.js +64 -11
- package/dist/calls/createCallPublisher.d.ts +40 -2
- package/dist/calls/createCallPublisher.js +43 -9
- package/dist/calls/createIsWorkspaceNumber.d.ts +41 -0
- package/dist/calls/createIsWorkspaceNumber.js +39 -0
- package/dist/calls/createTrackCall.d.ts +55 -2
- package/dist/calls/createTrackCall.js +230 -16
- package/dist/calls/getCall.d.ts +4 -2
- package/dist/calls/getCall.js +2 -3
- package/dist/calls/listCalls.d.ts +4 -2
- package/dist/calls/listCalls.js +2 -3
- package/dist/calls/types.d.ts +11 -2
- package/dist/calls/types.js +10 -0
- package/dist/{core/buildWelcomeDemoService.d.ts → capabilities/buildService.d.ts} +8 -8
- package/dist/capabilities/buildService.js +17 -0
- package/dist/capabilities/createGetCapabilities.d.ts +78 -0
- package/dist/capabilities/createGetCapabilities.js +98 -0
- package/dist/{voice/handlers/utils → capabilities}/index.d.ts +2 -3
- package/dist/{voice/handlers/utils → capabilities}/index.js +4 -3
- package/dist/config/index.d.ts +23 -0
- package/dist/config/index.js +102 -0
- package/dist/config/schema.d.ts +1919 -0
- package/dist/config/schema.js +357 -0
- package/dist/core/allowList.js +2 -1
- package/dist/core/applyCatalog.d.ts +10 -0
- package/dist/{voice/client/GrpcClientHandler.js → core/applyCatalog.js} +45 -51
- package/dist/core/db.d.ts +3 -1
- package/dist/core/db.js +2 -1
- package/dist/core/durableConsumer.d.ts +41 -0
- package/dist/core/durableConsumer.js +104 -0
- package/dist/core/httpBridge.d.ts +24 -6
- package/dist/core/httpBridge.js +3 -25
- package/dist/core/identityConfig.d.ts +2 -35
- package/dist/core/identityConfig.js +3 -36
- package/dist/core/regionHooks.d.ts +15 -0
- package/dist/{calls/influxdb.js → core/regionHooks.js} +4 -8
- package/dist/core/runServices.js +98 -15
- package/dist/core/services.d.ts +96 -6
- package/dist/core/services.js +49 -10
- package/dist/{voice/errors/index.d.ts → core/telemetry.d.ts} +2 -2
- package/dist/core/telemetry.js +42 -0
- package/dist/{applications/utils/convertToApplicationData.d.ts → core/telemetryInterceptor.d.ts} +10 -4
- package/dist/core/telemetryInterceptor.js +57 -0
- package/dist/core/testTokenConfig.js +4 -1
- package/dist/core/upsertRoomrPeer.d.ts +6 -0
- package/dist/core/{upsertDefaultPeer.js → upsertRoomrPeer.js} +31 -30
- package/dist/envs.d.ts +136 -23
- package/dist/envs.js +108 -143
- package/dist/index.js +39 -21
- package/dist/outbound/createNodeDirectory.d.ts +86 -0
- package/dist/outbound/createNodeDirectory.js +140 -0
- package/dist/{voice/integrations → outbound}/index.d.ts +4 -1
- package/dist/{voice/errors → outbound}/index.js +4 -2
- package/dist/outbound/placeOutboundCall.d.ts +96 -0
- package/dist/outbound/placeOutboundCall.js +172 -0
- package/dist/outbound/placementSweep.d.ts +56 -0
- package/dist/outbound/placementSweep.js +127 -0
- package/dist/outbound/runOutboundCalls.d.ts +52 -0
- package/dist/outbound/runOutboundCalls.js +171 -0
- package/dist/providers/createProvidersHandlers.d.ts +39 -0
- package/dist/providers/createProvidersHandlers.js +229 -0
- package/dist/providers/index.d.ts +47 -0
- package/dist/{voice/client → providers}/index.js +15 -6
- package/dist/providers/registryUsage.d.ts +48 -0
- package/dist/providers/registryUsage.js +236 -0
- package/dist/records/createIndexRecord.d.ts +42 -0
- package/dist/records/createIndexRecord.js +185 -0
- package/dist/records/createRecordsRouter.d.ts +61 -0
- package/dist/records/createRecordsRouter.js +330 -0
- package/dist/records/createSearchRecords.d.ts +51 -0
- package/dist/records/createSearchRecords.js +134 -0
- package/dist/{voice/filters → records}/index.d.ts +6 -6
- package/dist/{voice/filters → records}/index.js +6 -6
- package/dist/records/maintenance.d.ts +33 -0
- package/dist/records/maintenance.js +166 -0
- package/dist/records/runCallRecords.d.ts +48 -0
- package/dist/records/runCallRecords.js +49 -0
- package/dist/{events/createPerCallCache.d.ts → records/stores.d.ts} +4 -7
- package/dist/{voice/handlers/utils/isDtmf.js → records/stores.js} +9 -3
- package/dist/records/types.d.ts +104 -0
- package/dist/regions/configSync.d.ts +130 -0
- package/dist/regions/configSync.js +316 -0
- package/dist/regions/createRegionsRouter.d.ts +151 -0
- package/dist/regions/createRegionsRouter.js +391 -0
- package/dist/regions/endpoints.d.ts +41 -0
- package/dist/regions/endpoints.js +90 -0
- package/dist/regions/enrollmentToken.d.ts +41 -0
- package/dist/regions/enrollmentToken.js +94 -0
- package/dist/regions/httpAuth.d.ts +39 -0
- package/dist/regions/httpAuth.js +78 -0
- package/dist/regions/ids.d.ts +15 -0
- package/dist/regions/ids.js +81 -0
- package/dist/{voice/client → regions}/index.d.ts +17 -6
- package/dist/regions/index.js +51 -0
- package/dist/regions/link.d.ts +17 -0
- package/dist/regions/link.js +170 -0
- package/dist/regions/natsAuth.d.ts +41 -0
- package/dist/regions/natsAuth.js +64 -0
- package/dist/regions/natsJwt.d.ts +23 -0
- package/dist/regions/natsJwt.js +26 -0
- package/dist/regions/relay.d.ts +45 -0
- package/dist/regions/relay.js +203 -0
- package/dist/regions/relayHttp.d.ts +7 -0
- package/dist/regions/relayHttp.js +107 -0
- package/dist/regions/relaySlots.d.ts +18 -0
- package/dist/regions/relaySlots.js +118 -0
- package/dist/regions/runRegions.d.ts +111 -0
- package/dist/regions/runRegions.js +235 -0
- package/dist/regions/service.d.ts +129 -0
- package/dist/regions/service.js +558 -0
- package/dist/regions/sources.d.ts +20 -0
- package/dist/regions/sources.js +191 -0
- package/dist/regions/status.d.ts +35 -0
- package/dist/regions/status.js +63 -0
- package/dist/regions/types.d.ts +123 -0
- package/dist/regions/types.js +41 -0
- package/dist/{voice/integrations/getSttConfig.d.ts → regions/withConfigChangeHook.d.ts} +13 -7
- package/dist/regions/withConfigChangeHook.js +44 -0
- package/dist/secrets/createGetFnUtil.d.ts +2 -2
- package/dist/session/createSessionRouter.d.ts +49 -0
- package/dist/session/createSessionRouter.js +206 -0
- package/dist/{voice/handlers/dial → session}/index.d.ts +1 -1
- package/dist/{voice/handlers/dial → session}/index.js +1 -1
- package/dist/usage/buildService.d.ts +16 -0
- package/dist/{voice/integrations/getTtsConfig.js → usage/buildService.js} +13 -7
- package/dist/{voice/tts/utils/convertUlawToPCM16.d.ts → usage/createGetUsage.d.ts} +7 -6
- package/dist/usage/createGetUsage.js +118 -0
- package/dist/usage/ingestUsage.d.ts +7 -0
- package/dist/usage/ingestUsage.js +87 -0
- package/dist/usage/publishRecordedUsage.d.ts +52 -0
- package/dist/usage/publishRecordedUsage.js +103 -0
- package/dist/{utils/createHandleDialEventsWithNats.d.ts → usage/publishUsage.d.ts} +10 -4
- package/dist/usage/publishUsage.js +50 -0
- package/dist/usage/rebuildUsage.d.ts +48 -0
- package/dist/usage/rebuildUsage.js +104 -0
- package/dist/usage/runUsageConsumer.d.ts +22 -0
- package/dist/usage/runUsageConsumer.js +78 -0
- package/dist/usage/snapshotStorage.d.ts +14 -0
- package/dist/usage/snapshotStorage.js +95 -0
- package/dist/{voice/integrations/getTtsConfig.d.ts → usage/types.d.ts} +17 -6
- package/dist/utils/createCheckNumberPreconditions.js +4 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/voice/stt/Deepgram.d.ts +4 -57
- package/dist/voice/stt/Deepgram.js +15 -286
- package/dist/voice/stt/Google.d.ts +4 -15
- package/dist/voice/stt/Google.js +7 -103
- package/dist/voice/stt/types.d.ts +2 -38
- package/dist/voice/stt/types.js +25 -3
- package/dist/voice/tts/Azure.d.ts +4 -34
- package/dist/voice/tts/Azure.js +25 -105
- package/dist/voice/tts/Deepgram.d.ts +4 -38
- package/dist/voice/tts/Deepgram.js +25 -82
- package/dist/voice/tts/ElevenLabs.d.ts +4 -18
- package/dist/voice/tts/ElevenLabs.js +6 -97
- package/dist/voice/tts/Google.d.ts +4 -38
- package/dist/voice/tts/Google.js +25 -91
- package/dist/webhooks/createWebhooksHandlers.d.ts +37 -0
- package/dist/webhooks/createWebhooksHandlers.js +217 -0
- package/dist/webhooks/index.d.ts +37 -0
- package/dist/webhooks/index.js +51 -0
- package/dist/webhooks/lostCalls.d.ts +49 -0
- package/dist/webhooks/lostCalls.js +147 -0
- package/dist/webhooks/nodeCallEvents.d.ts +73 -0
- package/dist/webhooks/nodeCallEvents.js +177 -0
- package/dist/webhooks/runWebhookFanout.d.ts +44 -0
- package/dist/webhooks/runWebhookFanout.js +202 -0
- package/package.json +21 -31
- package/dist/applications/utils/applicationWithEncodedStruct.d.ts +0 -3
- package/dist/applications/utils/applicationWithEncodedStruct.js +0 -50
- package/dist/applications/utils/convertToApplicationData.js +0 -37
- package/dist/applications/validation/assistantWithoutApiKeySchema.d.ts +0 -786
- package/dist/applications/validation/assistantWithoutApiKeySchema.js +0 -35
- package/dist/applications/validation/createValidationSchema.d.ts +0 -1474
- package/dist/applications/validation/createValidationSchema.js +0 -67
- package/dist/applications/validation/prepareForValidation.d.ts +0 -21
- package/dist/applications/validation/prepareForValidation.js +0 -35
- package/dist/applications/validation/speechValidators.d.ts +0 -47
- package/dist/applications/validation/speechValidators.js +0 -50
- package/dist/applications/validation/validOrThrow.d.ts +0 -21
- package/dist/applications/validation/validOrThrow.js +0 -15
- package/dist/calls/createFetchCalls.d.ts +0 -22
- package/dist/calls/createFetchCalls.js +0 -88
- package/dist/calls/createFetchSingleCall.d.ts +0 -22
- package/dist/calls/influxdb.d.ts +0 -2
- package/dist/calls/runCallManager.d.ts +0 -8
- package/dist/calls/runCallManager.js +0 -75
- package/dist/core/buildWelcomeDemoService.js +0 -97
- package/dist/core/upsertDefaultPeer.d.ts +0 -2
- package/dist/events/amdResultCache.d.ts +0 -23
- package/dist/events/amdResultCache.js +0 -35
- package/dist/events/createInfluxDbPub.d.ts +0 -13
- package/dist/events/createInfluxDbPub.js +0 -89
- package/dist/events/createPerCallCache.js +0 -46
- package/dist/events/mapCallDirectionToEnum.d.ts +0 -21
- package/dist/events/mapCallDirectionToEnum.js +0 -37
- package/dist/events/nats.d.ts +0 -10
- package/dist/events/nats.js +0 -82
- package/dist/events/transformEvent.d.ts +0 -2
- package/dist/events/transformEvent.js +0 -87
- package/dist/events/types.d.ts +0 -26
- package/dist/utils/createHandleDialEventsWithNats.js +0 -24
- package/dist/utils/createHandleDialEventsWithVoiceClient.d.ts +0 -23
- package/dist/utils/createHandleDialEventsWithVoiceClient.js +0 -27
- package/dist/utils/getIntegrationsFromFile.d.ts +0 -2
- package/dist/utils/getIntegrationsFromFile.js +0 -49
- package/dist/utils/mapDialStatus.d.ts +0 -21
- package/dist/utils/mapDialStatus.js +0 -38
- package/dist/voice/VoiceDispatcher.d.ts +0 -21
- package/dist/voice/VoiceDispatcher.js +0 -122
- package/dist/voice/amd/mapAsteriskAmd.d.ts +0 -38
- package/dist/voice/amd/mapAsteriskAmd.js +0 -68
- package/dist/voice/client/AudioSocketHandler.d.ts +0 -38
- package/dist/voice/client/AudioSocketHandler.js +0 -70
- package/dist/voice/client/AuthorizationHandler.d.ts +0 -13
- package/dist/voice/client/AuthorizationHandler.js +0 -78
- package/dist/voice/client/ExternalMediaHandler.d.ts +0 -32
- package/dist/voice/client/ExternalMediaHandler.js +0 -59
- package/dist/voice/client/GrpcClientHandler.d.ts +0 -36
- package/dist/voice/client/SpeechHandler.d.ts +0 -60
- package/dist/voice/client/SpeechHandler.js +0 -120
- package/dist/voice/client/VoiceClientImpl.d.ts +0 -79
- package/dist/voice/client/VoiceClientImpl.js +0 -198
- package/dist/voice/connectToAri.d.ts +0 -2
- package/dist/voice/connectToAri.js +0 -81
- package/dist/voice/createCreateVoiceClient.d.ts +0 -9
- package/dist/voice/createCreateVoiceClient.js +0 -97
- package/dist/voice/errors/ChannelVarNotFoundError.d.ts +0 -23
- package/dist/voice/errors/ChannelVarNotFoundError.js +0 -10
- package/dist/voice/errors/MethodNotImplementedError.d.ts +0 -22
- package/dist/voice/errors/MethodNotImplementedError.js +0 -27
- package/dist/voice/filters/AudioFilterFactory.d.ts +0 -35
- package/dist/voice/filters/AudioFilterFactory.js +0 -94
- package/dist/voice/filters/aiCoustics/createAiCousticsFilter.d.ts +0 -64
- package/dist/voice/filters/aiCoustics/createAiCousticsFilter.js +0 -252
- package/dist/voice/filters/aiCoustics/types.d.ts +0 -45
- package/dist/voice/filters/aiCoustics/types.js +0 -29
- package/dist/voice/filters/createAudioFilterChain.d.ts +0 -9
- package/dist/voice/filters/createAudioFilterChain.js +0 -171
- package/dist/voice/filters/createAudioFilterSession.d.ts +0 -15
- package/dist/voice/filters/createAudioFilterSession.js +0 -114
- package/dist/voice/filters/pcm.d.ts +0 -21
- package/dist/voice/filters/pcm.js +0 -37
- package/dist/voice/filters/types.d.ts +0 -61
- package/dist/voice/filters/types.js +0 -26
- package/dist/voice/handlers/createAnswerHandler.d.ts +0 -23
- package/dist/voice/handlers/createAnswerHandler.js +0 -24
- package/dist/voice/handlers/createHangupHandler.d.ts +0 -23
- package/dist/voice/handlers/createHangupHandler.js +0 -28
- package/dist/voice/handlers/createMuteHandler.d.ts +0 -4
- package/dist/voice/handlers/createMuteHandler.js +0 -27
- package/dist/voice/handlers/createPlayDtmfHandler.d.ts +0 -4
- package/dist/voice/handlers/createPlayDtmfHandler.js +0 -27
- package/dist/voice/handlers/createPlayHandler.d.ts +0 -4
- package/dist/voice/handlers/createPlayHandler.js +0 -33
- package/dist/voice/handlers/createPlaybackControlHandler.d.ts +0 -4
- package/dist/voice/handlers/createPlaybackControlHandler.js +0 -62
- package/dist/voice/handlers/createRecordHandler.d.ts +0 -4
- package/dist/voice/handlers/createRecordHandler.js +0 -58
- package/dist/voice/handlers/createSayHandler.d.ts +0 -4
- package/dist/voice/handlers/createSayHandler.js +0 -31
- package/dist/voice/handlers/createSetAudioFiltersHandler.d.ts +0 -11
- package/dist/voice/handlers/createSetAudioFiltersHandler.js +0 -74
- package/dist/voice/handlers/createStopSayHandler.d.ts +0 -3
- package/dist/voice/handlers/createStopSayHandler.js +0 -34
- package/dist/voice/handlers/createStreamGatherHandler.d.ts +0 -3
- package/dist/voice/handlers/createStreamGatherHandler.js +0 -74
- package/dist/voice/handlers/createStreamHandler.d.ts +0 -3
- package/dist/voice/handlers/createStreamHandler.js +0 -70
- package/dist/voice/handlers/createUnmuteHandler.d.ts +0 -4
- package/dist/voice/handlers/createUnmuteHandler.js +0 -27
- package/dist/voice/handlers/dial/createDialHandler.d.ts +0 -23
- package/dist/voice/handlers/dial/createDialHandler.js +0 -78
- package/dist/voice/handlers/dial/handleChannelLeftBridge.d.ts +0 -24
- package/dist/voice/handlers/dial/handleChannelLeftBridge.js +0 -29
- package/dist/voice/handlers/dial/handleStasisEnd.d.ts +0 -21
- package/dist/voice/handlers/dial/handleStasisEnd.js +0 -19
- package/dist/voice/handlers/dial/handleStasisStart.d.ts +0 -27
- package/dist/voice/handlers/dial/handleStasisStart.js +0 -52
- package/dist/voice/handlers/dial/recordChannel.d.ts +0 -22
- package/dist/voice/handlers/gather/createGatherHandler.d.ts +0 -3
- package/dist/voice/handlers/gather/createGatherHandler.js +0 -86
- package/dist/voice/handlers/gather/getTimeoutPromise.d.ts +0 -26
- package/dist/voice/handlers/gather/getTimeoutPromise.js +0 -18
- package/dist/voice/handlers/index.d.ts +0 -33
- package/dist/voice/handlers/index.js +0 -49
- package/dist/voice/handlers/utils/awaitForPlaybackFinished.d.ts +0 -21
- package/dist/voice/handlers/utils/awaitForPlaybackFinished.js +0 -25
- package/dist/voice/handlers/utils/awaitForRecordingFinished.d.ts +0 -5
- package/dist/voice/handlers/utils/awaitForRecordingFinished.js +0 -53
- package/dist/voice/handlers/utils/isDtmf.d.ts +0 -20
- package/dist/voice/handlers/utils/textChunksByClause.d.ts +0 -2
- package/dist/voice/handlers/utils/textChunksByClause.js +0 -41
- package/dist/voice/handlers/utils/textChunksByFirstNaturalPause.d.ts +0 -2
- package/dist/voice/handlers/utils/textChunksByFirstNaturalPause.js +0 -34
- package/dist/voice/handlers/utils/withErrorHandling.d.ts +0 -22
- package/dist/voice/handlers/utils/withErrorHandling.js +0 -38
- package/dist/voice/integrations/ApplicationNotFoundError.d.ts +0 -22
- package/dist/voice/integrations/ApplicationNotFoundError.js +0 -28
- package/dist/voice/integrations/createCreateContainer.d.ts +0 -4
- package/dist/voice/integrations/createCreateContainer.js +0 -76
- package/dist/voice/integrations/getSttConfig.js +0 -30
- package/dist/voice/integrations/index.js +0 -35
- package/dist/voice/integrations/types.d.ts +0 -29
- package/dist/voice/stt/AbstractSpeechToText.d.ts +0 -33
- package/dist/voice/stt/AbstractSpeechToText.js +0 -19
- package/dist/voice/stt/SpeechToTextFactory.d.ts +0 -9
- package/dist/voice/stt/SpeechToTextFactory.js +0 -43
- package/dist/voice/transcribeOnConnection.d.ts +0 -35
- package/dist/voice/transcribeOnConnection.js +0 -91
- package/dist/voice/tts/AbstractTextToSpeech.d.ts +0 -40
- package/dist/voice/tts/AbstractTextToSpeech.js +0 -50
- package/dist/voice/tts/TextToSpeechFactory.d.ts +0 -8
- package/dist/voice/tts/TextToSpeechFactory.js +0 -47
- package/dist/voice/tts/types.d.ts +0 -48
- package/dist/voice/tts/types.js +0 -2
- package/dist/voice/tts/utils/convertUlawToPCM16.js +0 -40
- package/dist/voice/tts/utils/createChunkedSynthesisStream.d.ts +0 -28
- package/dist/voice/tts/utils/createChunkedSynthesisStream.js +0 -78
- package/dist/voice/tts/utils/createErrorStream.d.ts +0 -21
- package/dist/voice/tts/utils/createErrorStream.js +0 -28
- package/dist/voice/tts/utils/index.d.ts +0 -23
- package/dist/voice/tts/utils/index.js +0 -39
- package/dist/voice/tts/utils/isSsml.d.ts +0 -20
- package/dist/voice/tts/utils/isSsml.js +0 -25
- package/dist/voice/tts/utils/streamToBuffer.d.ts +0 -20
- package/dist/voice/tts/utils/streamToBuffer.js +0 -60
- package/dist/voice/types/ari.d.ts +0 -43
- package/dist/voice/types/ari.js +0 -48
- package/dist/voice/types/index.d.ts +0 -20
- package/dist/voice/types/index.js +0 -36
- package/dist/voice/types/voice.d.ts +0 -67
- package/dist/voice/types/voice.js +0 -2
- package/dist/voice/utils/VoiceServiceClientConstructor.d.ts +0 -3
- package/dist/voice/utils/createExternalMediaConfig.d.ts +0 -12
- package/dist/voice/utils/createExternalMediaConfig.js +0 -37
- package/dist/voice/utils/createGetChannelVar.d.ts +0 -22
- package/dist/voice/utils/createGetChannelVar.js +0 -27
- package/dist/voice/utils/createGetChannelVarWithoutThrow.d.ts +0 -22
- package/dist/voice/utils/createGetChannelVarWithoutThrow.js +0 -26
- package/dist/voice/utils/index.d.ts +0 -22
- package/dist/voice/utils/index.js +0 -38
- /package/dist/{events → records}/types.js +0 -0
- /package/dist/{voice/integrations → usage}/types.js +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTelemetryInterceptor = createTelemetryInterceptor;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const common_1 = require("@fonoster/common");
|
|
23
|
+
const grpc_js_1 = require("@grpc/grpc-js");
|
|
24
|
+
/**
|
|
25
|
+
* Every gRPC request as a span (`apiserver.grpc`, with rpc.method and rpc.grpc.status_code) and a
|
|
26
|
+
* count (`fonoster.apiserver.grpc.requests` by method and code), add-platform 2.5. A `traceparent`
|
|
27
|
+
* metadata entry from the caller joins its trace. Free when telemetry is disabled.
|
|
28
|
+
*/
|
|
29
|
+
function createTelemetryInterceptor(telemetry) {
|
|
30
|
+
return (methodDefinition, call) => {
|
|
31
|
+
if (!telemetry.enabled)
|
|
32
|
+
return call;
|
|
33
|
+
const method = methodDefinition.path;
|
|
34
|
+
let span;
|
|
35
|
+
return new grpc_js_1.ServerInterceptingCall(call, {
|
|
36
|
+
start: (next) => {
|
|
37
|
+
next({
|
|
38
|
+
onReceiveMetadata: (metadata, mdNext) => {
|
|
39
|
+
const parent = metadata.get(common_1.TRACEPARENT_HEADER)[0];
|
|
40
|
+
span = telemetry.startSpan("apiserver.grpc", { "rpc.system": "grpc", "rpc.method": method }, typeof parent === "string" ? parent : undefined);
|
|
41
|
+
mdNext(metadata);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
sendStatus: (s, next) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const code = (_a = grpc_js_1.status[s.code]) !== null && _a !== void 0 ? _a : String(s.code);
|
|
48
|
+
telemetry.count("fonoster.apiserver.grpc.requests", 1, {
|
|
49
|
+
"rpc.method": method,
|
|
50
|
+
"rpc.grpc.status_code": code
|
|
51
|
+
});
|
|
52
|
+
span === null || span === void 0 ? void 0 : span.end({ "rpc.grpc.status_code": s.code }, s.code === grpc_js_1.status.OK ? undefined : code);
|
|
53
|
+
next(s);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.testTokenConfig = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
4
5
|
const envs_1 = require("../envs");
|
|
6
|
+
// Browser test calls reach the Roomr nodes' Peer; the browser names the agent with X-App-Ref
|
|
7
|
+
// (add-talk-in-browser D1).
|
|
5
8
|
const testTokenConfig = {
|
|
6
9
|
username: "internal",
|
|
7
10
|
domain: "internal",
|
|
8
11
|
displayName: "Test Call Agent",
|
|
9
|
-
targetAor:
|
|
12
|
+
targetAor: (0, config_1.getConfig)().routr.roomrPeer.aor,
|
|
10
13
|
signalingServer: envs_1.APISERVER_SIGNALING_SERVER
|
|
11
14
|
};
|
|
12
15
|
exports.testTokenConfig = testTokenConfig;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The peer Go Roomr nodes register under: least-sessions over `X-Session-Count`, any number of
|
|
3
|
+
* nodes (add-roomr 4.1). Created only when `routr.roomrPeer.password` is set.
|
|
4
|
+
*/
|
|
5
|
+
declare function upsertRoomrPeer(attempt?: number, delayMs?: number): Promise<void>;
|
|
6
|
+
export { upsertRoomrPeer };
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.upsertRoomrPeer = upsertRoomrPeer;
|
|
16
16
|
/**
|
|
17
17
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
18
18
|
* http://github.com/fonoster/fonoster
|
|
@@ -37,49 +37,50 @@ const sdk_1 = __importDefault(require("@routr/sdk"));
|
|
|
37
37
|
const envs_1 = require("../envs");
|
|
38
38
|
const routrConfig_1 = require("./routrConfig");
|
|
39
39
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
const RETRY_DELAY_MS = 5000;
|
|
41
|
+
const MAX_ATTEMPTS = 60;
|
|
42
|
+
/**
|
|
43
|
+
* The peer Go Roomr nodes register under: least-sessions over `X-Session-Count`, any number of
|
|
44
|
+
* nodes (add-roomr 4.1). Created only when `routr.roomrPeer.password` is set.
|
|
45
|
+
*/
|
|
46
|
+
function upsertRoomrPeer() {
|
|
47
|
+
return __awaiter(this, arguments, void 0, function* (attempt = 1, delayMs = RETRY_DELAY_MS) {
|
|
48
|
+
const { aor, name, username, password } = envs_1.ROUTR_ROOMR_PEER;
|
|
49
|
+
if (!password)
|
|
50
|
+
return;
|
|
51
51
|
const peers = new sdk_1.default.Peers(routrConfig_1.routrConfig);
|
|
52
|
-
|
|
52
|
+
const credentials = new sdk_1.default.Credentials(routrConfig_1.routrConfig);
|
|
53
53
|
try {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
// Peer first: if it already exists, nothing else is created (no duplicate credentials).
|
|
55
|
+
const peer = yield peers.createPeer({
|
|
56
|
+
name,
|
|
57
|
+
username,
|
|
58
|
+
aor,
|
|
59
|
+
balancingAlgorithm: common_1.CommonTypes.LoadBalancingAlgorithm.LEAST_SESSIONS,
|
|
59
60
|
withSessionAffinity: false,
|
|
60
61
|
maxContacts: -1,
|
|
61
62
|
enabled: true
|
|
62
|
-
};
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
credentialsRef: creds.ref
|
|
63
|
+
});
|
|
64
|
+
const creds = yield credentials.createCredentials({
|
|
65
|
+
name: `${name} credentials`,
|
|
66
|
+
username,
|
|
67
|
+
password
|
|
68
68
|
});
|
|
69
69
|
peer.credentialsRef = creds.ref;
|
|
70
70
|
yield peers.updatePeer(peer);
|
|
71
|
-
logger.info("
|
|
72
|
-
peerRef: peer.ref,
|
|
73
|
-
credentialsRef: creds.ref
|
|
74
|
-
});
|
|
71
|
+
logger.info("roomr peer created", { peerRef: peer.ref, aor });
|
|
75
72
|
}
|
|
76
73
|
catch (err) {
|
|
77
74
|
const error = err;
|
|
78
75
|
if (error.message.includes("already exist")) {
|
|
79
|
-
logger.info("
|
|
76
|
+
logger.info("roomr peer already exists");
|
|
80
77
|
return;
|
|
81
78
|
}
|
|
82
|
-
|
|
79
|
+
if (error.message.includes("Cannot connect") && attempt < MAX_ATTEMPTS) {
|
|
80
|
+
yield new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
81
|
+
return upsertRoomrPeer(attempt + 1, delayMs);
|
|
82
|
+
}
|
|
83
|
+
logger.error(`error creating the roomr peer: ${error.message}`, {
|
|
83
84
|
code: error.code
|
|
84
85
|
});
|
|
85
86
|
}
|
package/dist/envs.d.ts
CHANGED
|
@@ -2,22 +2,31 @@ export declare const APISERVER_BIND_ADDR: string;
|
|
|
2
2
|
export declare const APISERVER_HOST: string;
|
|
3
3
|
export declare const APISERVER_SIGNALING_SERVER: string;
|
|
4
4
|
export declare const APP_URL: string;
|
|
5
|
-
export declare const ASTERISK_ARI_PROXY_URL: string;
|
|
6
|
-
export declare const ASTERISK_ARI_SECRET: string;
|
|
7
|
-
export declare const ASTERISK_ARI_USERNAME: string;
|
|
8
|
-
export declare const ASTERISK_SYSTEM_DOMAIN: string;
|
|
9
|
-
export declare const ASTERISK_TRUNK = "routr";
|
|
10
5
|
export declare const CALLS_CREATE_SUBJECT = "calls.create";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The control plane's own status of a call it places (TRYING, the node that took it, FAILED),
|
|
8
|
+
* keyed by the call, so TrackCall on any replica sees it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const callEventsSubject: (ref: string) => string;
|
|
11
|
+
/** Every call's control-plane status (TrackCall's subscription). */
|
|
12
|
+
export declare const CALL_EVENTS_WILDCARD = "calls.*.events";
|
|
13
|
+
/**
|
|
14
|
+
* A call's events from its Roomr node (media-control "Events on NATS are keyed by call"):
|
|
15
|
+
* call.started, call.ringing, call.answered, call.ended and the call's participant and operation
|
|
16
|
+
* events, each with node_ref, seq and metadata.
|
|
17
|
+
*/
|
|
18
|
+
export declare const mediaCallEventsSubject: (ref: string) => string;
|
|
19
|
+
/** Every call's media events (TrackCall's subscription; room events are roomr.events.room.*). */
|
|
20
|
+
export declare const MEDIA_CALL_EVENTS_WILDCARD = "roomr.events.*";
|
|
21
|
+
/** Every Roomr node's heartbeat and node.down (TrackCall ends the calls of a lost node). */
|
|
22
|
+
export declare const NODE_HEARTBEAT_WILDCARD = "roomr.nodes.*.heartbeat";
|
|
15
23
|
export declare const CLOAK_ENCRYPTION_KEY: string;
|
|
24
|
+
export declare const DATABASE_URL: string;
|
|
16
25
|
export declare const DEFAULT_NATS_QUEUE_GROUP = "apiserver";
|
|
17
26
|
export declare const HTTP_BRIDGE_PORT: number;
|
|
18
|
-
export declare const IDENTITY_ACCESS_TOKEN_EXPIRES_IN: string;
|
|
27
|
+
export declare const IDENTITY_ACCESS_TOKEN_EXPIRES_IN: string | number;
|
|
19
28
|
export declare const IDENTITY_AUDIENCE: string;
|
|
20
|
-
export declare const IDENTITY_ID_TOKEN_EXPIRES_IN: string;
|
|
29
|
+
export declare const IDENTITY_ID_TOKEN_EXPIRES_IN: string | number;
|
|
21
30
|
export declare const IDENTITY_ISSUER: string;
|
|
22
31
|
export declare const IDENTITY_CONTACT_VERIFICATION_REQUIRED: boolean;
|
|
23
32
|
export declare const IDENTITY_TWO_FACTOR_AUTHENTICATION_REQUIRED: boolean;
|
|
@@ -26,30 +35,48 @@ export declare const IDENTITY_OAUTH2_GITHUB_CLIENT_ID: string;
|
|
|
26
35
|
export declare const IDENTITY_OAUTH2_GITHUB_CLIENT_SECRET: string;
|
|
27
36
|
export declare const IDENTITY_PRIVATE_KEY: string;
|
|
28
37
|
export declare const IDENTITY_PUBLIC_KEY: string;
|
|
29
|
-
export declare const IDENTITY_REFRESH_TOKEN_EXPIRES_IN: string;
|
|
38
|
+
export declare const IDENTITY_REFRESH_TOKEN_EXPIRES_IN: string | number;
|
|
30
39
|
export declare const IDENTITY_WORKSPACE_INVITE_FAIL_URL: string;
|
|
31
40
|
export declare const IDENTITY_WORKSPACE_INVITE_EXPIRATION: string;
|
|
32
41
|
export declare const IDENTITY_WORKSPACE_INVITE_URL: string;
|
|
33
42
|
export declare const IDENTITY_DATABASE_URL: string;
|
|
43
|
+
/** Billing is on (Cloud): stored usage is published for the billing service (add-billing-service D2). */
|
|
44
|
+
export declare const BILLING_ENABLED: boolean;
|
|
45
|
+
/** Where the Billing API is served (the billing service). */
|
|
46
|
+
export declare const BILLING_ADDRESS: string;
|
|
34
47
|
export declare const AUTHZ_SERVICE_ENABLED: boolean;
|
|
35
48
|
export declare const AUTHZ_SERVICE_HOST: string;
|
|
36
|
-
export declare const AUTHZ_SERVICE_PORT:
|
|
49
|
+
export declare const AUTHZ_SERVICE_PORT: number;
|
|
37
50
|
export declare const AUTHZ_SERVICE_METHODS: string[];
|
|
38
|
-
export declare const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export declare const INFLUXDB_URL: string;
|
|
42
|
-
export declare const INFLUXDB_USERNAME: string;
|
|
43
|
-
export declare const INTEGRATIONS_FILE: string;
|
|
51
|
+
export declare const EVALUATIONS: {
|
|
52
|
+
credentials?: Record<string, string>;
|
|
53
|
+
};
|
|
44
54
|
export declare const NATS_URL: string;
|
|
55
|
+
/** The `nats` setting itself (URL, user, password), for helpers that take a NatsTarget. */
|
|
56
|
+
export declare const NATS_CONNECTION: {
|
|
57
|
+
url?: string;
|
|
58
|
+
password?: string;
|
|
59
|
+
user?: string;
|
|
60
|
+
};
|
|
61
|
+
/** nats.js connect options: the URL plus the apiserver's NATS user, when set (add-platform 4.1). */
|
|
62
|
+
export declare const NATS: {
|
|
63
|
+
servers: string;
|
|
64
|
+
user?: string;
|
|
65
|
+
pass?: string;
|
|
66
|
+
inboxPrefix?: string;
|
|
67
|
+
};
|
|
45
68
|
export declare const OWNER_EMAIL: string;
|
|
46
69
|
export declare const OWNER_NAME: string;
|
|
47
70
|
export declare const OWNER_PASSWORD: string;
|
|
48
71
|
export declare const ROUTR_API_ENDPOINT: string;
|
|
49
|
-
export declare const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
72
|
+
export declare const ROUTR_ROOMR_PEER: {
|
|
73
|
+
name?: string;
|
|
74
|
+
aor?: string;
|
|
75
|
+
username?: string;
|
|
76
|
+
password?: string;
|
|
77
|
+
};
|
|
78
|
+
/** Routr's SIP address: API-originated calls are dialed through it (Roomr CreateCall). */
|
|
79
|
+
export declare const ROUTR_SIP_PROXY: string;
|
|
53
80
|
export declare const SMTP_AUTH_PASS: string;
|
|
54
81
|
export declare const SMTP_AUTH_USER: string;
|
|
55
82
|
export declare const SMTP_HOST: string;
|
|
@@ -60,3 +87,89 @@ export declare const TEMPLATES_DIR: string;
|
|
|
60
87
|
export declare const TWILIO_ACCOUNT_SID: string;
|
|
61
88
|
export declare const TWILIO_AUTH_TOKEN: string;
|
|
62
89
|
export declare const TWILIO_PHONE_NUMBER: string;
|
|
90
|
+
export declare const CALL_RECORDS: {
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
stores?: ({
|
|
93
|
+
dir?: string;
|
|
94
|
+
} | {
|
|
95
|
+
s3?: {
|
|
96
|
+
bucket?: string;
|
|
97
|
+
prefix?: string;
|
|
98
|
+
region?: string;
|
|
99
|
+
endpoint?: string;
|
|
100
|
+
forcePathStyle?: boolean;
|
|
101
|
+
credentials?: {
|
|
102
|
+
accessKeyId?: string;
|
|
103
|
+
secretAccessKey?: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
})[];
|
|
107
|
+
retentionIntervalMinutes?: number;
|
|
108
|
+
maintenanceTimeoutMs?: number;
|
|
109
|
+
};
|
|
110
|
+
export declare const SESSION_APPS: {
|
|
111
|
+
autopilotUrl?: string;
|
|
112
|
+
autopilotSigningSecret?: string;
|
|
113
|
+
allowInsecureWebhooks?: boolean;
|
|
114
|
+
allowedDestinations?: string[];
|
|
115
|
+
};
|
|
116
|
+
export declare const WEBHOOKS: {
|
|
117
|
+
fanout?: boolean;
|
|
118
|
+
intervalMs?: number;
|
|
119
|
+
refreshMs?: number;
|
|
120
|
+
};
|
|
121
|
+
export declare const REGIONS: {
|
|
122
|
+
public?: {
|
|
123
|
+
id?: string;
|
|
124
|
+
name?: string;
|
|
125
|
+
default?: boolean;
|
|
126
|
+
endpoints?: {
|
|
127
|
+
sip?: {
|
|
128
|
+
host?: string;
|
|
129
|
+
port?: number;
|
|
130
|
+
transport?: "udp" | "tcp" | "tls" | "ws" | "wss";
|
|
131
|
+
}[];
|
|
132
|
+
signalingAddresses?: string[];
|
|
133
|
+
mediaAddresses?: string[];
|
|
134
|
+
rtpPorts?: {
|
|
135
|
+
min?: number;
|
|
136
|
+
max?: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
}[];
|
|
140
|
+
operatorKey?: string;
|
|
141
|
+
privateRegionMonthlyFeeCents?: number;
|
|
142
|
+
controlPlaneUrl?: string;
|
|
143
|
+
leafUrl?: string;
|
|
144
|
+
allowInsecureLeaf?: boolean;
|
|
145
|
+
signingKey?: {
|
|
146
|
+
file?: string;
|
|
147
|
+
kid?: string;
|
|
148
|
+
};
|
|
149
|
+
hub?: {
|
|
150
|
+
url?: string;
|
|
151
|
+
credentialsFile?: string;
|
|
152
|
+
systemCredentialsFile?: string;
|
|
153
|
+
operatorSeedFile?: string;
|
|
154
|
+
accountSeedFile?: string;
|
|
155
|
+
};
|
|
156
|
+
relay?: {
|
|
157
|
+
firstChunkTimeoutMs?: number;
|
|
158
|
+
idleTimeoutMs?: number;
|
|
159
|
+
maxBytes?: number;
|
|
160
|
+
maxConcurrent?: number;
|
|
161
|
+
};
|
|
162
|
+
currentVersion?: string;
|
|
163
|
+
configDebounceMs?: number;
|
|
164
|
+
};
|
|
165
|
+
export declare const DOMAIN: string;
|
|
166
|
+
/**
|
|
167
|
+
* The install's SIP roots, split as Twilio does: carriers reach trunks at
|
|
168
|
+
* `<label>.pstn.<domain>`, phones register on domains at `<label>.sip.<domain>`.
|
|
169
|
+
*/
|
|
170
|
+
export declare const PSTN_ROOT: string;
|
|
171
|
+
export declare const SIP_ROOT: string;
|
|
172
|
+
/** Where trunk inbound URIs must live, or undefined when features.sip.names is "any". */
|
|
173
|
+
export declare const TRUNK_NAMES_ROOT: string;
|
|
174
|
+
/** Where domains must live, or undefined when features.sip.names is "any". */
|
|
175
|
+
export declare const DOMAIN_NAMES_ROOT: string;
|