@fonoster/voice 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.
Files changed (64) hide show
  1. package/README.md +32 -419
  2. package/dist/Session.d.ts +161 -0
  3. package/dist/Session.js +576 -0
  4. package/dist/VoiceServer.d.ts +70 -5
  5. package/dist/VoiceServer.js +149 -43
  6. package/dist/{verbs/Dial.d.ts → errors.d.ts} +9 -13
  7. package/dist/{verbs/Answer.js → errors.js} +18 -7
  8. package/dist/index.d.ts +4 -6
  9. package/dist/index.js +4 -15
  10. package/dist/signature.d.ts +31 -0
  11. package/dist/signature.js +93 -0
  12. package/dist/types.d.ts +88 -10
  13. package/dist/types.js +0 -21
  14. package/package.json +13 -19
  15. package/session.d.ts +1 -0
  16. package/session.js +2 -0
  17. package/dist/VoiceResponse.d.ts +0 -304
  18. package/dist/VoiceResponse.js +0 -461
  19. package/dist/createSession.d.ts +0 -22
  20. package/dist/createSession.js +0 -66
  21. package/dist/defaultServerConfig.d.ts +0 -21
  22. package/dist/defaultServerConfig.js +0 -10
  23. package/dist/demo.d.ts +0 -1
  24. package/dist/demo.js +0 -83
  25. package/dist/filters.d.ts +0 -44
  26. package/dist/filters.js +0 -17
  27. package/dist/serviceDefinition.d.ts +0 -2
  28. package/dist/serviceDefinition.js +0 -29
  29. package/dist/verbs/Answer.d.ts +0 -24
  30. package/dist/verbs/Dial.js +0 -60
  31. package/dist/verbs/Gather.d.ts +0 -25
  32. package/dist/verbs/Gather.js +0 -57
  33. package/dist/verbs/Hangup.d.ts +0 -24
  34. package/dist/verbs/Hangup.js +0 -29
  35. package/dist/verbs/Mute.d.ts +0 -25
  36. package/dist/verbs/Mute.js +0 -36
  37. package/dist/verbs/Play.d.ts +0 -25
  38. package/dist/verbs/Play.js +0 -33
  39. package/dist/verbs/PlayDtmf.d.ts +0 -25
  40. package/dist/verbs/PlayDtmf.js +0 -32
  41. package/dist/verbs/PlaybackControl.d.ts +0 -25
  42. package/dist/verbs/PlaybackControl.js +0 -35
  43. package/dist/verbs/Record.d.ts +0 -25
  44. package/dist/verbs/Record.js +0 -49
  45. package/dist/verbs/Say.d.ts +0 -25
  46. package/dist/verbs/Say.js +0 -33
  47. package/dist/verbs/SetAudioFilters.d.ts +0 -25
  48. package/dist/verbs/SetAudioFilters.js +0 -16
  49. package/dist/verbs/StopSay.d.ts +0 -25
  50. package/dist/verbs/StopSay.js +0 -11
  51. package/dist/verbs/Stream.d.ts +0 -39
  52. package/dist/verbs/Stream.js +0 -80
  53. package/dist/verbs/StreamGather.d.ts +0 -37
  54. package/dist/verbs/StreamGather.js +0 -66
  55. package/dist/verbs/Unmute.d.ts +0 -22
  56. package/dist/verbs/Unmute.js +0 -26
  57. package/dist/verbs/Verb.d.ts +0 -28
  58. package/dist/verbs/Verb.js +0 -103
  59. package/dist/verbs/getExpectedContent.d.ts +0 -2
  60. package/dist/verbs/getExpectedContent.js +0 -32
  61. package/dist/verbs/index.d.ts +0 -35
  62. package/dist/verbs/index.js +0 -51
  63. package/dist/verbs/validateRequest.d.ts +0 -20
  64. package/dist/verbs/validateRequest.js +0 -13
