mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
feat: loop dial music (#769)
This commit is contained in:
@@ -82,6 +82,8 @@ function filterAndLimit(logger, tasks) {
|
||||
return unique;
|
||||
}
|
||||
|
||||
const sleepFor = (ms) => new Promise((resolve) => setTimeout(() => resolve(), ms));
|
||||
|
||||
class TaskDial extends Task {
|
||||
constructor(logger, opts) {
|
||||
super(logger, opts);
|
||||
@@ -203,7 +205,16 @@ class TaskDial extends Task {
|
||||
else {
|
||||
this.epOther = cs.ep;
|
||||
if (this.dialMusic && this.epOther && this.epOther.connected) {
|
||||
this.epOther.play(this.dialMusic).catch((err) => {});
|
||||
(async() => {
|
||||
do {
|
||||
try {
|
||||
await this.epOther.play(this.dialMusic);
|
||||
} catch (err) {
|
||||
this.logger.error(err, `TaskDial:exec error playing ${this.dialMusic}`);
|
||||
await sleepFor(1000);
|
||||
}
|
||||
} while (!this.killed || !this.bridged);
|
||||
})();
|
||||
}
|
||||
}
|
||||
if (!this.killed) await this._attemptCalls(cs);
|
||||
|
||||
Reference in New Issue
Block a user