@fonoster/voice 0.15.21 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VoiceResponse.d.ts +19 -2
- package/dist/VoiceResponse.js +26 -3
- package/dist/verbs/StopSay.d.ts +25 -0
- package/dist/verbs/StopSay.js +11 -0
- package/dist/verbs/index.d.ts +1 -0
- package/dist/verbs/index.js +1 -0
- package/package.json +5 -5
package/dist/VoiceResponse.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { DialOptions, GatherOptions, GatherResponse, MuteOptions, PlaybackControlAction, PlayOptions, PlayResponse, RecordOptions, RecordResponse, SayOptions,
|
|
19
|
+
import { DialOptions, GatherOptions, GatherResponse, MuteOptions, PlaybackControlAction, PlayOptions, PlayResponse, RecordOptions, RecordResponse, SayOptions, StreamEvent, StreamGatherOptions, StreamOptions, VerbResponse, VoiceRequest, VoiceSessionStreamServer } from "@fonoster/common";
|
|
20
20
|
import { DialStatusStream, Stream, StreamGatherStream } from "./verbs";
|
|
21
21
|
/**
|
|
22
22
|
* @classdesc Use the VoiceResponse object, to construct advance Interactive
|
|
@@ -146,7 +146,24 @@ declare class VoiceResponse {
|
|
|
146
146
|
* await response.playbackControl(playbackRef, PlaybackControlAction.STOP);
|
|
147
147
|
* }
|
|
148
148
|
*/
|
|
149
|
-
say(text: string, options?: SayOptions): Promise<
|
|
149
|
+
say(text: string, options?: SayOptions): Promise<VerbResponse>;
|
|
150
|
+
/**
|
|
151
|
+
* Stop the current TTS operation.
|
|
152
|
+
* @example
|
|
153
|
+
*
|
|
154
|
+
* async function handler (request, response) {
|
|
155
|
+
* await response.answer();
|
|
156
|
+
*
|
|
157
|
+
* // Some async operation
|
|
158
|
+
* setTimeout(() => {
|
|
159
|
+
* // Will stop the current TTS operation
|
|
160
|
+
* response.stopSay();
|
|
161
|
+
* }, 10000);
|
|
162
|
+
*
|
|
163
|
+
* await response.say("Long text to say...");
|
|
164
|
+
* }
|
|
165
|
+
*/
|
|
166
|
+
stopSay(): Promise<VerbResponse>;
|
|
150
167
|
/**
|
|
151
168
|
* Record the audio of the call.
|
|
152
169
|
*
|
package/dist/VoiceResponse.js
CHANGED
|
@@ -198,13 +198,36 @@ class VoiceResponse {
|
|
|
198
198
|
*/
|
|
199
199
|
say(text, options) {
|
|
200
200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
|
|
202
|
-
playbackRef: options === null || options === void 0 ? void 0 : options.playbackRef,
|
|
201
|
+
yield new verbs_1.Say(this.request, this.voice).run({
|
|
203
202
|
options: options ? pb_util_1.struct.encode(options) : undefined,
|
|
204
203
|
sessionRef: this.request.sessionRef,
|
|
205
204
|
text
|
|
206
205
|
});
|
|
207
|
-
return {
|
|
206
|
+
return { sessionRef: this.request.sessionRef };
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Stop the current TTS operation.
|
|
211
|
+
* @example
|
|
212
|
+
*
|
|
213
|
+
* async function handler (request, response) {
|
|
214
|
+
* await response.answer();
|
|
215
|
+
*
|
|
216
|
+
* // Some async operation
|
|
217
|
+
* setTimeout(() => {
|
|
218
|
+
* // Will stop the current TTS operation
|
|
219
|
+
* response.stopSay();
|
|
220
|
+
* }, 10000);
|
|
221
|
+
*
|
|
222
|
+
* await response.say("Long text to say...");
|
|
223
|
+
* }
|
|
224
|
+
*/
|
|
225
|
+
stopSay() {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
yield new verbs_1.StopSay(this.request, this.voice).run({
|
|
228
|
+
sessionRef: this.request.sessionRef
|
|
229
|
+
});
|
|
230
|
+
return { sessionRef: this.request.sessionRef };
|
|
208
231
|
});
|
|
209
232
|
}
|
|
210
233
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
package/dist/verbs/index.d.ts
CHANGED
package/dist/verbs/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/voice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Voice Server for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"fonoster": "./dist/index.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@fonoster/common": "^0.
|
|
25
|
-
"@fonoster/identity": "^0.
|
|
26
|
-
"@fonoster/logger": "^0.
|
|
24
|
+
"@fonoster/common": "^0.16.0",
|
|
25
|
+
"@fonoster/identity": "^0.16.0",
|
|
26
|
+
"@fonoster/logger": "^0.16.0",
|
|
27
27
|
"@grpc/grpc-js": "~1.10.6",
|
|
28
28
|
"deepmerge": "^4.3.1",
|
|
29
29
|
"grpc-health-check": "^2.0.2",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"bugs": {
|
|
45
45
|
"url": "https://github.com/fonoster/fonoster/issues"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ad4212a7938ad2e219b9d1ae27a430ec60d9f841"
|
|
48
48
|
}
|