@fonoster/common 0.27.0 → 0.30.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.
Files changed (176) hide show
  1. package/dist/assistants/index.d.ts +2 -6
  2. package/dist/assistants/index.js +2 -6
  3. package/dist/assistants/sessionAssistantSchema.d.ts +741 -0
  4. package/dist/assistants/sessionAssistantSchema.js +112 -0
  5. package/dist/assistants/testCasesSchema.d.ts +4 -4
  6. package/dist/{voice/Dial.d.ts → calls/index.d.ts} +16 -13
  7. package/dist/calls/index.js +44 -0
  8. package/dist/cellsecrets/index.d.ts +91 -0
  9. package/dist/cellsecrets/index.js +299 -0
  10. package/dist/config/cli/check.d.ts +6 -0
  11. package/dist/config/cli/check.js +202 -0
  12. package/dist/config/cli/envFile.d.ts +23 -0
  13. package/dist/config/cli/envFile.js +81 -0
  14. package/dist/config/cli/exposure.d.ts +10 -0
  15. package/dist/config/cli/exposure.js +93 -0
  16. package/dist/config/cli/index.d.ts +2 -0
  17. package/dist/{identity/tokenHasAccessKeyId.js → config/cli/index.js} +7 -8
  18. package/dist/config/cli/info.d.ts +6 -0
  19. package/dist/config/cli/info.js +62 -0
  20. package/dist/config/cli/init.d.ts +9 -0
  21. package/dist/config/cli/init.js +152 -0
  22. package/dist/config/cli/main.d.ts +11 -0
  23. package/dist/config/cli/main.js +155 -0
  24. package/dist/config/cli/render.d.ts +44 -0
  25. package/dist/config/cli/render.js +129 -0
  26. package/dist/config/cli/secrets.d.ts +21 -0
  27. package/dist/config/cli/secrets.js +117 -0
  28. package/dist/{utils/findIntegrationsCredentials.d.ts → config/cli/types.d.ts} +6 -5
  29. package/dist/config/cli/types.js +7 -0
  30. package/dist/config/configHints.d.ts +39 -0
  31. package/dist/config/configHints.js +61 -0
  32. package/dist/{voice → config}/index.d.ts +12 -13
  33. package/dist/config/index.js +46 -0
  34. package/dist/config/integrationsSchema.d.ts +32 -0
  35. package/dist/config/integrationsSchema.js +56 -0
  36. package/dist/config/interpolateEnv.d.ts +34 -0
  37. package/dist/config/interpolateEnv.js +70 -0
  38. package/dist/config/loadServiceConfig.d.ts +33 -0
  39. package/dist/config/loadServiceConfig.js +121 -0
  40. package/dist/config/logsSchema.d.ts +76 -0
  41. package/dist/config/logsSchema.js +49 -0
  42. package/dist/config/natsConnection.d.ts +53 -0
  43. package/dist/config/natsConnection.js +58 -0
  44. package/dist/config/parseConfigFile.d.ts +7 -0
  45. package/dist/config/parseConfigFile.js +60 -0
  46. package/dist/config/resolveConfigFile.d.ts +17 -0
  47. package/dist/config/resolveConfigFile.js +54 -0
  48. package/dist/config/resolveSecretRefs.d.ts +35 -0
  49. package/dist/config/resolveSecretRefs.js +129 -0
  50. package/dist/{assistants/audioFiltersSchema.d.ts → config/strictDeep.d.ts} +9 -12
  51. package/dist/config/strictDeep.js +58 -0
  52. package/dist/config/telemetrySchema.d.ts +39 -0
  53. package/dist/config/telemetrySchema.js +44 -0
  54. package/dist/config/toJsonSchema.d.ts +30 -0
  55. package/dist/config/toJsonSchema.js +161 -0
  56. package/dist/constants.d.ts +1 -4
  57. package/dist/constants.js +4 -5
  58. package/dist/envs.d.ts +2 -1
  59. package/dist/envs.js +13 -11
  60. package/dist/identity/createAuthInterceptor.d.ts +9 -2
  61. package/dist/identity/createAuthInterceptor.js +36 -30
  62. package/dist/identity/hasAccess.d.ts +9 -3
  63. package/dist/identity/hasAccess.js +32 -8
  64. package/dist/identity/index.d.ts +1 -0
  65. package/dist/identity/index.js +1 -0
  66. package/dist/identity/isValidToken.d.ts +12 -2
  67. package/dist/identity/isValidToken.js +25 -9
  68. package/dist/identity/roles.js +22 -6
  69. package/dist/identity/types.d.ts +6 -1
  70. package/dist/identity/types.js +1 -0
  71. package/dist/{assistants/LanguageModelProvider.js → identity/verifyAccessToken.d.ts} +10 -11
  72. package/dist/identity/verifyAccessToken.js +44 -0
  73. package/dist/index.d.ts +11 -1
  74. package/dist/index.js +14 -2
  75. package/dist/net/assertPublicDestination.d.ts +52 -0
  76. package/dist/net/assertPublicDestination.js +342 -0
  77. package/dist/{voice/PlayDtmf.d.ts → net/index.d.ts} +1 -5
  78. package/dist/{voice → net}/index.js +1 -13
  79. package/dist/notifications/createSendEmail.js +3 -1
  80. package/dist/protos/applications.proto +124 -3
  81. package/dist/protos/authz.proto +23 -4
  82. package/dist/protos/capabilities.proto +94 -0
  83. package/dist/protos/identity.proto +26 -1
  84. package/dist/protos/providers.proto +135 -0
  85. package/dist/protos/webhooks.proto +140 -0
  86. package/dist/{voice/StopSay.d.ts → regions/hub/index.d.ts} +1 -6
  87. package/dist/regions/hub/index.js +35 -0
  88. package/dist/regions/hub/natsJwt.d.ts +63 -0
  89. package/dist/regions/hub/natsJwt.js +195 -0
  90. package/dist/registry/Registry.d.ts +79 -0
  91. package/dist/registry/Registry.js +418 -0
  92. package/dist/registry/cli.d.ts +20 -0
  93. package/dist/registry/cli.js +424 -0
  94. package/dist/{assistants/audioFiltersSchema.js → registry/features.d.ts} +13 -14
  95. package/dist/registry/features.js +36 -0
  96. package/dist/{assistants/LanguageModelProvider.d.ts → registry/index.d.ts} +6 -8
  97. package/dist/registry/index.js +40 -0
  98. package/dist/registry/prisma.d.ts +67 -0
  99. package/dist/registry/prisma.js +391 -0
  100. package/dist/registry/stores.d.ts +21 -0
  101. package/dist/{assistants/eventsHookSchema.js → registry/stores.js} +55 -18
  102. package/dist/registry/types.d.ts +98 -0
  103. package/dist/{voice/Say.d.ts → registry/types.js} +4 -10
  104. package/dist/registry/workspaceKeys.d.ts +41 -0
  105. package/dist/registry/workspaceKeys.js +64 -0
  106. package/dist/session/index.d.ts +19 -0
  107. package/dist/session/index.js +35 -0
  108. package/dist/session/schema.d.ts +1951 -0
  109. package/dist/session/schema.js +397 -0
  110. package/dist/sessions/index.d.ts +93 -0
  111. package/dist/sessions/index.js +194 -0
  112. package/dist/telemetry.d.ts +76 -0
  113. package/dist/telemetry.js +360 -0
  114. package/dist/types.d.ts +3 -5
  115. package/dist/utils/{findIntegrationsCredentials.js → WriteBehind.d.ts} +13 -10
  116. package/dist/utils/WriteBehind.js +64 -0
  117. package/dist/utils/index.d.ts +1 -1
  118. package/dist/utils/index.js +1 -1
  119. package/dist/{voice/Play.d.ts → utils/logUnhandledRejections.d.ts} +8 -12
  120. package/dist/utils/logUnhandledRejections.js +37 -0
  121. package/dist/validators/calls.d.ts +2 -2
  122. package/dist/validators/calls.js +5 -2
  123. package/dist/validators/identity.d.ts +37 -8
  124. package/dist/validators/identity.js +22 -3
  125. package/dist/validators/index.d.ts +1 -0
  126. package/dist/validators/index.js +1 -0
  127. package/dist/validators/sip.d.ts +40 -0
  128. package/dist/validators/sip.js +99 -0
  129. package/dist/validators/sipnet/credentials.d.ts +2 -2
  130. package/dist/validators/sipnet/domains.js +7 -7
  131. package/dist/validators/sipnet/trunks.d.ts +14 -14
  132. package/dist/validators/sipnet/trunks.js +4 -2
  133. package/dist/webhooks/Dispatcher.d.ts +87 -0
  134. package/dist/webhooks/Dispatcher.js +225 -0
  135. package/dist/webhooks/bus.d.ts +49 -0
  136. package/dist/webhooks/bus.js +170 -0
  137. package/dist/webhooks/events.d.ts +66 -0
  138. package/dist/webhooks/events.js +62 -0
  139. package/dist/webhooks/index.d.ts +23 -0
  140. package/dist/webhooks/index.js +39 -0
  141. package/dist/webhooks/prisma.d.ts +55 -0
  142. package/dist/webhooks/prisma.js +242 -0
  143. package/dist/webhooks/signing.d.ts +8 -0
  144. package/dist/webhooks/signing.js +53 -0
  145. package/package.json +25 -12
  146. package/schema/session.v1.json +791 -0
  147. package/dist/assistants/assistantSchema.d.ts +0 -739
  148. package/dist/assistants/assistantSchema.js +0 -37
  149. package/dist/assistants/conversationSettingsSchema.d.ts +0 -122
  150. package/dist/assistants/conversationSettingsSchema.js +0 -133
  151. package/dist/assistants/eventsHookSchema.d.ts +0 -38
  152. package/dist/assistants/languageModelConfigSchema.d.ts +0 -206
  153. package/dist/assistants/languageModelConfigSchema.js +0 -91
  154. package/dist/identity/tokenHasAccessKeyId.d.ts +0 -2
  155. package/dist/protos/voice.proto +0 -557
  156. package/dist/voice/Dial.js +0 -20
  157. package/dist/voice/Gather.d.ts +0 -37
  158. package/dist/voice/Gather.js +0 -9
  159. package/dist/voice/Mute.d.ts +0 -31
  160. package/dist/voice/Mute.js +0 -9
  161. package/dist/voice/Play.js +0 -2
  162. package/dist/voice/PlayDtmf.js +0 -2
  163. package/dist/voice/PlaybackControl.d.ts +0 -31
  164. package/dist/voice/PlaybackControl.js +0 -11
  165. package/dist/voice/Record.d.ts +0 -36
  166. package/dist/voice/Record.js +0 -7
  167. package/dist/voice/Say.js +0 -2
  168. package/dist/voice/StopSay.js +0 -2
  169. package/dist/voice/Stream.d.ts +0 -53
  170. package/dist/voice/Stream.js +0 -19
  171. package/dist/voice/StreamGather.d.ts +0 -34
  172. package/dist/voice/StreamGather.js +0 -9
  173. package/dist/voice/Verb.d.ts +0 -27
  174. package/dist/voice/Verb.js +0 -2
  175. package/dist/voice/voice.d.ts +0 -171
  176. package/dist/voice/voice.js +0 -65
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlaybackControlAction = void 0;
4
- var PlaybackControlAction;
5
- (function (PlaybackControlAction) {
6
- PlaybackControlAction["STOP"] = "STOP";
7
- PlaybackControlAction["RESTART"] = "RESTART";
8
- PlaybackControlAction["PAUSE"] = "PAUSE";
9
- PlaybackControlAction["UNPAUSE"] = "UNPAUSE";
10
- PlaybackControlAction["FORWARD"] = "FORWARD";
11
- })(PlaybackControlAction || (exports.PlaybackControlAction = PlaybackControlAction = {}));
@@ -1,36 +0,0 @@
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 { VerbRequest } from "./Verb";
20
- declare enum RecordFormat {
21
- WAV = "wav"
22
- }
23
- type RecordOptions = {
24
- maxDuration?: number;
25
- maxSilence?: number;
26
- beep?: boolean;
27
- finishOnKey?: string;
28
- };
29
- type RecordRequest = VerbRequest & RecordOptions;
30
- type RecordResponse = {
31
- mediaSessionRef: string;
32
- name: string;
33
- duration: number;
34
- format: RecordFormat;
35
- };
36
- export { RecordFormat, RecordOptions, RecordRequest, RecordResponse };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecordFormat = void 0;
4
- var RecordFormat;
5
- (function (RecordFormat) {
6
- RecordFormat["WAV"] = "wav";
7
- })(RecordFormat || (exports.RecordFormat = RecordFormat = {}));
package/dist/voice/Say.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,53 +0,0 @@
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 { VerbRequest, VerbResponse } from "./Verb";
20
- declare enum StreamDirection {
21
- IN = "IN",
22
- OUT = "OUT",
23
- BOTH = "BOTH"
24
- }
25
- declare enum StreamAudioFormat {
26
- WAV = "WAV"
27
- }
28
- declare enum StreamMessageType {
29
- AUDIO_IN = "AUDIO_IN",
30
- AUDIO_OUT = "AUDIO_OUT",
31
- ERROR = "ERROR"
32
- }
33
- type StreamOptions = {
34
- direction?: StreamDirection;
35
- format?: StreamAudioFormat;
36
- };
37
- type StartStreamRequest = VerbRequest & StreamOptions;
38
- type StartStreamResponse = VerbResponse & {
39
- streamRef: string;
40
- };
41
- type StopStreamRequest = VerbRequest & {
42
- streamRef: string;
43
- };
44
- type StreamPayload = {
45
- mediaSessionRef: string;
46
- streamRef: string;
47
- format: StreamAudioFormat;
48
- type: StreamMessageType;
49
- data?: Uint8Array;
50
- code?: string;
51
- message?: string;
52
- };
53
- export { StartStreamRequest, StartStreamResponse, StopStreamRequest, StreamAudioFormat, StreamDirection, StreamMessageType, StreamOptions, StreamPayload };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamMessageType = exports.StreamDirection = exports.StreamAudioFormat = void 0;
4
- var StreamDirection;
5
- (function (StreamDirection) {
6
- StreamDirection["IN"] = "IN";
7
- StreamDirection["OUT"] = "OUT";
8
- StreamDirection["BOTH"] = "BOTH";
9
- })(StreamDirection || (exports.StreamDirection = StreamDirection = {}));
10
- var StreamAudioFormat;
11
- (function (StreamAudioFormat) {
12
- StreamAudioFormat["WAV"] = "WAV";
13
- })(StreamAudioFormat || (exports.StreamAudioFormat = StreamAudioFormat = {}));
14
- var StreamMessageType;
15
- (function (StreamMessageType) {
16
- StreamMessageType["AUDIO_IN"] = "AUDIO_IN";
17
- StreamMessageType["AUDIO_OUT"] = "AUDIO_OUT";
18
- StreamMessageType["ERROR"] = "ERROR";
19
- })(StreamMessageType || (exports.StreamMessageType = StreamMessageType = {}));
@@ -1,34 +0,0 @@
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 { VerbRequest, VerbResponse } from "./Verb";
20
- declare enum StreamGatherSource {
21
- SPEECH = "speech",
22
- DTMF = "dtmf",
23
- SPEECH_AND_DTMF = "speech,dtmf"
24
- }
25
- type StreamGatherOptions = {
26
- source?: StreamGatherSource;
27
- };
28
- type StartStreamGatherRequest = VerbRequest & StreamGatherOptions;
29
- type StreamGatherPayload = VerbResponse & {
30
- speech?: string;
31
- digit?: string;
32
- responseTime: number;
33
- };
34
- export { StartStreamGatherRequest, StreamGatherOptions, StreamGatherPayload, StreamGatherSource };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamGatherSource = void 0;
4
- var StreamGatherSource;
5
- (function (StreamGatherSource) {
6
- StreamGatherSource["SPEECH"] = "speech";
7
- StreamGatherSource["DTMF"] = "dtmf";
8
- StreamGatherSource["SPEECH_AND_DTMF"] = "speech,dtmf";
9
- })(StreamGatherSource || (exports.StreamGatherSource = StreamGatherSource = {}));
@@ -1,27 +0,0 @@
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 { VoiceClientConfig } from "./voice";
20
- type VoiceRequest = VoiceClientConfig;
21
- type VerbRequest = {
22
- mediaSessionRef: string;
23
- };
24
- type VerbResponse = {
25
- mediaSessionRef: string;
26
- };
27
- export { VerbRequest, VerbResponse, VoiceRequest };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,171 +0,0 @@
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 { CallDirection } from "@fonoster/types";
20
- import { GrpcError } from "../GrpcError";
21
- import { DialRequest, DialStatus } from "./Dial";
22
- import { GatherRequest, GatherResponse } from "./Gather";
23
- import { MuteRequest } from "./Mute";
24
- import { PlayRequest, PlayResponse } from "./Play";
25
- import { PlayDtmfRequest } from "./PlayDtmf";
26
- import { RecordRequest, RecordResponse } from "./Record";
27
- import { SayRequest } from "./Say";
28
- import { StopSayRequest } from "./StopSay";
29
- import { StartStreamRequest, StartStreamResponse, StopStreamRequest, StreamPayload } from "./Stream";
30
- import { StartStreamGatherRequest, StreamGatherPayload } from "./StreamGather";
31
- import { VerbRequest, VerbResponse, VoiceRequest } from "./Verb";
32
- declare const DATA = "data";
33
- declare const END = "end";
34
- declare const ERROR = "error";
35
- declare enum StreamEvent {
36
- DATA = "data",
37
- END = "end",
38
- ERROR = "error"
39
- }
40
- declare enum StreamContent {
41
- ANSWER_REQUEST = "answerRequest",
42
- ANSWER_RESPONSE = "answerResponse",
43
- HANGUP_REQUEST = "hangupRequest",
44
- HANGUP_RESPONSE = "hangupResponse",
45
- PLAY_REQUEST = "playRequest",
46
- PLAY_RESPONSE = "playResponse",
47
- PLAY_DTMF_REQUEST = "playDtmfRequest",
48
- PLAY_DTMF_RESPONSE = "playDtmfResponse",
49
- PLAYBACK_CONTROL_REQUEST = "playbackControlRequest",
50
- PLAYBACK_CONTROL_RESPONSE = "playbackControlResponse",
51
- MUTE_REQUEST = "muteRequest",
52
- MUTE_RESPONSE = "muteResponse",
53
- UNMUTE_REQUEST = "unmuteRequest",
54
- UNMUTE_RESPONSE = "unmuteResponse",
55
- GATHER_REQUEST = "gatherRequest",
56
- GATHER_RESPONSE = "gatherResponse",
57
- SAY_REQUEST = "sayRequest",
58
- SAY_RESPONSE = "sayResponse",
59
- RECORD_REQUEST = "recordRequest",
60
- RECORD_RESPONSE = "recordResponse",
61
- DIAL_REQUEST = "dialRequest",
62
- DIAL_RESPONSE = "dialResponse",
63
- START_STREAM_REQUEST = "startStreamRequest",
64
- START_STREAM_RESPONSE = "startStreamResponse",
65
- STOP_STREAM_REQUEST = "stopStreamRequest",
66
- STOP_STREAM_RESPONSE = "stopStreamResponse",
67
- STOP_SAY_REQUEST = "stopSayRequest",
68
- STOP_SAY_RESPONSE = "stopSayResponse",
69
- STREAM_PAYLOAD = "streamPayload",
70
- START_STREAM_GATHER_REQUEST = "startStreamGatherRequest",
71
- START_STREAM_GATHER_RESPONSE = "startStreamGatherResponse",
72
- STOP_STREAM_GATHER_REQUEST = "stopStreamGatherRequest",
73
- STOP_STREAM_GATHER_RESPONSE = "stopStreamGatherResponse",
74
- STREAM_GATHER_PAYLOAD = "streamGatherPayload",
75
- SET_AUDIO_FILTERS_REQUEST = "setAudioFiltersRequest",
76
- SET_AUDIO_FILTERS_RESPONSE = "setAudioFiltersResponse"
77
- }
78
- type AudioFilterConfig = {
79
- name: string;
80
- options?: Record<string, unknown>;
81
- };
82
- type SetAudioFiltersRequest = {
83
- mediaSessionRef: string;
84
- filters: AudioFilterConfig[];
85
- };
86
- type SetAudioFiltersResponse = {
87
- mediaSessionRef: string;
88
- error?: string;
89
- };
90
- declare enum AmdStatus {
91
- UNSPECIFIED = "AMD_STATUS_UNSPECIFIED",
92
- HUMAN = "HUMAN",
93
- MACHINE = "MACHINE",
94
- VOICEMAIL = "VOICEMAIL",
95
- IVR = "IVR",
96
- UNKNOWN = "UNKNOWN"
97
- }
98
- type Amd = {
99
- status: AmdStatus;
100
- confidence: number;
101
- detector: string;
102
- latencyMs: number;
103
- };
104
- type VoiceClientConfig = {
105
- appRef: string;
106
- accessKeyId: string;
107
- endpoint: string;
108
- ingressNumber: string;
109
- callerName: string;
110
- callerNumber: string;
111
- mediaSessionRef: string;
112
- callRef: string;
113
- sessionToken: string;
114
- callDirection: CallDirection;
115
- metadata?: Record<string, string>;
116
- amd?: Amd;
117
- };
118
- type VoiceIn = {
119
- request?: VoiceRequest;
120
- content?: StreamContent;
121
- answerResponse?: VerbResponse;
122
- hangupResponse?: VerbResponse;
123
- playResponse?: PlayResponse;
124
- playDtmfResponse?: VerbResponse;
125
- playbackControlResponse?: VerbResponse;
126
- muteResponse?: VerbResponse;
127
- unmuteResponse?: VerbResponse;
128
- gatherResponse?: GatherResponse;
129
- sayResponse?: VerbResponse;
130
- recordResponse?: RecordResponse;
131
- dialResponse?: {
132
- status: DialStatus;
133
- };
134
- startStreamResponse?: StartStreamResponse;
135
- streamPayload?: StreamPayload;
136
- streamGatherPayload?: StreamGatherPayload;
137
- startStreamGatherResponse?: VerbResponse;
138
- stopStreamGatherResponse?: VerbResponse;
139
- stopSayResponse?: VerbResponse;
140
- setAudioFiltersResponse?: SetAudioFiltersResponse;
141
- };
142
- type VoiceOut = {
143
- answerRequest?: VerbRequest;
144
- hangupRequest?: VerbRequest;
145
- playRequest?: PlayRequest;
146
- playDtmfRequest?: PlayDtmfRequest;
147
- playbackControlRequest?: VerbRequest;
148
- muteRequest?: MuteRequest;
149
- unmuteRequest?: MuteRequest;
150
- gatherRequest?: GatherRequest;
151
- sayRequest?: SayRequest;
152
- recordRequest?: RecordRequest;
153
- dialRequest?: DialRequest;
154
- startStreamRequest?: StartStreamRequest;
155
- stopStreamRequest?: StopStreamRequest;
156
- streamPayload?: StreamPayload;
157
- startStreamGatherRequest?: StartStreamGatherRequest;
158
- stopStreamGatherRequest?: VerbRequest;
159
- stopSayRequest?: StopSayRequest;
160
- setAudioFiltersRequest?: SetAudioFiltersRequest;
161
- };
162
- type BaseVoiceStream<T, W> = {
163
- removeListener: (e: StreamEvent, cb: (voice: T) => void) => void;
164
- on: (e: StreamEvent, cb: (voice: T) => void) => void;
165
- once: (e: StreamEvent, cb: (voice: T) => void) => void;
166
- write: (voice: W) => void;
167
- end: () => void;
168
- };
169
- type VoiceSessionStreamServer = BaseVoiceStream<VoiceIn, VoiceOut>;
170
- type VoiceSessionStreamClient = BaseVoiceStream<VoiceOut | GrpcError, VoiceIn | GrpcError>;
171
- export { Amd, AmdStatus, AudioFilterConfig, DATA, END, ERROR, SetAudioFiltersRequest, SetAudioFiltersResponse, StreamContent, StreamEvent, VoiceClientConfig, VoiceIn, VoiceOut, VoiceSessionStreamClient, VoiceSessionStreamServer };
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamEvent = exports.StreamContent = exports.ERROR = exports.END = exports.DATA = exports.AmdStatus = void 0;
4
- const DATA = "data";
5
- exports.DATA = DATA;
6
- const END = "end";
7
- exports.END = END;
8
- const ERROR = "error";
9
- exports.ERROR = ERROR;
10
- var StreamEvent;
11
- (function (StreamEvent) {
12
- StreamEvent["DATA"] = "data";
13
- StreamEvent["END"] = "end";
14
- StreamEvent["ERROR"] = "error";
15
- })(StreamEvent || (exports.StreamEvent = StreamEvent = {}));
16
- var StreamContent;
17
- (function (StreamContent) {
18
- StreamContent["ANSWER_REQUEST"] = "answerRequest";
19
- StreamContent["ANSWER_RESPONSE"] = "answerResponse";
20
- StreamContent["HANGUP_REQUEST"] = "hangupRequest";
21
- StreamContent["HANGUP_RESPONSE"] = "hangupResponse";
22
- StreamContent["PLAY_REQUEST"] = "playRequest";
23
- StreamContent["PLAY_RESPONSE"] = "playResponse";
24
- StreamContent["PLAY_DTMF_REQUEST"] = "playDtmfRequest";
25
- StreamContent["PLAY_DTMF_RESPONSE"] = "playDtmfResponse";
26
- StreamContent["PLAYBACK_CONTROL_REQUEST"] = "playbackControlRequest";
27
- StreamContent["PLAYBACK_CONTROL_RESPONSE"] = "playbackControlResponse";
28
- StreamContent["MUTE_REQUEST"] = "muteRequest";
29
- StreamContent["MUTE_RESPONSE"] = "muteResponse";
30
- StreamContent["UNMUTE_REQUEST"] = "unmuteRequest";
31
- StreamContent["UNMUTE_RESPONSE"] = "unmuteResponse";
32
- StreamContent["GATHER_REQUEST"] = "gatherRequest";
33
- StreamContent["GATHER_RESPONSE"] = "gatherResponse";
34
- StreamContent["SAY_REQUEST"] = "sayRequest";
35
- StreamContent["SAY_RESPONSE"] = "sayResponse";
36
- StreamContent["RECORD_REQUEST"] = "recordRequest";
37
- StreamContent["RECORD_RESPONSE"] = "recordResponse";
38
- StreamContent["DIAL_REQUEST"] = "dialRequest";
39
- StreamContent["DIAL_RESPONSE"] = "dialResponse";
40
- StreamContent["START_STREAM_REQUEST"] = "startStreamRequest";
41
- StreamContent["START_STREAM_RESPONSE"] = "startStreamResponse";
42
- StreamContent["STOP_STREAM_REQUEST"] = "stopStreamRequest";
43
- StreamContent["STOP_STREAM_RESPONSE"] = "stopStreamResponse";
44
- StreamContent["STOP_SAY_REQUEST"] = "stopSayRequest";
45
- StreamContent["STOP_SAY_RESPONSE"] = "stopSayResponse";
46
- StreamContent["STREAM_PAYLOAD"] = "streamPayload";
47
- StreamContent["START_STREAM_GATHER_REQUEST"] = "startStreamGatherRequest";
48
- StreamContent["START_STREAM_GATHER_RESPONSE"] = "startStreamGatherResponse";
49
- StreamContent["STOP_STREAM_GATHER_REQUEST"] = "stopStreamGatherRequest";
50
- StreamContent["STOP_STREAM_GATHER_RESPONSE"] = "stopStreamGatherResponse";
51
- StreamContent["STREAM_GATHER_PAYLOAD"] = "streamGatherPayload";
52
- StreamContent["SET_AUDIO_FILTERS_REQUEST"] = "setAudioFiltersRequest";
53
- StreamContent["SET_AUDIO_FILTERS_RESPONSE"] = "setAudioFiltersResponse";
54
- })(StreamContent || (exports.StreamContent = StreamContent = {}));
55
- // Answering Machine Detection verdict. String values match the proto enum value
56
- // names so the object round-trips through @grpc/proto-loader (enums: String).
57
- var AmdStatus;
58
- (function (AmdStatus) {
59
- AmdStatus["UNSPECIFIED"] = "AMD_STATUS_UNSPECIFIED";
60
- AmdStatus["HUMAN"] = "HUMAN";
61
- AmdStatus["MACHINE"] = "MACHINE";
62
- AmdStatus["VOICEMAIL"] = "VOICEMAIL";
63
- AmdStatus["IVR"] = "IVR";
64
- AmdStatus["UNKNOWN"] = "UNKNOWN";
65
- })(AmdStatus || (exports.AmdStatus = AmdStatus = {}));