@fonoster/voice 0.7.11 → 0.7.12

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.
@@ -1,4 +1,4 @@
1
- import { DialOptions, GatherOptions, GatherResponse, MuteOptions, PlayOptions, PlayResponse, PlaybackControlAction, RecordOptions, RecordResponse, SayOptions, SayResponse, StreamGatherOptions, StreamOptions, VerbResponse, VoiceRequest, VoiceSessionStreamServer } from "@fonoster/common";
1
+ import { DialOptions, GatherOptions, GatherResponse, MuteOptions, PlayOptions, PlayResponse, PlaybackControlAction, RecordOptions, RecordResponse, SayOptions, SayResponse, StreamEvent, StreamGatherOptions, StreamOptions, VerbResponse, VoiceRequest, VoiceSessionStreamServer } from "@fonoster/common";
2
2
  import { DialStatusStream, Stream, StreamGatherStream } from "./verbs";
3
3
  /**
4
4
  * @classdesc Use the VoiceResponse object, to construct advance Interactive
@@ -228,5 +228,21 @@ declare class VoiceResponse {
228
228
  * }
229
229
  */
230
230
  unmute(options?: MuteOptions): Promise<void>;
231
+ /**
232
+ * Register a listener for the given event.
233
+ *
234
+ * @param {StreamEvent} event - The event to listen for
235
+ * @param {Function} listener - The callback function
236
+ * @example
237
+ *
238
+ * async function handler (request, response) {
239
+ * ...
240
+ *
241
+ * response.on(StreamEvent.END, () => {
242
+ * console.log("Call ended");
243
+ * });
244
+ * }
245
+ */
246
+ on(event: StreamEvent, listener: (...args: unknown[]) => void): void;
231
247
  }
232
248
  export { VoiceResponse };
@@ -380,5 +380,23 @@ class VoiceResponse {
380
380
  });
381
381
  });
382
382
  }
383
+ /**
384
+ * Register a listener for the given event.
385
+ *
386
+ * @param {StreamEvent} event - The event to listen for
387
+ * @param {Function} listener - The callback function
388
+ * @example
389
+ *
390
+ * async function handler (request, response) {
391
+ * ...
392
+ *
393
+ * response.on(StreamEvent.END, () => {
394
+ * console.log("Call ended");
395
+ * });
396
+ * }
397
+ */
398
+ on(event, listener) {
399
+ this.voice.on(event, listener);
400
+ }
383
401
  }
384
402
  exports.VoiceResponse = VoiceResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/voice",
3
- "version": "0.7.11",
3
+ "version": "0.7.12",
4
4
  "description": "Voice Server for Fonoster",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -43,5 +43,5 @@
43
43
  "bugs": {
44
44
  "url": "https://github.com/fonoster/fonoster/issues"
45
45
  },
46
- "gitHead": "5c7629ecbe633d2d44fca0d9de8a24a38f4a4097"
46
+ "gitHead": "264fb6d971bad1d823554e93ed7c088318307184"
47
47
  }