package/dist/verbs/Say.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Say = void 0;
4
- /**
5
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/fonoster
7
- *
8
- * This file is part of Fonoster
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const common_1 = require("@fonoster/common");
23
- const zod_1 = require("zod");
24
- const Verb_1 = require("./Verb");
25
- class Say extends Verb_1.Verb {
26
- getValidationSchema() {
27
- return zod_1.z.object({
28
- text: zod_1.z.string().min(1),
29
- playbackRef: zod_1.z.string().uuid({ message: common_1.Messages.VALID_UUID }).optional()
30
- });
31
- }
32
- }
33
- exports.Say = Say;
@@ -1,25 +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 { SetAudioFiltersRequest } from "@fonoster/common";
20
- import { z } from "zod";
21
- import { Verb } from "./Verb";
22
- declare class SetAudioFilters extends Verb<SetAudioFiltersRequest> {
23
- getValidationSchema(): z.Schema;
24
- }
25
- export { SetAudioFilters };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetAudioFilters = void 0;
4
- const zod_1 = require("zod");
5
- const Verb_1 = require("./Verb");
6
- class SetAudioFilters extends Verb_1.Verb {
7
- getValidationSchema() {
8
- return zod_1.z.object({
9
- filters: zod_1.z.array(zod_1.z.object({
10
- name: zod_1.z.string().min(1, { message: "A filter name is required" }),
11
- options: zod_1.z.record(zod_1.z.unknown()).optional()
12
- }))
13
- });
14
- }
15
- }
16
- exports.SetAudioFilters = SetAudioFilters;
@@ -1,25 +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 { StopSayRequest } from "@fonoster/common";
20
- import { z } from "zod";
21
- import { Verb } from "./Verb";
22
- declare class StopSay extends Verb<StopSayRequest> {
23
- getValidationSchema(): z.Schema;
24
- }
25
- export { StopSay };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StopSay = void 0;
4
- const zod_1 = require("zod");
5
- const Verb_1 = require("./Verb");
6
- class StopSay extends Verb_1.Verb {
7
- getValidationSchema() {
8
- return zod_1.z.object({});
9
- }
10
- }
11
- exports.StopSay = StopSay;
@@ -1,39 +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 { Stream as StreamObj } from "stream";
20
- import { StartStreamRequest, StopStreamRequest, StreamPayload } from "@fonoster/common";
21
- import { z } from "zod";
22
- import { Verb } from "./Verb";
23
- declare class StartStream extends Verb<StartStreamRequest> {
24
- getValidationSchema(): z.Schema;
25
- }
26
- declare class StopStream extends Verb<StopStreamRequest> {
27
- getValidationSchema(): z.Schema;
28
- }
29
- declare class Stream {
30
- stream: StreamObj;
31
- constructor();
32
- close(): void;
33
- onPayload(callback: (payload: StreamPayload) => void): void;
34
- write(payload: StreamPayload): void;
35
- onPayloadIn(callback: (payload: StreamPayload) => void): void;
36
- emit(event: "payloadIn" | "payloadOut", payload: StreamPayload): void;
37
- cleanup(callback: () => void): void;
38
- }
39
- export { StartStream, StopStream, Stream };
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Stream = exports.StopStream = exports.StartStream = void 0;
4
- /**
5
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/fonoster
7
- *
8
- * This file is part of Fonoster
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const stream_1 = require("stream");
23
- const common_1 = require("@fonoster/common");
24
- const zod_1 = require("zod");
25
- const Verb_1 = require("./Verb");
26
- class StartStream extends Verb_1.Verb {
27
- getValidationSchema() {
28
- return zod_1.z.object({
29
- direction: zod_1.z
30
- .nativeEnum(common_1.StreamDirection, { message: "Invalid stream direction" })
31
- .optional(),
32
- format: zod_1.z
33
- .nativeEnum(common_1.StreamAudioFormat, {
34
- message: "Invalid stream audio direction"
35
- })
36
- .optional()
37
- });
38
- }
39
- }
40
- exports.StartStream = StartStream;
41
- class StopStream extends Verb_1.Verb {
42
- getValidationSchema() {
43
- return zod_1.z.object({
44
- streamRef: zod_1.z.string().uuid({ message: common_1.Messages.VALID_UUID })
45
- });
46
- }
47
- }
48
- exports.StopStream = StopStream;
49
- class Stream {
50
- constructor() {
51
- this.stream = new stream_1.Stream();
52
- }
53
- close() {
54
- this.stream.removeAllListeners();
55
- }
56
- // Public API
57
- onPayload(callback) {
58
- this.stream.on("payloadOut", (payload) => {
59
- callback(payload);
60
- });
61
- }
62
- write(payload) {
63
- this.stream.emit("payloadIn", payload);
64
- }
65
- // Private API
66
- onPayloadIn(callback) {
67
- this.stream.on("payloadIn", (payload) => {
68
- callback(payload);
69
- });
70
- }
71
- // Private API
72
- emit(event, payload) {
73
- this.stream.emit(event, payload);
74
- }
75
- // Private API
76
- cleanup(callback) {
77
- this.stream.on("close", callback);
78
- }
79
- }
80
- exports.Stream = Stream;
@@ -1,37 +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 { Stream as StreamObj } from "stream";
20
- import { StartStreamGatherRequest, StreamGatherPayload, VerbRequest } from "@fonoster/common";
21
- import { z } from "zod";
22
- import { Verb } from "./Verb";
23
- declare class StartStreamGather extends Verb<StartStreamGatherRequest> {
24
- getValidationSchema(): z.Schema;
25
- }
26
- declare class StopStreamGather extends Verb<VerbRequest> {
27
- getValidationSchema(): z.Schema;
28
- }
29
- declare class StreamGatherStream {
30
- stream: StreamObj;
31
- constructor();
32
- close(): void;
33
- onPayload(callback: (payload: StreamGatherPayload) => void): void;
34
- emit(event: "data", payload: StreamGatherPayload): void;
35
- cleanup(callback: () => void): void;
36
- }
37
- export { StartStreamGather, StopStreamGather, StreamGatherStream };
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamGatherStream = exports.StopStreamGather = exports.StartStreamGather = void 0;
4
- /**
5
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/fonoster
7
- *
8
- * This file is part of Fonoster
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const stream_1 = require("stream");
23
- const common_1 = require("@fonoster/common");
24
- const zod_1 = require("zod");
25
- const Verb_1 = require("./Verb");
26
- class StartStreamGather extends Verb_1.Verb {
27
- getValidationSchema() {
28
- return zod_1.z.object({
29
- source: zod_1.z.optional(zod_1.z.nativeEnum(common_1.StreamGatherSource, {
30
- message: "Invalid stream gather source."
31
- }))
32
- });
33
- }
34
- }
35
- exports.StartStreamGather = StartStreamGather;
36
- class StopStreamGather extends Verb_1.Verb {
37
- getValidationSchema() {
38
- return zod_1.z.object({
39
- sessionRef: zod_1.z.string().uuid({ message: common_1.Messages.VALID_UUID })
40
- });
41
- }
42
- }
43
- exports.StopStreamGather = StopStreamGather;
44
- class StreamGatherStream {
45
- constructor() {
46
- this.stream = new stream_1.Stream();
47
- }
48
- close() {
49
- this.stream.removeAllListeners();
50
- }
51
- // Private API
52
- onPayload(callback) {
53
- this.stream.on("data", (payload) => {
54
- callback(payload);
55
- });
56
- }
57
- // Private API
58
- emit(event, payload) {
59
- this.stream.emit(event, payload);
60
- }
61
- // Private API
62
- cleanup(callback) {
63
- this.stream.on("close", callback);
64
- }
65
- }
66
- exports.StreamGatherStream = StreamGatherStream;
@@ -1,22 +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 { Mute } from "./Mute";
20
- declare class Unmute extends Mute {
21
- }
22
- export { Unmute };
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unmute = void 0;
4
- /**
5
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/fonoster
7
- *
8
- * This file is part of Fonoster
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const Mute_1 = require("./Mute");
23
- // Shares everything with Mute except the class name
24
- class Unmute extends Mute_1.Mute {
25
- }
26
- exports.Unmute = Unmute;
@@ -1,28 +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, VoiceIn, VoiceRequest, VoiceSessionStreamServer } from "@fonoster/common";
20
- import { z } from "zod";
21
- declare abstract class Verb<T extends VerbRequest = VerbRequest> {
22
- request: VoiceRequest;
23
- voice: VoiceSessionStreamServer;
24
- constructor(request: VoiceRequest, voice: VoiceSessionStreamServer);
25
- run(params?: T): Promise<VoiceIn>;
26
- abstract getValidationSchema(): z.Schema;
27
- }
28
- export { Verb };
@@ -1,103 +0,0 @@
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.Verb = void 0;
13
- /**
14
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
- * http://github.com/fonoster/fonoster
16
- *
17
- * This file is part of Fonoster
18
- *
19
- * Licensed under the MIT License (the "License");
20
- * you may not use this file except in compliance with
21
- * the License. You may obtain a copy of the License at
22
- *
23
- * https://opensource.org/licenses/MIT
24
- *
25
- * Unless required by applicable law or agreed to in writing, software
26
- * distributed under the License is distributed on an "AS IS" BASIS,
27
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
- * See the License for the specific language governing permissions and
29
- * limitations under the License.
30
- */
31
- const common_1 = require("@fonoster/common");
32
- const logger_1 = require("@fonoster/logger");
33
- const getExpectedContent_1 = require("./getExpectedContent");
34
- const validateRequest_1 = require("./validateRequest");
35
- const logger = (0, logger_1.getLogger)({ service: "voice", filePath: __filename });
36
- class Verb {
37
- constructor(request, voice) {
38
- this.request = request;
39
- this.voice = voice;
40
- }
41
- run(params) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- const { mediaSessionRef } = this.request;
44
- const { voice } = this;
45
- logger.verbose(`sending a request with the ${this.constructor.name} verb`, {
46
- mediaSessionRef
47
- });
48
- return new Promise((resolve, reject) => {
49
- // Every exit path must remove all three listeners. A verb shares the session
50
- // stream with every other verb in the call, so anything left attached
51
- // accumulates for the lifetime of the session.
52
- const cleanup = () => {
53
- voice.removeListener(common_1.StreamEvent.DATA, dataListener);
54
- voice.removeListener(common_1.StreamEvent.END, endListener);
55
- voice.removeListener(common_1.StreamEvent.ERROR, errorListener);
56
- };
57
- const dataListener = (result) => {
58
- const expectedContent = (0, getExpectedContent_1.getExpectedContent)(this.constructor.name);
59
- if (expectedContent !== result.content) {
60
- return;
61
- }
62
- logger.verbose(`received ${this.constructor.name} response`, {
63
- mediaSessionRef
64
- });
65
- cleanup();
66
- resolve(result);
67
- };
68
- // Without these the promise has exactly one exit: a matching response. When the
69
- // session dies first — the caller hangs up mid-verb, or the transport fails —
70
- // it is left pending forever, neither resolved nor rejected. The application
71
- // then awaits a verb that can never complete and the call is stranded rather
72
- // than failed.
73
- const endListener = () => {
74
- cleanup();
75
- reject(new Error(`voice session ended before the ${this.constructor.name} verb completed`));
76
- };
77
- const errorListener = (error) => {
78
- cleanup();
79
- reject(error instanceof Error
80
- ? error
81
- : new Error(`voice session failed during the ${this.constructor.name} verb: ${error}`));
82
- };
83
- try {
84
- const fullRequest = Object.assign(Object.assign({}, params), { mediaSessionRef });
85
- (0, validateRequest_1.validateRequest)(this.getValidationSchema(), fullRequest);
86
- // Listen before writing: a response cannot be delivered to a listener that
87
- // does not exist yet.
88
- voice.on(common_1.StreamEvent.DATA, dataListener);
89
- voice.on(common_1.StreamEvent.END, endListener);
90
- voice.on(common_1.StreamEvent.ERROR, errorListener);
91
- voice.write({
92
- [`${(0, common_1.toCamelCase)(this.constructor.name)}Request`]: fullRequest
93
- });
94
- }
95
- catch (e) {
96
- cleanup();
97
- reject(e);
98
- }
99
- });
100
- });
101
- }
102
- }
103
- exports.Verb = Verb;
@@ -1,2 +0,0 @@
1
- declare function getExpectedContent(name: string): string;
2
- export { getExpectedContent };
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExpectedContent = getExpectedContent;
4
- /**
5
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/fonoster
7
- *
8
- * This file is part of Fonoster
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const common_1 = require("@fonoster/common");
23
- function getExpectedContent(name) {
24
- switch (name) {
25
- case "StartStreamGather":
26
- return "startStreamGatherResponse";
27
- case "StartStream":
28
- return "startStreamResponse";
29
- default:
30
- return `${(0, common_1.toCamelCase)(name)}Response`;
31
- }
32
- }
@@ -1,35 +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
- export * from "./Answer";
20
- export * from "./Dial";
21
- export * from "./Gather";
22
- export * from "./Hangup";
23
- export * from "./Mute";
24
- export * from "./Play";
25
- export * from "./PlayDtmf";
26
- export * from "./PlaybackControl";
27
- export * from "./Record";
28
- export * from "./Say";
29
- export * from "./Stream";
30
- export * from "./StreamGather";
31
- export * from "./Unmute";
32
- export * from "./Verb";
33
- export * from "./validateRequest";
34
- export * from "./StopSay";
35
- export * from "./SetAudioFilters";
@@ -1,51 +0,0 @@
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
- /**
18
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
19
- * http://github.com/fonoster/fonoster
20
- *
21
- * This file is part of Fonoster
22
- *
23
- * Licensed under the MIT License (the "License");
24
- * you may not use this file except in compliance with
25
- * the License. You may obtain a copy of the License at
26
- *
27
- * https://opensource.org/licenses/MIT
28
- *
29
- * Unless required by applicable law or agreed to in writing, software
30
- * distributed under the License is distributed on an "AS IS" BASIS,
31
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
- * See the License for the specific language governing permissions and
33
- * limitations under the License.
34
- */
35
- __exportStar(require("./Answer"), exports);
36
- __exportStar(require("./Dial"), exports);
37
- __exportStar(require("./Gather"), exports);
38
- __exportStar(require("./Hangup"), exports);
39
- __exportStar(require("./Mute"), exports);
40
- __exportStar(require("./Play"), exports);
41
- __exportStar(require("./PlayDtmf"), exports);
42
- __exportStar(require("./PlaybackControl"), exports);
43
- __exportStar(require("./Record"), exports);
44
- __exportStar(require("./Say"), exports);
45
- __exportStar(require("./Stream"), exports);
46
- __exportStar(require("./StreamGather"), exports);
47
- __exportStar(require("./Unmute"), exports);
48
- __exportStar(require("./Verb"), exports);
49
- __exportStar(require("./validateRequest"), exports);
50
- __exportStar(require("./StopSay"), exports);
51
- __exportStar(require("./SetAudioFilters"), exports);
@@ -1,20 +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 { z } from "zod";
20
- export declare function validateRequest<T>(schema: z.Schema<T>, data: unknown): T;