@absolutejs/voice 0.0.22-beta.27 → 0.0.22-beta.271
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/README.md +3234 -228
- package/dist/agent.d.ts +62 -0
- package/dist/agentSquadContract.d.ts +98 -0
- package/dist/angular/index.d.ts +15 -0
- package/dist/angular/index.js +3402 -1150
- package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
- package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
- package/dist/angular/voice-controller.service.d.ts +1 -0
- package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
- package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
- package/dist/angular/voice-live-ops.service.d.ts +11 -0
- package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
- package/dist/angular/voice-ops-status.component.d.ts +15 -0
- package/dist/angular/voice-ops-status.service.d.ts +12 -0
- package/dist/angular/voice-platform-coverage.service.d.ts +12 -0
- package/dist/angular/voice-proof-trends.service.d.ts +12 -0
- package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
- package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
- package/dist/angular/voice-routing-status.service.d.ts +11 -0
- package/dist/angular/voice-stream.service.d.ts +3 -0
- package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
- package/dist/angular/voice-turn-latency.service.d.ts +13 -0
- package/dist/angular/voice-turn-quality.service.d.ts +12 -0
- package/dist/angular/voice-workflow-status.service.d.ts +12 -0
- package/dist/audit.d.ts +128 -0
- package/dist/auditDeliveryRoutes.d.ts +85 -0
- package/dist/auditExport.d.ts +34 -0
- package/dist/auditRoutes.d.ts +66 -0
- package/dist/auditSinks.d.ts +151 -0
- package/dist/bargeInRoutes.d.ts +56 -0
- package/dist/campaign.d.ts +768 -0
- package/dist/campaignDialers.d.ts +111 -0
- package/dist/client/actions.d.ts +83 -0
- package/dist/client/agentSquadStatus.d.ts +37 -0
- package/dist/client/agentSquadStatusWidget.d.ts +24 -0
- package/dist/client/bargeInMonitor.d.ts +7 -0
- package/dist/client/campaignDialerProof.d.ts +23 -0
- package/dist/client/deliveryRuntime.d.ts +34 -0
- package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
- package/dist/client/duplex.d.ts +1 -1
- package/dist/client/htmxBootstrap.js +703 -13
- package/dist/client/index.d.ts +66 -0
- package/dist/client/index.js +5073 -19
- package/dist/client/liveOps.d.ts +22 -0
- package/dist/client/liveOpsWidget.d.ts +23 -0
- package/dist/client/liveTurnLatency.d.ts +41 -0
- package/dist/client/opsActionCenter.d.ts +54 -0
- package/dist/client/opsActionCenterWidget.d.ts +29 -0
- package/dist/client/opsActionHistory.d.ts +19 -0
- package/dist/client/opsActionHistoryWidget.d.ts +11 -0
- package/dist/client/opsStatus.d.ts +19 -0
- package/dist/client/opsStatusWidget.d.ts +40 -0
- package/dist/client/platformCoverage.d.ts +19 -0
- package/dist/client/platformCoverageWidget.d.ts +37 -0
- package/dist/client/proofTrends.d.ts +19 -0
- package/dist/client/proofTrendsWidget.d.ts +37 -0
- package/dist/client/providerCapabilities.d.ts +19 -0
- package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
- package/dist/client/providerContracts.d.ts +19 -0
- package/dist/client/providerContractsWidget.d.ts +37 -0
- package/dist/client/providerSimulationControls.d.ts +33 -0
- package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
- package/dist/client/providerStatusWidget.d.ts +32 -0
- package/dist/client/routingStatus.d.ts +19 -0
- package/dist/client/routingStatusWidget.d.ts +28 -0
- package/dist/client/traceTimeline.d.ts +19 -0
- package/dist/client/traceTimelineWidget.d.ts +36 -0
- package/dist/client/turnLatency.d.ts +22 -0
- package/dist/client/turnLatencyWidget.d.ts +33 -0
- package/dist/client/turnQuality.d.ts +19 -0
- package/dist/client/turnQualityWidget.d.ts +32 -0
- package/dist/client/workflowStatus.d.ts +19 -0
- package/dist/dataControl.d.ts +180 -0
- package/dist/deliveryRuntime.d.ts +158 -0
- package/dist/deliverySinkRoutes.d.ts +117 -0
- package/dist/demoReadyRoutes.d.ts +98 -0
- package/dist/diagnosticsRoutes.d.ts +44 -0
- package/dist/evalRoutes.d.ts +219 -0
- package/dist/fileStore.d.ts +14 -2
- package/dist/guardrails.d.ts +128 -0
- package/dist/handoff.d.ts +54 -0
- package/dist/handoffHealth.d.ts +94 -0
- package/dist/incidentBundle.d.ts +116 -0
- package/dist/index.d.ts +132 -13
- package/dist/index.js +25874 -5035
- package/dist/latencySlo.d.ts +56 -0
- package/dist/liveLatency.d.ts +78 -0
- package/dist/liveOps.d.ts +190 -0
- package/dist/modelAdapters.d.ts +23 -2
- package/dist/observabilityExport.d.ts +481 -0
- package/dist/openaiRealtime.d.ts +27 -0
- package/dist/openaiTTS.d.ts +18 -0
- package/dist/operationsRecord.d.ts +210 -0
- package/dist/opsActionAuditRoutes.d.ts +99 -0
- package/dist/opsConsoleRoutes.d.ts +80 -0
- package/dist/opsRecovery.d.ts +137 -0
- package/dist/opsStatus.d.ts +76 -0
- package/dist/opsStatusRoutes.d.ts +33 -0
- package/dist/outcomeContract.d.ts +146 -0
- package/dist/phoneAgent.d.ts +139 -0
- package/dist/phoneAgentProductionSmoke.d.ts +115 -0
- package/dist/platformCoverage.d.ts +91 -0
- package/dist/postCallAnalysis.d.ts +98 -0
- package/dist/postgresStore.d.ts +13 -2
- package/dist/productionReadiness.d.ts +484 -0
- package/dist/proofTrends.d.ts +133 -0
- package/dist/providerAdapters.d.ts +48 -0
- package/dist/providerCapabilities.d.ts +92 -0
- package/dist/providerHealth.d.ts +1 -0
- package/dist/providerRoutingContract.d.ts +71 -0
- package/dist/providerSlo.d.ts +142 -0
- package/dist/providerStackRecommendations.d.ts +187 -0
- package/dist/qualityRoutes.d.ts +76 -0
- package/dist/queue.d.ts +61 -0
- package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
- package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
- package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
- package/dist/react/VoiceOpsStatus.d.ts +6 -0
- package/dist/react/VoicePlatformCoverage.d.ts +6 -0
- package/dist/react/VoiceProofTrends.d.ts +6 -0
- package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
- package/dist/react/VoiceProviderContracts.d.ts +6 -0
- package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
- package/dist/react/VoiceProviderStatus.d.ts +6 -0
- package/dist/react/VoiceRoutingStatus.d.ts +6 -0
- package/dist/react/VoiceTraceTimeline.d.ts +6 -0
- package/dist/react/VoiceTurnLatency.d.ts +6 -0
- package/dist/react/VoiceTurnQuality.d.ts +6 -0
- package/dist/react/index.d.ts +30 -0
- package/dist/react/index.js +4773 -31
- package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
- package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
- package/dist/react/useVoiceController.d.ts +2 -0
- package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/react/useVoiceLiveOps.d.ts +9 -0
- package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/react/useVoiceOpsStatus.d.ts +8 -0
- package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
- package/dist/react/useVoiceProofTrends.d.ts +8 -0
- package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
- package/dist/react/useVoiceProviderContracts.d.ts +8 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/react/useVoiceStream.d.ts +2 -0
- package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
- package/dist/react/useVoiceTurnLatency.d.ts +9 -0
- package/dist/react/useVoiceTurnQuality.d.ts +8 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/readinessProfiles.d.ts +37 -0
- package/dist/reconnectContract.d.ts +87 -0
- package/dist/resilienceRoutes.d.ts +143 -0
- package/dist/sessionReplay.d.ts +12 -0
- package/dist/simulationSuite.d.ts +143 -0
- package/dist/sqliteStore.d.ts +13 -2
- package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
- package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
- package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
- package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
- package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
- package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
- package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
- package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
- package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
- package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
- package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
- package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +16 -0
- package/dist/svelte/index.js +4838 -420
- package/dist/telephony/contract.d.ts +61 -0
- package/dist/telephony/matrix.d.ts +97 -0
- package/dist/telephony/plivo.d.ts +303 -0
- package/dist/telephony/telnyx.d.ts +247 -0
- package/dist/telephony/twilio.d.ts +135 -2
- package/dist/telephonyOutcome.d.ts +273 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +2047 -42
- package/dist/testing/ioProviderSimulator.d.ts +41 -0
- package/dist/toolContract.d.ts +161 -0
- package/dist/toolRuntime.d.ts +50 -0
- package/dist/trace.d.ts +19 -1
- package/dist/traceDeliveryRoutes.d.ts +86 -0
- package/dist/traceTimeline.d.ts +97 -0
- package/dist/turnLatency.d.ts +95 -0
- package/dist/turnQuality.d.ts +94 -0
- package/dist/types.d.ts +158 -3
- package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
- package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
- package/dist/vue/VoiceOpsStatus.d.ts +30 -0
- package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
- package/dist/vue/VoiceProofTrends.d.ts +21 -0
- package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
- package/dist/vue/VoiceProviderContracts.d.ts +21 -0
- package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
- package/dist/vue/VoiceProviderStatus.d.ts +51 -0
- package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
- package/dist/vue/VoiceTurnLatency.d.ts +69 -0
- package/dist/vue/VoiceTurnQuality.d.ts +51 -0
- package/dist/vue/index.d.ts +28 -0
- package/dist/vue/index.js +4553 -55
- package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
- package/dist/vue/useVoiceController.d.ts +2 -1
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/vue/useVoiceLiveOps.d.ts +9 -0
- package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
- package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
- package/dist/vue/useVoiceProofTrends.d.ts +9 -0
- package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
- package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
- package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/vue/useVoiceStream.d.ts +4 -1
- package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
- package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
- package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
- package/dist/workflowContract.d.ts +91 -0
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { VoiceTelephonySetupStatus, VoiceTelephonySmokeCheck, VoiceTelephonySmokeReport } from './contract';
|
|
3
|
+
import { type VoiceTelephonyOutcomePolicy, type VoiceTelephonyWebhookRoutesOptions } from '../telephonyOutcome';
|
|
1
4
|
import { type VoiceCallReviewArtifact, type VoiceCallReviewConfig } from '../testing/review';
|
|
2
|
-
import type { AudioFormat, VoiceLogger, VoicePluginConfig, VoiceSessionRecord, VoiceServerMessage } from '../types';
|
|
5
|
+
import type { AudioFormat, STTAdapter, VoiceLogger, VoicePluginConfig, VoiceSessionRecord, VoiceServerMessage } from '../types';
|
|
3
6
|
type TwilioMediaPayload = {
|
|
4
7
|
chunk?: string;
|
|
5
8
|
payload: string;
|
|
@@ -75,7 +78,7 @@ export type TwilioMediaStreamSocket = {
|
|
|
75
78
|
close: (code?: number, reason?: string) => void | Promise<void>;
|
|
76
79
|
send: (data: string) => void | Promise<void>;
|
|
77
80
|
};
|
|
78
|
-
export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoicePluginConfig<TContext, TSession, TResult>, 'htmx' | 'path'> & {
|
|
81
|
+
export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoicePluginConfig<TContext, TSession, TResult>, 'htmx' | 'path' | 'stt'> & {
|
|
79
82
|
clearOnInboundMedia?: boolean;
|
|
80
83
|
context: TContext;
|
|
81
84
|
logger?: VoiceLogger;
|
|
@@ -94,6 +97,7 @@ export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends
|
|
|
94
97
|
};
|
|
95
98
|
scenarioId?: string;
|
|
96
99
|
sessionId?: string;
|
|
100
|
+
stt: STTAdapter;
|
|
97
101
|
};
|
|
98
102
|
export type TwilioMediaStreamBridge = {
|
|
99
103
|
close: (reason?: string) => Promise<void>;
|
|
@@ -107,10 +111,139 @@ export type TwilioVoiceResponseOptions = {
|
|
|
107
111
|
streamUrl: string;
|
|
108
112
|
track?: 'both_tracks' | 'inbound_track' | 'outbound_track';
|
|
109
113
|
};
|
|
114
|
+
export type TwilioVoiceRouteParameters = Record<string, string | number | boolean | undefined> | ((input: {
|
|
115
|
+
query: Record<string, unknown>;
|
|
116
|
+
request: Request;
|
|
117
|
+
}) => Promise<Record<string, string | number | boolean | undefined>> | Record<string, string | number | boolean | undefined>);
|
|
118
|
+
export type TwilioVoiceSetupStatus = VoiceTelephonySetupStatus<'twilio'> & {
|
|
119
|
+
urls: VoiceTelephonySetupStatus<'twilio'>['urls'] & {
|
|
120
|
+
twiml: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
export type TwilioVoiceSetupOptions = {
|
|
124
|
+
path?: false | string;
|
|
125
|
+
requiredEnv?: Record<string, string | undefined>;
|
|
126
|
+
title?: string;
|
|
127
|
+
};
|
|
128
|
+
export type TwilioVoiceSmokeCheck = VoiceTelephonySmokeCheck;
|
|
129
|
+
export type TwilioVoiceSmokeReport = VoiceTelephonySmokeReport<'twilio'> & {
|
|
130
|
+
setup: TwilioVoiceSetupStatus;
|
|
131
|
+
};
|
|
132
|
+
export type TwilioVoiceSmokeOptions = {
|
|
133
|
+
callSid?: string;
|
|
134
|
+
path?: false | string;
|
|
135
|
+
scenarioId?: string;
|
|
136
|
+
sessionId?: string;
|
|
137
|
+
sipCode?: number;
|
|
138
|
+
status?: string;
|
|
139
|
+
title?: string;
|
|
140
|
+
};
|
|
141
|
+
export type TwilioVoiceRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = TwilioMediaStreamBridgeOptions<TContext, TSession, TResult> & {
|
|
142
|
+
name?: string;
|
|
143
|
+
outcomePolicy?: VoiceTelephonyOutcomePolicy;
|
|
144
|
+
smoke?: TwilioVoiceSmokeOptions;
|
|
145
|
+
setup?: TwilioVoiceSetupOptions;
|
|
146
|
+
streamPath?: string;
|
|
147
|
+
twiml?: {
|
|
148
|
+
parameters?: TwilioVoiceRouteParameters;
|
|
149
|
+
path?: string;
|
|
150
|
+
streamName?: string;
|
|
151
|
+
streamUrl?: string | ((input: {
|
|
152
|
+
query: Record<string, unknown>;
|
|
153
|
+
request: Request;
|
|
154
|
+
streamPath: string;
|
|
155
|
+
}) => Promise<string> | string);
|
|
156
|
+
track?: TwilioVoiceResponseOptions['track'];
|
|
157
|
+
};
|
|
158
|
+
webhook?: Omit<VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>, 'context' | 'path' | 'policy' | 'provider'> & {
|
|
159
|
+
path?: string;
|
|
160
|
+
policy?: VoiceTelephonyOutcomePolicy;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
110
163
|
export declare const decodeTwilioMulawBase64: (payload: string) => Int16Array<ArrayBuffer>;
|
|
111
164
|
export declare const encodeTwilioMulawBase64: (samples: Int16Array) => string;
|
|
112
165
|
export declare const transcodeTwilioInboundPayloadToPCM16: (payload: string) => Uint8Array<ArrayBuffer>;
|
|
113
166
|
export declare const transcodePCMToTwilioOutboundPayload: (chunk: Uint8Array, format: AudioFormat) => string;
|
|
114
167
|
export declare const createTwilioVoiceResponse: (options: TwilioVoiceResponseOptions) => string;
|
|
115
168
|
export declare const createTwilioMediaStreamBridge: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(socket: TwilioMediaStreamSocket, options: TwilioMediaStreamBridgeOptions<TContext, TSession, TResult>) => TwilioMediaStreamBridge;
|
|
169
|
+
export declare const createTwilioVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: TwilioVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
|
|
170
|
+
decorator: {};
|
|
171
|
+
store: {};
|
|
172
|
+
derive: {};
|
|
173
|
+
resolve: {};
|
|
174
|
+
}, {
|
|
175
|
+
typebox: {};
|
|
176
|
+
error: {};
|
|
177
|
+
}, {
|
|
178
|
+
schema: {};
|
|
179
|
+
standaloneSchema: {};
|
|
180
|
+
macro: {};
|
|
181
|
+
macroFn: {};
|
|
182
|
+
parser: {};
|
|
183
|
+
response: {};
|
|
184
|
+
}, {
|
|
185
|
+
[x: string]: {
|
|
186
|
+
get: {
|
|
187
|
+
body: unknown;
|
|
188
|
+
params: {};
|
|
189
|
+
query: unknown;
|
|
190
|
+
headers: unknown;
|
|
191
|
+
response: {
|
|
192
|
+
200: Response;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
} & {
|
|
197
|
+
[x: string]: {
|
|
198
|
+
post: {
|
|
199
|
+
body: unknown;
|
|
200
|
+
params: {};
|
|
201
|
+
query: unknown;
|
|
202
|
+
headers: unknown;
|
|
203
|
+
response: {
|
|
204
|
+
200: Response;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
} & {
|
|
209
|
+
[x: string]: {
|
|
210
|
+
subscribe: {
|
|
211
|
+
body: unknown;
|
|
212
|
+
params: {};
|
|
213
|
+
query: unknown;
|
|
214
|
+
headers: unknown;
|
|
215
|
+
response: {};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
} & {
|
|
219
|
+
[x: string]: {
|
|
220
|
+
post: {
|
|
221
|
+
body: unknown;
|
|
222
|
+
params: {};
|
|
223
|
+
query: unknown;
|
|
224
|
+
headers: unknown;
|
|
225
|
+
response: {
|
|
226
|
+
200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}, {
|
|
231
|
+
derive: {};
|
|
232
|
+
resolve: {};
|
|
233
|
+
schema: {};
|
|
234
|
+
standaloneSchema: {};
|
|
235
|
+
response: {};
|
|
236
|
+
}, {
|
|
237
|
+
derive: {};
|
|
238
|
+
resolve: {};
|
|
239
|
+
schema: {};
|
|
240
|
+
standaloneSchema: {};
|
|
241
|
+
response: {};
|
|
242
|
+
} & {
|
|
243
|
+
derive: {};
|
|
244
|
+
resolve: {};
|
|
245
|
+
schema: {};
|
|
246
|
+
standaloneSchema: {};
|
|
247
|
+
response: {};
|
|
248
|
+
}>;
|
|
116
249
|
export {};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { VoiceCallDisposition, VoiceRouteResult, VoiceSessionHandle, VoiceSessionRecord } from './types';
|
|
3
|
+
export type VoiceTelephonyOutcomeAction = 'complete' | 'escalate' | 'ignore' | 'no-answer' | 'transfer' | 'voicemail';
|
|
4
|
+
export type VoiceTelephonyOutcomeProviderEvent = {
|
|
5
|
+
answeredBy?: string;
|
|
6
|
+
durationMs?: number;
|
|
7
|
+
from?: string;
|
|
8
|
+
metadata?: Record<string, unknown>;
|
|
9
|
+
provider?: string;
|
|
10
|
+
reason?: string;
|
|
11
|
+
sipCode?: number;
|
|
12
|
+
status?: string;
|
|
13
|
+
target?: string;
|
|
14
|
+
to?: string;
|
|
15
|
+
};
|
|
16
|
+
export type VoiceTelephonyOutcomeDecision = {
|
|
17
|
+
action: VoiceTelephonyOutcomeAction;
|
|
18
|
+
confidence: 'high' | 'low' | 'medium';
|
|
19
|
+
disposition?: VoiceCallDisposition;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
reason?: string;
|
|
22
|
+
source: 'answered-by' | 'duration' | 'explicit-target' | 'policy' | 'sip' | 'status';
|
|
23
|
+
target?: string;
|
|
24
|
+
};
|
|
25
|
+
export type VoiceTelephonyOutcomeStatusDecision = VoiceTelephonyOutcomeAction | Omit<VoiceTelephonyOutcomeDecision, 'confidence' | 'source'> & {
|
|
26
|
+
confidence?: VoiceTelephonyOutcomeDecision['confidence'];
|
|
27
|
+
source?: VoiceTelephonyOutcomeDecision['source'];
|
|
28
|
+
};
|
|
29
|
+
export type VoiceTelephonyOutcomePolicy = {
|
|
30
|
+
completedStatuses?: string[];
|
|
31
|
+
escalationStatuses?: string[];
|
|
32
|
+
failedAsNoAnswer?: boolean;
|
|
33
|
+
failedStatuses?: string[];
|
|
34
|
+
includeProviderPayload?: boolean;
|
|
35
|
+
machineDetectionVoicemailValues?: string[];
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
minAnsweredDurationMs?: number;
|
|
38
|
+
noAnswerOnZeroDuration?: boolean;
|
|
39
|
+
noAnswerSipCodes?: number[];
|
|
40
|
+
noAnswerStatuses?: string[];
|
|
41
|
+
statusMap?: Record<string, VoiceTelephonyOutcomeStatusDecision>;
|
|
42
|
+
transferStatuses?: string[];
|
|
43
|
+
transferTarget?: string | ((event: VoiceTelephonyOutcomeProviderEvent) => string | undefined);
|
|
44
|
+
voicemailStatuses?: string[];
|
|
45
|
+
};
|
|
46
|
+
export type VoiceTelephonyOutcomeRouteResult<TResult = unknown> = VoiceRouteResult<TResult>;
|
|
47
|
+
export type VoiceTelephonyWebhookProvider = 'generic' | 'plivo' | 'telnyx' | 'twilio';
|
|
48
|
+
export type VoiceTelephonyWebhookParseInput = {
|
|
49
|
+
body: unknown;
|
|
50
|
+
headers: Headers;
|
|
51
|
+
provider: VoiceTelephonyWebhookProvider;
|
|
52
|
+
query: Record<string, unknown>;
|
|
53
|
+
request: Request;
|
|
54
|
+
};
|
|
55
|
+
export type VoiceTelephonyWebhookDecision<TResult = unknown> = {
|
|
56
|
+
applied: boolean;
|
|
57
|
+
decision: VoiceTelephonyOutcomeDecision;
|
|
58
|
+
duplicate?: boolean;
|
|
59
|
+
event: VoiceTelephonyOutcomeProviderEvent;
|
|
60
|
+
idempotencyKey?: string;
|
|
61
|
+
routeResult: VoiceTelephonyOutcomeRouteResult<TResult>;
|
|
62
|
+
sessionId?: string;
|
|
63
|
+
};
|
|
64
|
+
export type StoredVoiceTelephonyWebhookDecision<TResult = unknown> = VoiceTelephonyWebhookDecision<TResult> & {
|
|
65
|
+
createdAt: number;
|
|
66
|
+
updatedAt: number;
|
|
67
|
+
};
|
|
68
|
+
export type VoiceTelephonyWebhookNormalizationEvidenceDecision = {
|
|
69
|
+
action?: VoiceTelephonyOutcomeAction | string;
|
|
70
|
+
applied?: boolean;
|
|
71
|
+
decision?: {
|
|
72
|
+
action?: VoiceTelephonyOutcomeAction | string;
|
|
73
|
+
disposition?: VoiceCallDisposition | string;
|
|
74
|
+
source?: VoiceTelephonyOutcomeDecision['source'] | string;
|
|
75
|
+
};
|
|
76
|
+
disposition?: VoiceCallDisposition | string;
|
|
77
|
+
duplicate?: boolean;
|
|
78
|
+
campaignOutcome?: unknown;
|
|
79
|
+
event?: VoiceTelephonyOutcomeProviderEvent;
|
|
80
|
+
idempotencyKey?: string;
|
|
81
|
+
provider?: VoiceTelephonyWebhookProvider | string;
|
|
82
|
+
routeResult?: unknown;
|
|
83
|
+
sessionId?: string;
|
|
84
|
+
source?: VoiceTelephonyOutcomeDecision['source'] | string;
|
|
85
|
+
};
|
|
86
|
+
export type VoiceTelephonyWebhookVerificationEvidenceAttempt = {
|
|
87
|
+
decisions?: number;
|
|
88
|
+
provider?: VoiceTelephonyWebhookProvider | string;
|
|
89
|
+
rejected?: boolean;
|
|
90
|
+
replayRejected?: boolean;
|
|
91
|
+
sideEffects?: number;
|
|
92
|
+
status?: number;
|
|
93
|
+
verification?: VoiceTelephonyWebhookVerificationResult;
|
|
94
|
+
};
|
|
95
|
+
export type VoiceTelephonyWebhookNormalizationEvidenceInput = {
|
|
96
|
+
decisions?: VoiceTelephonyWebhookNormalizationEvidenceDecision[];
|
|
97
|
+
maxMissingSessionIds?: number;
|
|
98
|
+
minApplied?: number;
|
|
99
|
+
minDecisions?: number;
|
|
100
|
+
minDuplicateIdempotencyKeys?: number;
|
|
101
|
+
minDuplicates?: number;
|
|
102
|
+
maxDuplicateCampaignOutcomesApplied?: number;
|
|
103
|
+
maxRejectedVerificationSideEffects?: number;
|
|
104
|
+
minRejectedVerificationAttempts?: number;
|
|
105
|
+
minReplayRejectedVerificationAttempts?: number;
|
|
106
|
+
requiredActions?: VoiceTelephonyOutcomeAction[];
|
|
107
|
+
requiredDispositions?: VoiceCallDisposition[];
|
|
108
|
+
requiredDuplicateProviders?: VoiceTelephonyWebhookProvider[];
|
|
109
|
+
requiredProviders?: VoiceTelephonyWebhookProvider[];
|
|
110
|
+
requiredReplayRejectedVerificationProviders?: VoiceTelephonyWebhookProvider[];
|
|
111
|
+
requiredRejectedVerificationProviders?: VoiceTelephonyWebhookProvider[];
|
|
112
|
+
requireRouteResults?: boolean;
|
|
113
|
+
verificationAttempts?: VoiceTelephonyWebhookVerificationEvidenceAttempt[];
|
|
114
|
+
};
|
|
115
|
+
export type VoiceTelephonyWebhookNormalizationEvidenceReport = {
|
|
116
|
+
actions: VoiceTelephonyOutcomeAction[];
|
|
117
|
+
applied: number;
|
|
118
|
+
decisions: number;
|
|
119
|
+
dispositions: VoiceCallDisposition[];
|
|
120
|
+
duplicateCampaignOutcomesApplied: number;
|
|
121
|
+
duplicateIdempotencyKeys: number;
|
|
122
|
+
duplicateOutcomeReasons: string[];
|
|
123
|
+
duplicateProviders: VoiceTelephonyWebhookProvider[];
|
|
124
|
+
duplicates: number;
|
|
125
|
+
issues: string[];
|
|
126
|
+
missingSessionIds: number;
|
|
127
|
+
ok: boolean;
|
|
128
|
+
providers: VoiceTelephonyWebhookProvider[];
|
|
129
|
+
rejectedVerificationAttempts: number;
|
|
130
|
+
rejectedVerificationProviders: VoiceTelephonyWebhookProvider[];
|
|
131
|
+
rejectedVerificationSideEffects: number;
|
|
132
|
+
replayRejectedVerificationAttempts: number;
|
|
133
|
+
replayRejectedVerificationProviders: VoiceTelephonyWebhookProvider[];
|
|
134
|
+
routeResults: number;
|
|
135
|
+
sources: string[];
|
|
136
|
+
verificationAttempts: number;
|
|
137
|
+
};
|
|
138
|
+
export type VoiceTelephonyWebhookIdempotencyStore<TResult = unknown> = {
|
|
139
|
+
get: (key: string) => Promise<StoredVoiceTelephonyWebhookDecision<TResult> | undefined> | StoredVoiceTelephonyWebhookDecision<TResult> | undefined;
|
|
140
|
+
set: (key: string, decision: StoredVoiceTelephonyWebhookDecision<TResult>) => Promise<void> | void;
|
|
141
|
+
};
|
|
142
|
+
export type VoiceTelephonyWebhookVerificationResult = {
|
|
143
|
+
ok: true;
|
|
144
|
+
} | {
|
|
145
|
+
ok: false;
|
|
146
|
+
reason: 'invalid-signature' | 'missing-secret' | 'missing-signature' | 'unsupported-provider';
|
|
147
|
+
};
|
|
148
|
+
export type VoiceTelephonyWebhookHandlerOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
149
|
+
apply?: boolean | ((input: VoiceTelephonyWebhookDecision<TResult>) => boolean);
|
|
150
|
+
context?: TContext;
|
|
151
|
+
getSessionHandle?: (input: {
|
|
152
|
+
context: TContext;
|
|
153
|
+
decision: VoiceTelephonyOutcomeDecision;
|
|
154
|
+
event: VoiceTelephonyOutcomeProviderEvent;
|
|
155
|
+
request: Request;
|
|
156
|
+
sessionId?: string;
|
|
157
|
+
}) => Promise<VoiceSessionHandle<TContext, TSession, TResult> | undefined> | VoiceSessionHandle<TContext, TSession, TResult> | undefined;
|
|
158
|
+
idempotency?: {
|
|
159
|
+
enabled?: boolean;
|
|
160
|
+
key?: (input: {
|
|
161
|
+
body: unknown;
|
|
162
|
+
event: VoiceTelephonyOutcomeProviderEvent;
|
|
163
|
+
provider: VoiceTelephonyWebhookProvider;
|
|
164
|
+
query: Record<string, unknown>;
|
|
165
|
+
request: Request;
|
|
166
|
+
sessionId?: string;
|
|
167
|
+
}) => Promise<string | undefined> | string | undefined;
|
|
168
|
+
store?: VoiceTelephonyWebhookIdempotencyStore<TResult>;
|
|
169
|
+
};
|
|
170
|
+
onDecision?: (input: VoiceTelephonyWebhookDecision<TResult> & {
|
|
171
|
+
context: TContext;
|
|
172
|
+
request: Request;
|
|
173
|
+
}) => Promise<void> | void;
|
|
174
|
+
parse?: (input: VoiceTelephonyWebhookParseInput) => Promise<VoiceTelephonyOutcomeProviderEvent> | VoiceTelephonyOutcomeProviderEvent;
|
|
175
|
+
policy?: VoiceTelephonyOutcomePolicy;
|
|
176
|
+
provider?: VoiceTelephonyWebhookProvider;
|
|
177
|
+
requireVerification?: boolean;
|
|
178
|
+
resolveSessionId?: (input: {
|
|
179
|
+
body: unknown;
|
|
180
|
+
event: VoiceTelephonyOutcomeProviderEvent;
|
|
181
|
+
query: Record<string, unknown>;
|
|
182
|
+
request: Request;
|
|
183
|
+
}) => Promise<string | undefined> | string | undefined;
|
|
184
|
+
result?: TResult | ((input: {
|
|
185
|
+
decision: VoiceTelephonyOutcomeDecision;
|
|
186
|
+
event: VoiceTelephonyOutcomeProviderEvent;
|
|
187
|
+
sessionId?: string;
|
|
188
|
+
}) => Promise<TResult | undefined> | TResult | undefined);
|
|
189
|
+
signingSecret?: string;
|
|
190
|
+
verificationUrl?: string | ((input: {
|
|
191
|
+
query: Record<string, unknown>;
|
|
192
|
+
request: Request;
|
|
193
|
+
}) => string);
|
|
194
|
+
verify?: (input: {
|
|
195
|
+
body: unknown;
|
|
196
|
+
headers: Headers;
|
|
197
|
+
provider: VoiceTelephonyWebhookProvider;
|
|
198
|
+
query: Record<string, unknown>;
|
|
199
|
+
rawBody: string;
|
|
200
|
+
request: Request;
|
|
201
|
+
}) => Promise<VoiceTelephonyWebhookVerificationResult> | VoiceTelephonyWebhookVerificationResult;
|
|
202
|
+
};
|
|
203
|
+
export type VoiceTelephonyWebhookRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = VoiceTelephonyWebhookHandlerOptions<TContext, TSession, TResult> & {
|
|
204
|
+
name?: string;
|
|
205
|
+
path?: string;
|
|
206
|
+
};
|
|
207
|
+
export declare class VoiceTelephonyWebhookVerificationError extends Error {
|
|
208
|
+
result: VoiceTelephonyWebhookVerificationResult;
|
|
209
|
+
constructor(result: VoiceTelephonyWebhookVerificationResult);
|
|
210
|
+
}
|
|
211
|
+
export declare const createMemoryVoiceTelephonyWebhookIdempotencyStore: <TResult = unknown>() => VoiceTelephonyWebhookIdempotencyStore<TResult>;
|
|
212
|
+
export declare const evaluateVoiceTelephonyWebhookNormalizationEvidence: (input?: VoiceTelephonyWebhookNormalizationEvidenceInput) => VoiceTelephonyWebhookNormalizationEvidenceReport;
|
|
213
|
+
export declare const assertVoiceTelephonyWebhookNormalizationEvidence: (input?: VoiceTelephonyWebhookNormalizationEvidenceInput) => VoiceTelephonyWebhookNormalizationEvidenceReport;
|
|
214
|
+
export declare const createVoiceTelephonyOutcomePolicy: (policy?: VoiceTelephonyOutcomePolicy) => Required<Pick<VoiceTelephonyOutcomePolicy, "completedStatuses" | "escalationStatuses" | "failedAsNoAnswer" | "failedStatuses" | "includeProviderPayload" | "machineDetectionVoicemailValues" | "noAnswerOnZeroDuration" | "noAnswerSipCodes" | "noAnswerStatuses" | "transferStatuses" | "voicemailStatuses">> & VoiceTelephonyOutcomePolicy;
|
|
215
|
+
export declare const resolveVoiceTelephonyOutcome: (event: VoiceTelephonyOutcomeProviderEvent, policyInput?: VoiceTelephonyOutcomePolicy) => VoiceTelephonyOutcomeDecision;
|
|
216
|
+
export declare const voiceTelephonyOutcomeToRouteResult: <TResult = unknown>(decision: VoiceTelephonyOutcomeDecision, result?: TResult) => VoiceTelephonyOutcomeRouteResult<TResult>;
|
|
217
|
+
export declare const applyVoiceTelephonyOutcome: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(api: VoiceSessionHandle<TContext, TSession, TResult>, decision: VoiceTelephonyOutcomeDecision, result?: TResult) => Promise<void>;
|
|
218
|
+
export declare const signVoiceTwilioWebhook: (input: {
|
|
219
|
+
authToken: string;
|
|
220
|
+
body?: unknown;
|
|
221
|
+
url: string;
|
|
222
|
+
}) => Promise<string>;
|
|
223
|
+
export declare const verifyVoiceTwilioWebhookSignature: (input: {
|
|
224
|
+
authToken?: string;
|
|
225
|
+
body?: unknown;
|
|
226
|
+
headers: Headers;
|
|
227
|
+
url: string;
|
|
228
|
+
}) => Promise<VoiceTelephonyWebhookVerificationResult>;
|
|
229
|
+
export declare const parseVoiceTelephonyWebhookEvent: (input: VoiceTelephonyWebhookParseInput) => VoiceTelephonyOutcomeProviderEvent;
|
|
230
|
+
export declare const createVoiceTelephonyWebhookHandler: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: VoiceTelephonyWebhookHandlerOptions<TContext, TSession, TResult>) => (input: {
|
|
231
|
+
query?: Record<string, unknown>;
|
|
232
|
+
request: Request;
|
|
233
|
+
}) => Promise<VoiceTelephonyWebhookDecision<TResult>>;
|
|
234
|
+
export declare const createVoiceTelephonyWebhookRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
|
|
235
|
+
decorator: {};
|
|
236
|
+
store: {};
|
|
237
|
+
derive: {};
|
|
238
|
+
resolve: {};
|
|
239
|
+
}, {
|
|
240
|
+
typebox: {};
|
|
241
|
+
error: {};
|
|
242
|
+
}, {
|
|
243
|
+
schema: {};
|
|
244
|
+
standaloneSchema: {};
|
|
245
|
+
macro: {};
|
|
246
|
+
macroFn: {};
|
|
247
|
+
parser: {};
|
|
248
|
+
response: {};
|
|
249
|
+
}, {
|
|
250
|
+
[x: string]: {
|
|
251
|
+
post: {
|
|
252
|
+
body: unknown;
|
|
253
|
+
params: {};
|
|
254
|
+
query: unknown;
|
|
255
|
+
headers: unknown;
|
|
256
|
+
response: {
|
|
257
|
+
200: Response | VoiceTelephonyWebhookDecision<TResult>;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
}, {
|
|
262
|
+
derive: {};
|
|
263
|
+
resolve: {};
|
|
264
|
+
schema: {};
|
|
265
|
+
standaloneSchema: {};
|
|
266
|
+
response: {};
|
|
267
|
+
}, {
|
|
268
|
+
derive: {};
|
|
269
|
+
resolve: {};
|
|
270
|
+
schema: {};
|
|
271
|
+
standaloneSchema: {};
|
|
272
|
+
response: {};
|
|
273
|
+
}>;
|
package/dist/testing/index.d.ts
CHANGED