@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
package/dist/calls/getCall.d.ts
CHANGED
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { GrpcErrorMessage
|
|
20
|
-
|
|
19
|
+
import { GrpcErrorMessage } from "@fonoster/common";
|
|
20
|
+
import { CallDetailRecord } from "@fonoster/types";
|
|
21
|
+
/** One call from the call-record index (`fetchSingleCall` is createFetchSingleCallFromIndex). */
|
|
22
|
+
declare function getCall(fetchSingleCall: (accessKeyId: string, ref: string) => Promise<CallDetailRecord | null | undefined>): (call: {
|
|
21
23
|
request: unknown;
|
|
22
24
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
23
25
|
export { getCall };
|
package/dist/calls/getCall.js
CHANGED
|
@@ -31,10 +31,9 @@ exports.getCall = getCall;
|
|
|
31
31
|
const common_1 = require("@fonoster/common");
|
|
32
32
|
const logger_1 = require("@fonoster/logger");
|
|
33
33
|
const notFoundError_1 = require("../core/notFoundError");
|
|
34
|
-
const createFetchSingleCall_1 = require("./createFetchSingleCall");
|
|
35
34
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
/** One call from the call-record index (`fetchSingleCall` is createFetchSingleCallFromIndex). */
|
|
36
|
+
function getCall(fetchSingleCall) {
|
|
38
37
|
const fn = (call, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
39
38
|
const { ref } = call.request;
|
|
40
39
|
const accessKeyId = (0, common_1.getAccessKeyIdFromCall)(call);
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { GrpcErrorMessage
|
|
20
|
-
|
|
19
|
+
import { GrpcErrorMessage } from "@fonoster/common";
|
|
20
|
+
import { ListCallsRequest, ListCallsResponse } from "@fonoster/types";
|
|
21
|
+
/** Call history from the call-record index (`fetchCalls` is createFetchCallsFromIndex). */
|
|
22
|
+
declare function listCalls(fetchCalls: (accessKeyId: string, request: ListCallsRequest) => Promise<ListCallsResponse>): (call: {
|
|
21
23
|
request: unknown;
|
|
22
24
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
23
25
|
export { listCalls };
|
package/dist/calls/listCalls.js
CHANGED
|
@@ -30,10 +30,9 @@ exports.listCalls = listCalls;
|
|
|
30
30
|
*/
|
|
31
31
|
const common_1 = require("@fonoster/common");
|
|
32
32
|
const logger_1 = require("@fonoster/logger");
|
|
33
|
-
const createFetchCalls_1 = require("./createFetchCalls");
|
|
34
33
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
/** Call history from the call-record index (`fetchCalls` is createFetchCallsFromIndex). */
|
|
35
|
+
function listCalls(fetchCalls) {
|
|
37
36
|
const fn = (call, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
38
37
|
const { request } = call;
|
|
39
38
|
const accessKeyId = (0, common_1.getAccessKeyIdFromCall)(call);
|
package/dist/calls/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ type ListCallsRequest = {
|
|
|
25
25
|
status?: CallStatus;
|
|
26
26
|
from?: string;
|
|
27
27
|
to?: string;
|
|
28
|
+
appRef?: string;
|
|
28
29
|
pageSize?: number;
|
|
29
30
|
pageToken?: string;
|
|
30
31
|
};
|
|
@@ -36,11 +37,17 @@ type GetCallRequest = {
|
|
|
36
37
|
ref: string;
|
|
37
38
|
};
|
|
38
39
|
type CallPublisher = {
|
|
40
|
+
/** Resolves once a Roomr node has accepted the call; rejects with a CallPlacementError. */
|
|
39
41
|
publishCall: (event: CreateCallRequest & {
|
|
40
42
|
ref: string;
|
|
41
43
|
accessKeyId: string;
|
|
42
|
-
}) => void;
|
|
44
|
+
}) => Promise<void> | void;
|
|
43
45
|
};
|
|
46
|
+
/** Why CreateCall could not place a call: `no_capacity`, `unavailable` or a node's code. */
|
|
47
|
+
declare class CallPlacementError extends Error {
|
|
48
|
+
readonly code: string;
|
|
49
|
+
constructor(code: string, message: string);
|
|
50
|
+
}
|
|
44
51
|
type TrackCallResponse = {
|
|
45
52
|
ref: string;
|
|
46
53
|
status: DialStatus;
|
|
@@ -48,10 +55,12 @@ type TrackCallResponse = {
|
|
|
48
55
|
type CallStream = {
|
|
49
56
|
write: (data: TrackCallResponse | GrpcErrorMessage) => void;
|
|
50
57
|
end: () => void;
|
|
58
|
+
/** The gRPC stream's events ("cancelled" when the client goes away). */
|
|
59
|
+
on?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
51
60
|
};
|
|
52
61
|
type TrackCallSubscriber = {
|
|
53
62
|
events: {
|
|
54
63
|
on: (event: string, cb: (data: TrackCallResponse | Error) => void) => void;
|
|
55
64
|
};
|
|
56
65
|
};
|
|
57
|
-
export { CallPublisher, CallStream, CreateCallRequest, GetCallRequest, ListCallsRequest, ListCallsResponse, TrackCallResponse, TrackCallSubscriber };
|
|
66
|
+
export { CallPlacementError, CallPublisher, CallStream, CreateCallRequest, GetCallRequest, ListCallsRequest, ListCallsResponse, TrackCallResponse, TrackCallSubscriber };
|
package/dist/calls/types.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallPlacementError = void 0;
|
|
4
|
+
/** Why CreateCall could not place a call: `no_capacity`, `unavailable` or a node's code. */
|
|
5
|
+
class CallPlacementError extends Error {
|
|
6
|
+
constructor(code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.name = "CallPlacementError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CallPlacementError = CallPlacementError;
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
20
|
-
declare function
|
|
19
|
+
import { FonosterConfig } from "../config";
|
|
20
|
+
declare function buildService(config: FonosterConfig): {
|
|
21
21
|
definition: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
serviceName: string;
|
|
23
|
+
pckg: string;
|
|
24
|
+
version: string;
|
|
25
|
+
proto: string;
|
|
26
26
|
};
|
|
27
27
|
handlers: {
|
|
28
|
-
|
|
28
|
+
getCapabilities: (_call: unknown, callback: (error: null, response: import("./createGetCapabilities").GetCapabilitiesResponse) => void) => Promise<void>;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export {
|
|
31
|
+
export { buildService };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildService = buildService;
|
|
4
|
+
const createGetCapabilities_1 = require("./createGetCapabilities");
|
|
5
|
+
function buildService(config) {
|
|
6
|
+
return {
|
|
7
|
+
definition: {
|
|
8
|
+
serviceName: "Capabilities",
|
|
9
|
+
pckg: "capabilities",
|
|
10
|
+
version: "v1beta2",
|
|
11
|
+
proto: "capabilities.proto"
|
|
12
|
+
},
|
|
13
|
+
handlers: {
|
|
14
|
+
getCapabilities: (0, createGetCapabilities_1.createGetCapabilities)(config)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { FonosterConfig } from "../config";
|
|
20
|
+
type GetCapabilitiesResponse = {
|
|
21
|
+
auth: {
|
|
22
|
+
methods: string[];
|
|
23
|
+
signup: string;
|
|
24
|
+
github?: {
|
|
25
|
+
clientId: string;
|
|
26
|
+
authorizeUrl: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
billing: {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
};
|
|
32
|
+
costs: {
|
|
33
|
+
display: string;
|
|
34
|
+
};
|
|
35
|
+
domain: string;
|
|
36
|
+
appUrl: string;
|
|
37
|
+
regions: {
|
|
38
|
+
private: boolean;
|
|
39
|
+
};
|
|
40
|
+
connection: ConnectionCapabilities;
|
|
41
|
+
sip: {
|
|
42
|
+
names: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
type ConnectionCapabilities = {
|
|
46
|
+
sip: {
|
|
47
|
+
host: string;
|
|
48
|
+
port: number;
|
|
49
|
+
transport: string;
|
|
50
|
+
}[];
|
|
51
|
+
signalingAddresses: string[];
|
|
52
|
+
mediaAddresses: string[];
|
|
53
|
+
rtpPorts?: {
|
|
54
|
+
min: number;
|
|
55
|
+
max: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Private regions are an optional integration: enrollment needs both the
|
|
60
|
+
* region-signing key and the region hub (regions.signingKey + regions.hub,
|
|
61
|
+
* the same pair runRegions checks). Only the boolean is exposed, never the
|
|
62
|
+
* hub URL, credentials or key.
|
|
63
|
+
*/
|
|
64
|
+
declare function supportsPrivateRegions(config: FonosterConfig): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Where carriers and softphones reach this deployment: the default public
|
|
67
|
+
* region's endpoints (regions.public), the same ones the regions API reported.
|
|
68
|
+
* Always served, so the trunk and SIP agent hints work without private regions.
|
|
69
|
+
* Addresses and ports only.
|
|
70
|
+
*/
|
|
71
|
+
declare function connectionDetails(config: FonosterConfig): ConnectionCapabilities;
|
|
72
|
+
/**
|
|
73
|
+
* What this deployment supports, from fonoster.yaml, for clients that render
|
|
74
|
+
* sign-in and product features from it. Public, so it must never include a
|
|
75
|
+
* secret: only the GitHub client id is exposed, never the client secret.
|
|
76
|
+
*/
|
|
77
|
+
declare function createGetCapabilities(config: FonosterConfig): (_call: unknown, callback: (error: null, response: GetCapabilitiesResponse) => void) => Promise<void>;
|
|
78
|
+
export { connectionDetails, createGetCapabilities, GetCapabilitiesResponse, supportsPrivateRegions };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.connectionDetails = connectionDetails;
|
|
13
|
+
exports.createGetCapabilities = createGetCapabilities;
|
|
14
|
+
exports.supportsPrivateRegions = supportsPrivateRegions;
|
|
15
|
+
/**
|
|
16
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
17
|
+
* http://github.com/fonoster/fonoster
|
|
18
|
+
*
|
|
19
|
+
* This file is part of Fonoster
|
|
20
|
+
*
|
|
21
|
+
* Licensed under the MIT License (the "License");
|
|
22
|
+
* you may not use this file except in compliance with
|
|
23
|
+
* the License. You may obtain a copy of the License at
|
|
24
|
+
*
|
|
25
|
+
* https://opensource.org/licenses/MIT
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
+
* See the License for the specific language governing permissions and
|
|
31
|
+
* limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
const config_1 = require("../config");
|
|
34
|
+
/**
|
|
35
|
+
* Private regions are an optional integration: enrollment needs both the
|
|
36
|
+
* region-signing key and the region hub (regions.signingKey + regions.hub,
|
|
37
|
+
* the same pair runRegions checks). Only the boolean is exposed, never the
|
|
38
|
+
* hub URL, credentials or key.
|
|
39
|
+
*/
|
|
40
|
+
function supportsPrivateRegions(config) {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
return Boolean(((_a = config.regions) === null || _a === void 0 ? void 0 : _a.signingKey) && ((_b = config.regions) === null || _b === void 0 ? void 0 : _b.hub));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Where carriers and softphones reach this deployment: the default public
|
|
46
|
+
* region's endpoints (regions.public), the same ones the regions API reported.
|
|
47
|
+
* Always served, so the trunk and SIP agent hints work without private regions.
|
|
48
|
+
* Addresses and ports only.
|
|
49
|
+
*/
|
|
50
|
+
function connectionDetails(config) {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f;
|
|
52
|
+
const publicRegions = (_b = (_a = config.regions) === null || _a === void 0 ? void 0 : _a.public) !== null && _b !== void 0 ? _b : [];
|
|
53
|
+
const region = (_c = publicRegions.find((r) => r.default)) !== null && _c !== void 0 ? _c : publicRegions[0];
|
|
54
|
+
const e = region === null || region === void 0 ? void 0 : region.endpoints;
|
|
55
|
+
return {
|
|
56
|
+
sip: ((_d = e === null || e === void 0 ? void 0 : e.sip) !== null && _d !== void 0 ? _d : []).map(({ host, port, transport }) => ({
|
|
57
|
+
host,
|
|
58
|
+
port,
|
|
59
|
+
transport
|
|
60
|
+
})),
|
|
61
|
+
signalingAddresses: [...((_e = e === null || e === void 0 ? void 0 : e.signalingAddresses) !== null && _e !== void 0 ? _e : [])],
|
|
62
|
+
mediaAddresses: [...((_f = e === null || e === void 0 ? void 0 : e.mediaAddresses) !== null && _f !== void 0 ? _f : [])],
|
|
63
|
+
rtpPorts: (e === null || e === void 0 ? void 0 : e.rtpPorts)
|
|
64
|
+
? { min: e.rtpPorts.min, max: e.rtpPorts.max }
|
|
65
|
+
: undefined
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What this deployment supports, from fonoster.yaml, for clients that render
|
|
70
|
+
* sign-in and product features from it. Public, so it must never include a
|
|
71
|
+
* secret: only the GitHub client id is exposed, never the client secret.
|
|
72
|
+
*/
|
|
73
|
+
function createGetCapabilities(config) {
|
|
74
|
+
var _a;
|
|
75
|
+
const { auth, billing, costs } = config.features;
|
|
76
|
+
const githubOAuth = (_a = config.identity.oauth2) === null || _a === void 0 ? void 0 : _a.github;
|
|
77
|
+
const github = auth.methods.includes("github") && githubOAuth
|
|
78
|
+
? {
|
|
79
|
+
clientId: githubOAuth.clientId,
|
|
80
|
+
authorizeUrl: `${githubOAuth.url}/login/oauth/authorize`
|
|
81
|
+
}
|
|
82
|
+
: undefined;
|
|
83
|
+
const response = {
|
|
84
|
+
auth: {
|
|
85
|
+
methods: [...auth.methods],
|
|
86
|
+
signup: auth.signup,
|
|
87
|
+
github
|
|
88
|
+
},
|
|
89
|
+
billing: { enabled: billing.enabled },
|
|
90
|
+
costs: { display: costs.display },
|
|
91
|
+
domain: config.domain,
|
|
92
|
+
appUrl: (0, config_1.getAppUrl)(config),
|
|
93
|
+
regions: { private: supportsPrivateRegions(config) },
|
|
94
|
+
connection: connectionDetails(config),
|
|
95
|
+
sip: { names: config.features.sip.names }
|
|
96
|
+
};
|
|
97
|
+
return (_call, callback) => __awaiter(this, void 0, void 0, function* () { return callback(null, response); });
|
|
98
|
+
}
|
|
@@ -16,6 +16,5 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./isDtmf";
|
|
19
|
+
export { buildService as buildCapabilitiesService } from "./buildService";
|
|
20
|
+
export * from "./createGetCapabilities";
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.buildCapabilitiesService = void 0;
|
|
17
18
|
/**
|
|
18
19
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
19
20
|
* http://github.com/fonoster/fonoster
|
|
@@ -32,6 +33,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
33
|
* See the License for the specific language governing permissions and
|
|
33
34
|
* limitations under the License.
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
__exportStar(require("./
|
|
36
|
+
var buildService_1 = require("./buildService");
|
|
37
|
+
Object.defineProperty(exports, "buildCapabilitiesService", { enumerable: true, get: function () { return buildService_1.buildService; } });
|
|
38
|
+
__exportStar(require("./createGetCapabilities"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IdentityConfig } from "@fonoster/identity";
|
|
2
|
+
import { FonosterConfig } from "./schema";
|
|
3
|
+
/**
|
|
4
|
+
* The API server's configuration, read once from fonoster.yaml (or .jsonc).
|
|
5
|
+
* The file is found via --config, /opt/fonoster or ./config.
|
|
6
|
+
*/
|
|
7
|
+
declare function getConfig(): FonosterConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Replaces the configuration for tests. Validated like a file, so defaults
|
|
10
|
+
* apply. Must run before anything imports envs.ts.
|
|
11
|
+
*/
|
|
12
|
+
declare function setConfigForTests(raw: unknown): void;
|
|
13
|
+
/** Base URL for links in emails. */
|
|
14
|
+
declare function getAppUrl(config?: FonosterConfig): string;
|
|
15
|
+
/**
|
|
16
|
+
* SIP over WebSocket for browser test calls (add-talk-in-browser D2): `signalingServer`, or
|
|
17
|
+
* Envoy's `/sip` route on the appUrl origin (http becomes ws, https becomes wss).
|
|
18
|
+
*/
|
|
19
|
+
declare function getSignalingServer(config?: FonosterConfig): string;
|
|
20
|
+
/** Runtime Identity configuration (reads the signing keys once). */
|
|
21
|
+
declare function getIdentityConfig(): IdentityConfig;
|
|
22
|
+
export { FonosterConfig, getAppUrl, getConfig, getIdentityConfig, getSignalingServer, setConfigForTests };
|
|
23
|
+
export * from "./schema";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getAppUrl = getAppUrl;
|
|
18
|
+
exports.getConfig = getConfig;
|
|
19
|
+
exports.getIdentityConfig = getIdentityConfig;
|
|
20
|
+
exports.getSignalingServer = getSignalingServer;
|
|
21
|
+
exports.setConfigForTests = setConfigForTests;
|
|
22
|
+
/**
|
|
23
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
24
|
+
* http://github.com/fonoster/fonoster
|
|
25
|
+
*
|
|
26
|
+
* This file is part of Fonoster
|
|
27
|
+
*
|
|
28
|
+
* Licensed under the MIT License (the "License");
|
|
29
|
+
* you may not use this file except in compliance with
|
|
30
|
+
* the License. You may obtain a copy of the License at
|
|
31
|
+
*
|
|
32
|
+
* https://opensource.org/licenses/MIT
|
|
33
|
+
*
|
|
34
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
35
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
36
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
37
|
+
* See the License for the specific language governing permissions and
|
|
38
|
+
* limitations under the License.
|
|
39
|
+
*/
|
|
40
|
+
const url_1 = require("url");
|
|
41
|
+
const common_1 = require("@fonoster/common");
|
|
42
|
+
const identity_1 = require("@fonoster/identity");
|
|
43
|
+
const schema_1 = require("./schema");
|
|
44
|
+
let loaded;
|
|
45
|
+
let identityConfig;
|
|
46
|
+
/**
|
|
47
|
+
* The API server's configuration, read once from fonoster.yaml (or .jsonc).
|
|
48
|
+
* The file is found via --config, /opt/fonoster or ./config.
|
|
49
|
+
*/
|
|
50
|
+
function getConfig() {
|
|
51
|
+
if (!loaded) {
|
|
52
|
+
loaded = (0, common_1.loadServiceConfig)({
|
|
53
|
+
service: "apiserver",
|
|
54
|
+
fileBase: "fonoster",
|
|
55
|
+
schema: schema_1.fonosterConfigSchema,
|
|
56
|
+
interpolatePaths: schema_1.SHARED_VALUE_PATHS
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return loaded;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Replaces the configuration for tests. Validated like a file, so defaults
|
|
63
|
+
* apply. Must run before anything imports envs.ts.
|
|
64
|
+
*/
|
|
65
|
+
function setConfigForTests(raw) {
|
|
66
|
+
loaded = (0, common_1.strictDeep)(schema_1.fonosterConfigSchema).parse(raw);
|
|
67
|
+
identityConfig = undefined;
|
|
68
|
+
}
|
|
69
|
+
const trimSlash = (url) => url.replace(/\/+$/, "");
|
|
70
|
+
/** Base URL for links in emails. */
|
|
71
|
+
function getAppUrl(config = getConfig()) {
|
|
72
|
+
var _a;
|
|
73
|
+
return trimSlash((_a = config.appUrl) !== null && _a !== void 0 ? _a : `https://${config.domain}`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* SIP over WebSocket for browser test calls (add-talk-in-browser D2): `signalingServer`, or
|
|
77
|
+
* Envoy's `/sip` route on the appUrl origin (http becomes ws, https becomes wss).
|
|
78
|
+
*/
|
|
79
|
+
function getSignalingServer(config = getConfig()) {
|
|
80
|
+
if (config.signalingServer)
|
|
81
|
+
return config.signalingServer;
|
|
82
|
+
const url = new url_1.URL(getAppUrl(config));
|
|
83
|
+
const scheme = url.protocol === "http:" ? "ws:" : "wss:";
|
|
84
|
+
return `${scheme}//${url.host}/sip`;
|
|
85
|
+
}
|
|
86
|
+
/** Runtime Identity configuration (reads the signing keys once). */
|
|
87
|
+
function getIdentityConfig() {
|
|
88
|
+
if (!identityConfig) {
|
|
89
|
+
const config = getConfig();
|
|
90
|
+
identityConfig = (0, identity_1.toIdentityConfig)({
|
|
91
|
+
identity: config.identity,
|
|
92
|
+
appUrl: getAppUrl(config),
|
|
93
|
+
databaseUrl: config.database.url,
|
|
94
|
+
encryptionKey: config.encryption.key,
|
|
95
|
+
smtp: config.smtp,
|
|
96
|
+
twilio: config.twilio,
|
|
97
|
+
auth: config.features.auth
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return identityConfig;
|
|
101
|
+
}
|
|
102
|
+
__exportStar(require("./schema"), exports);
|