changes for updateCall pause/resume listen audio

This commit is contained in:
Dave Horton
2020-02-08 14:16:05 -05:00
parent 3ca2d982cc
commit ff531e6964
12 changed files with 140 additions and 26 deletions

View File

@@ -7,6 +7,7 @@ class TaskSay extends Task {
this.preconditions = TaskPreconditions.Endpoint;
this.text = this.data.text;
this.loop = this.data.loop || 1;
this.earlyMedia = this.data.earlyMedia === true || (parentTask && parentTask.earlyMedia);
if (this.data.synthesizer) {
this.voice = this.data.synthesizer.voice;
@@ -26,11 +27,14 @@ class TaskSay extends Task {
super.exec(cs);
this.ep = ep;
try {
await ep.speak({
ttsEngine: 'google_tts',
voice: this.voice || this.callSession.speechSynthesisVoice,
text: this.text
});
while (!this.killed && this.loop--) {
this.logger.debug(`TaskSay: remaining loops ${this.loop}`);
await ep.speak({
ttsEngine: 'google_tts',
voice: this.voice || this.callSession.speechSynthesisVoice,
text: this.text
});
}
} catch (err) {
this.logger.info(err, 'TaskSay:exec error');
}