@absolutejs/voice 0.0.22-beta.8 → 0.0.22-beta.81
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 +205 -0
- package/dist/agent.d.ts +2 -0
- package/dist/angular/index.d.ts +6 -0
- package/dist/angular/index.js +833 -43
- package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
- package/dist/angular/voice-ops-status.component.d.ts +15 -0
- package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
- package/dist/angular/voice-provider-status.service.d.ts +12 -0
- package/dist/angular/voice-routing-status.service.d.ts +11 -0
- package/dist/angular/voice-stream.service.d.ts +2 -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/appKit.d.ts +94 -0
- package/dist/assistantHealth.d.ts +81 -0
- package/dist/client/actions.d.ts +22 -0
- package/dist/client/appKitStatus.d.ts +19 -0
- package/dist/client/connection.d.ts +3 -0
- package/dist/client/htmxBootstrap.js +44 -2
- package/dist/client/index.d.ts +26 -0
- package/dist/client/index.js +1290 -2
- package/dist/client/opsStatusWidget.d.ts +40 -0
- package/dist/client/providerCapabilities.d.ts +19 -0
- package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
- package/dist/client/providerSimulationControls.d.ts +33 -0
- package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
- package/dist/client/providerStatus.d.ts +19 -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/turnQuality.d.ts +19 -0
- package/dist/client/turnQualityWidget.d.ts +32 -0
- package/dist/client/workflowStatus.d.ts +19 -0
- package/dist/diagnosticsRoutes.d.ts +44 -0
- package/dist/evalRoutes.d.ts +213 -0
- package/dist/handoff.d.ts +54 -0
- package/dist/handoffHealth.d.ts +94 -0
- package/dist/index.d.ts +56 -7
- package/dist/index.js +6921 -128
- package/dist/modelAdapters.d.ts +75 -0
- package/dist/opsConsoleRoutes.d.ts +77 -0
- package/dist/opsWebhook.d.ts +126 -0
- package/dist/outcomeContract.d.ts +112 -0
- package/dist/postgresStore.d.ts +2 -0
- package/dist/providerAdapters.d.ts +48 -0
- package/dist/providerCapabilities.d.ts +92 -0
- package/dist/providerHealth.d.ts +79 -0
- package/dist/qualityRoutes.d.ts +76 -0
- package/dist/queue.d.ts +61 -0
- package/dist/react/VoiceOpsStatus.d.ts +6 -0
- package/dist/react/VoiceProviderCapabilities.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/VoiceTurnQuality.d.ts +6 -0
- package/dist/react/index.d.ts +13 -0
- package/dist/react/index.js +1884 -11
- package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
- package/dist/react/useVoiceController.d.ts +2 -0
- package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
- package/dist/react/useVoiceProviderStatus.d.ts +8 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/react/useVoiceStream.d.ts +2 -0
- package/dist/react/useVoiceTurnQuality.d.ts +8 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/resilienceRoutes.d.ts +117 -0
- package/dist/sessionReplay.d.ts +175 -0
- package/dist/sqliteStore.d.ts +2 -0
- package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
- package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +10 -0
- package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
- package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +8 -0
- package/dist/svelte/index.js +1330 -3
- package/dist/telephony/contract.d.ts +61 -0
- package/dist/telephony/matrix.d.ts +97 -0
- package/dist/telephony/plivo.d.ts +154 -0
- package/dist/telephony/telnyx.d.ts +139 -0
- package/dist/telephony/twilio.d.ts +132 -0
- package/dist/telephonyOutcome.d.ts +201 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +2543 -14
- package/dist/testing/ioProviderSimulator.d.ts +41 -0
- package/dist/testing/providerSimulator.d.ts +44 -0
- package/dist/toolContract.d.ts +130 -0
- package/dist/toolRuntime.d.ts +50 -0
- package/dist/trace.d.ts +1 -1
- package/dist/turnQuality.d.ts +94 -0
- package/dist/types.d.ts +84 -2
- package/dist/vue/VoiceOpsStatus.d.ts +30 -0
- package/dist/vue/VoiceProviderCapabilities.d.ts +51 -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/VoiceTurnQuality.d.ts +51 -0
- package/dist/vue/index.d.ts +13 -0
- package/dist/vue/index.js +1934 -25
- package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
- package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
- package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/vue/useVoiceStream.d.ts +2 -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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type VoiceTelephonyProvider = 'generic' | 'plivo' | 'telnyx' | 'twilio';
|
|
2
|
+
export type VoiceTelephonySetupStatus<TProvider extends VoiceTelephonyProvider = VoiceTelephonyProvider> = {
|
|
3
|
+
generatedAt: number;
|
|
4
|
+
missing: string[];
|
|
5
|
+
provider: TProvider;
|
|
6
|
+
ready: boolean;
|
|
7
|
+
signing: {
|
|
8
|
+
configured: boolean;
|
|
9
|
+
mode: 'custom' | 'none' | 'provider-signature' | 'twilio-signature';
|
|
10
|
+
verificationUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
urls: {
|
|
13
|
+
stream: string;
|
|
14
|
+
twiml?: string;
|
|
15
|
+
webhook: string;
|
|
16
|
+
};
|
|
17
|
+
warnings: string[];
|
|
18
|
+
};
|
|
19
|
+
export type VoiceTelephonySmokeCheck = {
|
|
20
|
+
details?: Record<string, unknown>;
|
|
21
|
+
message?: string;
|
|
22
|
+
name: string;
|
|
23
|
+
status: 'fail' | 'pass' | 'warn';
|
|
24
|
+
};
|
|
25
|
+
export type VoiceTelephonySmokeReport<TProvider extends VoiceTelephonyProvider = VoiceTelephonyProvider> = {
|
|
26
|
+
checks: VoiceTelephonySmokeCheck[];
|
|
27
|
+
generatedAt: number;
|
|
28
|
+
pass: boolean;
|
|
29
|
+
provider: TProvider;
|
|
30
|
+
setup: VoiceTelephonySetupStatus<TProvider>;
|
|
31
|
+
twiml?: {
|
|
32
|
+
status: number;
|
|
33
|
+
streamUrl?: string;
|
|
34
|
+
};
|
|
35
|
+
webhook?: {
|
|
36
|
+
body?: unknown;
|
|
37
|
+
status: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type VoiceTelephonyContractRequirement = 'signed-webhook' | 'smoke-pass' | 'stream-url' | 'webhook-url' | 'wss-stream';
|
|
41
|
+
export type VoiceTelephonyContractIssue = {
|
|
42
|
+
requirement: VoiceTelephonyContractRequirement;
|
|
43
|
+
severity: 'error' | 'warning';
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
export type VoiceTelephonyContractReport<TProvider extends VoiceTelephonyProvider = VoiceTelephonyProvider> = {
|
|
47
|
+
issues: VoiceTelephonyContractIssue[];
|
|
48
|
+
pass: boolean;
|
|
49
|
+
provider: TProvider;
|
|
50
|
+
requirements: VoiceTelephonyContractRequirement[];
|
|
51
|
+
setup: VoiceTelephonySetupStatus<TProvider>;
|
|
52
|
+
smoke?: VoiceTelephonySmokeReport<TProvider>;
|
|
53
|
+
};
|
|
54
|
+
export type VoiceTelephonyContractOptions = {
|
|
55
|
+
requirements?: VoiceTelephonyContractRequirement[];
|
|
56
|
+
};
|
|
57
|
+
export declare const evaluateVoiceTelephonyContract: <TProvider extends VoiceTelephonyProvider>(input: {
|
|
58
|
+
options?: VoiceTelephonyContractOptions;
|
|
59
|
+
setup: VoiceTelephonySetupStatus<TProvider>;
|
|
60
|
+
smoke?: VoiceTelephonySmokeReport<TProvider>;
|
|
61
|
+
}) => VoiceTelephonyContractReport<TProvider>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type VoiceTelephonyContractOptions, type VoiceTelephonyContractReport, type VoiceTelephonyProvider, type VoiceTelephonySetupStatus, type VoiceTelephonySmokeReport } from './contract';
|
|
3
|
+
export type VoiceTelephonyCarrierMatrixStatus = 'fail' | 'pass' | 'warn';
|
|
4
|
+
export type VoiceTelephonyCarrierMatrixInput<TProvider extends VoiceTelephonyProvider = VoiceTelephonyProvider> = {
|
|
5
|
+
contract?: VoiceTelephonyContractReport<TProvider>;
|
|
6
|
+
name?: string;
|
|
7
|
+
setup: VoiceTelephonySetupStatus<TProvider>;
|
|
8
|
+
smoke?: VoiceTelephonySmokeReport<TProvider>;
|
|
9
|
+
};
|
|
10
|
+
export type VoiceTelephonyCarrierMatrixEntry<TProvider extends VoiceTelephonyProvider = VoiceTelephonyProvider> = {
|
|
11
|
+
contract: VoiceTelephonyContractReport<TProvider>;
|
|
12
|
+
issues: VoiceTelephonyContractReport<TProvider>['issues'];
|
|
13
|
+
name: string;
|
|
14
|
+
provider: TProvider;
|
|
15
|
+
ready: boolean;
|
|
16
|
+
setup: VoiceTelephonySetupStatus<TProvider>;
|
|
17
|
+
smoke?: VoiceTelephonySmokeReport<TProvider>;
|
|
18
|
+
status: VoiceTelephonyCarrierMatrixStatus;
|
|
19
|
+
summary: {
|
|
20
|
+
errors: number;
|
|
21
|
+
failures: number;
|
|
22
|
+
missing: number;
|
|
23
|
+
warnings: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type VoiceTelephonyCarrierMatrix = {
|
|
27
|
+
entries: VoiceTelephonyCarrierMatrixEntry[];
|
|
28
|
+
generatedAt: number;
|
|
29
|
+
pass: boolean;
|
|
30
|
+
summary: {
|
|
31
|
+
contractsPassing: number;
|
|
32
|
+
failing: number;
|
|
33
|
+
providers: number;
|
|
34
|
+
ready: number;
|
|
35
|
+
smokePassing: number;
|
|
36
|
+
warnings: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type VoiceTelephonyCarrierMatrixOptions = {
|
|
40
|
+
contract?: VoiceTelephonyContractOptions;
|
|
41
|
+
generatedAt?: number;
|
|
42
|
+
providers: VoiceTelephonyCarrierMatrixInput[];
|
|
43
|
+
};
|
|
44
|
+
export type VoiceTelephonyCarrierMatrixRoutesOptions = {
|
|
45
|
+
load: (input: {
|
|
46
|
+
query: Record<string, unknown>;
|
|
47
|
+
request: Request;
|
|
48
|
+
}) => Promise<VoiceTelephonyCarrierMatrixInput[]> | VoiceTelephonyCarrierMatrixInput[];
|
|
49
|
+
name?: string;
|
|
50
|
+
path?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
contract?: VoiceTelephonyContractOptions;
|
|
53
|
+
};
|
|
54
|
+
export declare const createVoiceTelephonyCarrierMatrix: (options: VoiceTelephonyCarrierMatrixOptions) => VoiceTelephonyCarrierMatrix;
|
|
55
|
+
export declare const renderVoiceTelephonyCarrierMatrixHTML: (matrix: VoiceTelephonyCarrierMatrix, options?: {
|
|
56
|
+
title?: string;
|
|
57
|
+
}) => string;
|
|
58
|
+
export declare const createVoiceTelephonyCarrierMatrixRoutes: (options: VoiceTelephonyCarrierMatrixRoutesOptions) => Elysia<"", {
|
|
59
|
+
decorator: {};
|
|
60
|
+
store: {};
|
|
61
|
+
derive: {};
|
|
62
|
+
resolve: {};
|
|
63
|
+
}, {
|
|
64
|
+
typebox: {};
|
|
65
|
+
error: {};
|
|
66
|
+
}, {
|
|
67
|
+
schema: {};
|
|
68
|
+
standaloneSchema: {};
|
|
69
|
+
macro: {};
|
|
70
|
+
macroFn: {};
|
|
71
|
+
parser: {};
|
|
72
|
+
response: {};
|
|
73
|
+
}, {
|
|
74
|
+
[x: string]: {
|
|
75
|
+
get: {
|
|
76
|
+
body: unknown;
|
|
77
|
+
params: {};
|
|
78
|
+
query: unknown;
|
|
79
|
+
headers: unknown;
|
|
80
|
+
response: {
|
|
81
|
+
200: Response | VoiceTelephonyCarrierMatrix;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
derive: {};
|
|
87
|
+
resolve: {};
|
|
88
|
+
schema: {};
|
|
89
|
+
standaloneSchema: {};
|
|
90
|
+
response: {};
|
|
91
|
+
}, {
|
|
92
|
+
derive: {};
|
|
93
|
+
resolve: {};
|
|
94
|
+
schema: {};
|
|
95
|
+
standaloneSchema: {};
|
|
96
|
+
response: {};
|
|
97
|
+
}>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type VoiceTelephonyContractReport, type VoiceTelephonySetupStatus, type VoiceTelephonySmokeCheck, type VoiceTelephonySmokeReport } from './contract';
|
|
3
|
+
import { type VoiceTelephonyOutcomePolicy, type VoiceTelephonyWebhookRoutesOptions, type VoiceTelephonyWebhookVerificationResult } from '../telephonyOutcome';
|
|
4
|
+
import type { VoiceSessionRecord } from '../types';
|
|
5
|
+
export type PlivoVoiceResponseOptions = {
|
|
6
|
+
audioTrack?: 'both' | 'inbound' | 'outbound';
|
|
7
|
+
bidirectional?: boolean;
|
|
8
|
+
contentType?: 'audio/x-l16;rate=8000' | 'audio/x-l16;rate=16000' | 'audio/x-mulaw;rate=8000';
|
|
9
|
+
extraHeaders?: Record<string, string | number | boolean | undefined> | string;
|
|
10
|
+
keepCallAlive?: boolean;
|
|
11
|
+
noiseCancellation?: boolean;
|
|
12
|
+
noiseCancellationLevel?: number;
|
|
13
|
+
statusCallbackMethod?: 'GET' | 'POST';
|
|
14
|
+
statusCallbackUrl?: string;
|
|
15
|
+
streamTimeout?: number;
|
|
16
|
+
streamUrl: string;
|
|
17
|
+
};
|
|
18
|
+
export type PlivoVoiceSetupStatus = VoiceTelephonySetupStatus<'plivo'> & {
|
|
19
|
+
urls: VoiceTelephonySetupStatus<'plivo'>['urls'] & {
|
|
20
|
+
answer: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type PlivoVoiceSetupOptions = {
|
|
24
|
+
path?: false | string;
|
|
25
|
+
requiredEnv?: Record<string, string | undefined>;
|
|
26
|
+
title?: string;
|
|
27
|
+
};
|
|
28
|
+
export type PlivoVoiceSmokeCheck = VoiceTelephonySmokeCheck;
|
|
29
|
+
export type PlivoVoiceSmokeReport = VoiceTelephonySmokeReport<'plivo'> & {
|
|
30
|
+
answer?: {
|
|
31
|
+
status: number;
|
|
32
|
+
streamUrl?: string;
|
|
33
|
+
};
|
|
34
|
+
contract: VoiceTelephonyContractReport<'plivo'>;
|
|
35
|
+
setup: PlivoVoiceSetupStatus;
|
|
36
|
+
};
|
|
37
|
+
export type PlivoVoiceSmokeOptions = {
|
|
38
|
+
callUuid?: string;
|
|
39
|
+
eventType?: string;
|
|
40
|
+
path?: false | string;
|
|
41
|
+
sessionId?: string;
|
|
42
|
+
sipCode?: number;
|
|
43
|
+
status?: string;
|
|
44
|
+
title?: string;
|
|
45
|
+
};
|
|
46
|
+
export type PlivoVoiceRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
47
|
+
answer?: {
|
|
48
|
+
path?: string;
|
|
49
|
+
response?: Omit<PlivoVoiceResponseOptions, 'streamUrl'>;
|
|
50
|
+
streamUrl?: string | ((input: {
|
|
51
|
+
query: Record<string, unknown>;
|
|
52
|
+
request: Request;
|
|
53
|
+
streamPath: string;
|
|
54
|
+
}) => Promise<string> | string);
|
|
55
|
+
};
|
|
56
|
+
context?: TContext;
|
|
57
|
+
name?: string;
|
|
58
|
+
outcomePolicy?: VoiceTelephonyOutcomePolicy;
|
|
59
|
+
setup?: PlivoVoiceSetupOptions;
|
|
60
|
+
smoke?: PlivoVoiceSmokeOptions;
|
|
61
|
+
streamPath?: string;
|
|
62
|
+
webhook?: Omit<VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>, 'context' | 'path' | 'policy' | 'provider'> & {
|
|
63
|
+
authToken?: string;
|
|
64
|
+
path?: string;
|
|
65
|
+
policy?: VoiceTelephonyOutcomePolicy;
|
|
66
|
+
verificationUrl?: string | ((input: {
|
|
67
|
+
query: Record<string, unknown>;
|
|
68
|
+
request: Request;
|
|
69
|
+
}) => string);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export declare const createPlivoVoiceResponse: (options: PlivoVoiceResponseOptions) => string;
|
|
73
|
+
export declare const signVoicePlivoWebhook: (input: {
|
|
74
|
+
authToken: string;
|
|
75
|
+
body?: unknown;
|
|
76
|
+
nonce: string;
|
|
77
|
+
url: string;
|
|
78
|
+
}) => Promise<string>;
|
|
79
|
+
export declare const verifyVoicePlivoWebhookSignature: (input: {
|
|
80
|
+
authToken?: string;
|
|
81
|
+
body?: unknown;
|
|
82
|
+
headers: Headers;
|
|
83
|
+
url: string;
|
|
84
|
+
}) => Promise<VoiceTelephonyWebhookVerificationResult>;
|
|
85
|
+
export declare const createPlivoVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: PlivoVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
|
|
86
|
+
decorator: {};
|
|
87
|
+
store: {};
|
|
88
|
+
derive: {};
|
|
89
|
+
resolve: {};
|
|
90
|
+
}, {
|
|
91
|
+
typebox: {};
|
|
92
|
+
error: {};
|
|
93
|
+
}, {
|
|
94
|
+
schema: {};
|
|
95
|
+
standaloneSchema: {};
|
|
96
|
+
macro: {};
|
|
97
|
+
macroFn: {};
|
|
98
|
+
parser: {};
|
|
99
|
+
response: {};
|
|
100
|
+
}, {
|
|
101
|
+
[x: string]: {
|
|
102
|
+
get: {
|
|
103
|
+
body: unknown;
|
|
104
|
+
params: {};
|
|
105
|
+
query: unknown;
|
|
106
|
+
headers: unknown;
|
|
107
|
+
response: {
|
|
108
|
+
200: Response;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
} & {
|
|
113
|
+
[x: string]: {
|
|
114
|
+
post: {
|
|
115
|
+
body: unknown;
|
|
116
|
+
params: {};
|
|
117
|
+
query: unknown;
|
|
118
|
+
headers: unknown;
|
|
119
|
+
response: {
|
|
120
|
+
200: Response;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
} & {
|
|
125
|
+
[x: string]: {
|
|
126
|
+
post: {
|
|
127
|
+
body: unknown;
|
|
128
|
+
params: {};
|
|
129
|
+
query: unknown;
|
|
130
|
+
headers: unknown;
|
|
131
|
+
response: {
|
|
132
|
+
200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}, {
|
|
137
|
+
derive: {};
|
|
138
|
+
resolve: {};
|
|
139
|
+
schema: {};
|
|
140
|
+
standaloneSchema: {};
|
|
141
|
+
response: {};
|
|
142
|
+
}, {
|
|
143
|
+
derive: {};
|
|
144
|
+
resolve: {};
|
|
145
|
+
schema: {};
|
|
146
|
+
standaloneSchema: {};
|
|
147
|
+
response: {};
|
|
148
|
+
} & {
|
|
149
|
+
derive: {};
|
|
150
|
+
resolve: {};
|
|
151
|
+
schema: {};
|
|
152
|
+
standaloneSchema: {};
|
|
153
|
+
response: {};
|
|
154
|
+
}>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type VoiceTelephonyContractReport, type VoiceTelephonySetupStatus, type VoiceTelephonySmokeCheck, type VoiceTelephonySmokeReport } from './contract';
|
|
3
|
+
import { type VoiceTelephonyOutcomePolicy, type VoiceTelephonyWebhookRoutesOptions, type VoiceTelephonyWebhookVerificationResult } from '../telephonyOutcome';
|
|
4
|
+
import type { VoiceSessionRecord } from '../types';
|
|
5
|
+
export type TelnyxVoiceResponseOptions = {
|
|
6
|
+
bidirectionalCodec?: 'AMR-WB' | 'G722' | 'OPUS' | 'PCMA' | 'PCMU';
|
|
7
|
+
bidirectionalMode?: 'mp3' | 'rtp';
|
|
8
|
+
codec?: 'AMR-WB' | 'G722' | 'OPUS' | 'PCMA' | 'PCMU' | 'default';
|
|
9
|
+
streamName?: string;
|
|
10
|
+
streamUrl: string;
|
|
11
|
+
track?: 'both_tracks' | 'inbound_track' | 'outbound_track';
|
|
12
|
+
};
|
|
13
|
+
export type TelnyxVoiceSetupStatus = VoiceTelephonySetupStatus<'telnyx'> & {
|
|
14
|
+
urls: VoiceTelephonySetupStatus<'telnyx'>['urls'] & {
|
|
15
|
+
texml: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type TelnyxVoiceSetupOptions = {
|
|
19
|
+
path?: false | string;
|
|
20
|
+
requiredEnv?: Record<string, string | undefined>;
|
|
21
|
+
title?: string;
|
|
22
|
+
};
|
|
23
|
+
export type TelnyxVoiceSmokeCheck = VoiceTelephonySmokeCheck;
|
|
24
|
+
export type TelnyxVoiceSmokeReport = VoiceTelephonySmokeReport<'telnyx'> & {
|
|
25
|
+
contract: VoiceTelephonyContractReport<'telnyx'>;
|
|
26
|
+
setup: TelnyxVoiceSetupStatus;
|
|
27
|
+
texml?: {
|
|
28
|
+
status: number;
|
|
29
|
+
streamUrl?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type TelnyxVoiceSmokeOptions = {
|
|
33
|
+
callControlId?: string;
|
|
34
|
+
callLegId?: string;
|
|
35
|
+
eventType?: string;
|
|
36
|
+
path?: false | string;
|
|
37
|
+
sessionId?: string;
|
|
38
|
+
title?: string;
|
|
39
|
+
};
|
|
40
|
+
export type TelnyxVoiceRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
41
|
+
context?: TContext;
|
|
42
|
+
name?: string;
|
|
43
|
+
outcomePolicy?: VoiceTelephonyOutcomePolicy;
|
|
44
|
+
setup?: TelnyxVoiceSetupOptions;
|
|
45
|
+
smoke?: TelnyxVoiceSmokeOptions;
|
|
46
|
+
streamPath?: string;
|
|
47
|
+
texml?: {
|
|
48
|
+
path?: string;
|
|
49
|
+
response?: Omit<TelnyxVoiceResponseOptions, 'streamUrl'>;
|
|
50
|
+
streamUrl?: string | ((input: {
|
|
51
|
+
query: Record<string, unknown>;
|
|
52
|
+
request: Request;
|
|
53
|
+
streamPath: string;
|
|
54
|
+
}) => Promise<string> | string);
|
|
55
|
+
};
|
|
56
|
+
webhook?: Omit<VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>, 'context' | 'path' | 'policy' | 'provider'> & {
|
|
57
|
+
path?: string;
|
|
58
|
+
policy?: VoiceTelephonyOutcomePolicy;
|
|
59
|
+
publicKey?: string;
|
|
60
|
+
toleranceSeconds?: number;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export declare const createTelnyxVoiceResponse: (options: TelnyxVoiceResponseOptions) => string;
|
|
64
|
+
export declare const verifyVoiceTelnyxWebhookSignature: (input: {
|
|
65
|
+
body: string;
|
|
66
|
+
headers: Headers;
|
|
67
|
+
publicKey?: string;
|
|
68
|
+
toleranceSeconds?: number;
|
|
69
|
+
}) => Promise<VoiceTelephonyWebhookVerificationResult>;
|
|
70
|
+
export declare const createTelnyxVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: TelnyxVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
|
|
71
|
+
decorator: {};
|
|
72
|
+
store: {};
|
|
73
|
+
derive: {};
|
|
74
|
+
resolve: {};
|
|
75
|
+
}, {
|
|
76
|
+
typebox: {};
|
|
77
|
+
error: {};
|
|
78
|
+
}, {
|
|
79
|
+
schema: {};
|
|
80
|
+
standaloneSchema: {};
|
|
81
|
+
macro: {};
|
|
82
|
+
macroFn: {};
|
|
83
|
+
parser: {};
|
|
84
|
+
response: {};
|
|
85
|
+
}, {
|
|
86
|
+
[x: string]: {
|
|
87
|
+
get: {
|
|
88
|
+
body: unknown;
|
|
89
|
+
params: {};
|
|
90
|
+
query: unknown;
|
|
91
|
+
headers: unknown;
|
|
92
|
+
response: {
|
|
93
|
+
200: Response;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
} & {
|
|
98
|
+
[x: string]: {
|
|
99
|
+
post: {
|
|
100
|
+
body: unknown;
|
|
101
|
+
params: {};
|
|
102
|
+
query: unknown;
|
|
103
|
+
headers: unknown;
|
|
104
|
+
response: {
|
|
105
|
+
200: Response;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
} & {
|
|
110
|
+
[x: string]: {
|
|
111
|
+
post: {
|
|
112
|
+
body: unknown;
|
|
113
|
+
params: {};
|
|
114
|
+
query: unknown;
|
|
115
|
+
headers: unknown;
|
|
116
|
+
response: {
|
|
117
|
+
200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
derive: {};
|
|
123
|
+
resolve: {};
|
|
124
|
+
schema: {};
|
|
125
|
+
standaloneSchema: {};
|
|
126
|
+
response: {};
|
|
127
|
+
}, {
|
|
128
|
+
derive: {};
|
|
129
|
+
resolve: {};
|
|
130
|
+
schema: {};
|
|
131
|
+
standaloneSchema: {};
|
|
132
|
+
response: {};
|
|
133
|
+
} & {
|
|
134
|
+
derive: {};
|
|
135
|
+
resolve: {};
|
|
136
|
+
schema: {};
|
|
137
|
+
standaloneSchema: {};
|
|
138
|
+
response: {};
|
|
139
|
+
}>;
|
|
@@ -1,3 +1,6 @@
|
|
|
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
5
|
import type { AudioFormat, VoiceLogger, VoicePluginConfig, VoiceSessionRecord, VoiceServerMessage } from '../types';
|
|
3
6
|
type TwilioMediaPayload = {
|
|
@@ -107,10 +110,139 @@ export type TwilioVoiceResponseOptions = {
|
|
|
107
110
|
streamUrl: string;
|
|
108
111
|
track?: 'both_tracks' | 'inbound_track' | 'outbound_track';
|
|
109
112
|
};
|
|
113
|
+
export type TwilioVoiceRouteParameters = Record<string, string | number | boolean | undefined> | ((input: {
|
|
114
|
+
query: Record<string, unknown>;
|
|
115
|
+
request: Request;
|
|
116
|
+
}) => Promise<Record<string, string | number | boolean | undefined>> | Record<string, string | number | boolean | undefined>);
|
|
117
|
+
export type TwilioVoiceSetupStatus = VoiceTelephonySetupStatus<'twilio'> & {
|
|
118
|
+
urls: VoiceTelephonySetupStatus<'twilio'>['urls'] & {
|
|
119
|
+
twiml: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export type TwilioVoiceSetupOptions = {
|
|
123
|
+
path?: false | string;
|
|
124
|
+
requiredEnv?: Record<string, string | undefined>;
|
|
125
|
+
title?: string;
|
|
126
|
+
};
|
|
127
|
+
export type TwilioVoiceSmokeCheck = VoiceTelephonySmokeCheck;
|
|
128
|
+
export type TwilioVoiceSmokeReport = VoiceTelephonySmokeReport<'twilio'> & {
|
|
129
|
+
setup: TwilioVoiceSetupStatus;
|
|
130
|
+
};
|
|
131
|
+
export type TwilioVoiceSmokeOptions = {
|
|
132
|
+
callSid?: string;
|
|
133
|
+
path?: false | string;
|
|
134
|
+
scenarioId?: string;
|
|
135
|
+
sessionId?: string;
|
|
136
|
+
sipCode?: number;
|
|
137
|
+
status?: string;
|
|
138
|
+
title?: string;
|
|
139
|
+
};
|
|
140
|
+
export type TwilioVoiceRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = TwilioMediaStreamBridgeOptions<TContext, TSession, TResult> & {
|
|
141
|
+
name?: string;
|
|
142
|
+
outcomePolicy?: VoiceTelephonyOutcomePolicy;
|
|
143
|
+
smoke?: TwilioVoiceSmokeOptions;
|
|
144
|
+
setup?: TwilioVoiceSetupOptions;
|
|
145
|
+
streamPath?: string;
|
|
146
|
+
twiml?: {
|
|
147
|
+
parameters?: TwilioVoiceRouteParameters;
|
|
148
|
+
path?: string;
|
|
149
|
+
streamName?: string;
|
|
150
|
+
streamUrl?: string | ((input: {
|
|
151
|
+
query: Record<string, unknown>;
|
|
152
|
+
request: Request;
|
|
153
|
+
streamPath: string;
|
|
154
|
+
}) => Promise<string> | string);
|
|
155
|
+
track?: TwilioVoiceResponseOptions['track'];
|
|
156
|
+
};
|
|
157
|
+
webhook?: Omit<VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>, 'context' | 'path' | 'policy' | 'provider'> & {
|
|
158
|
+
path?: string;
|
|
159
|
+
policy?: VoiceTelephonyOutcomePolicy;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
110
162
|
export declare const decodeTwilioMulawBase64: (payload: string) => Int16Array<ArrayBuffer>;
|
|
111
163
|
export declare const encodeTwilioMulawBase64: (samples: Int16Array) => string;
|
|
112
164
|
export declare const transcodeTwilioInboundPayloadToPCM16: (payload: string) => Uint8Array<ArrayBuffer>;
|
|
113
165
|
export declare const transcodePCMToTwilioOutboundPayload: (chunk: Uint8Array, format: AudioFormat) => string;
|
|
114
166
|
export declare const createTwilioVoiceResponse: (options: TwilioVoiceResponseOptions) => string;
|
|
115
167
|
export declare const createTwilioMediaStreamBridge: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(socket: TwilioMediaStreamSocket, options: TwilioMediaStreamBridgeOptions<TContext, TSession, TResult>) => TwilioMediaStreamBridge;
|
|
168
|
+
export declare const createTwilioVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: TwilioVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
|
|
169
|
+
decorator: {};
|
|
170
|
+
store: {};
|
|
171
|
+
derive: {};
|
|
172
|
+
resolve: {};
|
|
173
|
+
}, {
|
|
174
|
+
typebox: {};
|
|
175
|
+
error: {};
|
|
176
|
+
}, {
|
|
177
|
+
schema: {};
|
|
178
|
+
standaloneSchema: {};
|
|
179
|
+
macro: {};
|
|
180
|
+
macroFn: {};
|
|
181
|
+
parser: {};
|
|
182
|
+
response: {};
|
|
183
|
+
}, {
|
|
184
|
+
[x: string]: {
|
|
185
|
+
get: {
|
|
186
|
+
body: unknown;
|
|
187
|
+
params: {};
|
|
188
|
+
query: unknown;
|
|
189
|
+
headers: unknown;
|
|
190
|
+
response: {
|
|
191
|
+
200: Response;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
} & {
|
|
196
|
+
[x: string]: {
|
|
197
|
+
post: {
|
|
198
|
+
body: unknown;
|
|
199
|
+
params: {};
|
|
200
|
+
query: unknown;
|
|
201
|
+
headers: unknown;
|
|
202
|
+
response: {
|
|
203
|
+
200: Response;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
} & {
|
|
208
|
+
[x: string]: {
|
|
209
|
+
subscribe: {
|
|
210
|
+
body: unknown;
|
|
211
|
+
params: {};
|
|
212
|
+
query: unknown;
|
|
213
|
+
headers: unknown;
|
|
214
|
+
response: {};
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
} & {
|
|
218
|
+
[x: string]: {
|
|
219
|
+
post: {
|
|
220
|
+
body: unknown;
|
|
221
|
+
params: {};
|
|
222
|
+
query: unknown;
|
|
223
|
+
headers: unknown;
|
|
224
|
+
response: {
|
|
225
|
+
200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
}, {
|
|
230
|
+
derive: {};
|
|
231
|
+
resolve: {};
|
|
232
|
+
schema: {};
|
|
233
|
+
standaloneSchema: {};
|
|
234
|
+
response: {};
|
|
235
|
+
}, {
|
|
236
|
+
derive: {};
|
|
237
|
+
resolve: {};
|
|
238
|
+
schema: {};
|
|
239
|
+
standaloneSchema: {};
|
|
240
|
+
response: {};
|
|
241
|
+
} & {
|
|
242
|
+
derive: {};
|
|
243
|
+
resolve: {};
|
|
244
|
+
schema: {};
|
|
245
|
+
standaloneSchema: {};
|
|
246
|
+
response: {};
|
|
247
|
+
}>;
|
|
116
248
|
export {};
|