diff --git a/lib/tasks/config.js b/lib/tasks/config.js index 926c6439..50fab5aa 100644 --- a/lib/tasks/config.js +++ b/lib/tasks/config.js @@ -26,7 +26,7 @@ class TaskConfig extends Task { }); } if (this.bargeIn.sticky) this.autoEnable = true; - this.preconditions = (this.bargeIn.enable || this.record?.action) ? + this.preconditions = (this.bargeIn.enable || this.record?.action || this.data.amd) ? TaskPreconditions.Endpoint : TaskPreconditions.None; } @@ -54,13 +54,20 @@ class TaskConfig extends Task { return `${this.name}{${phrase.join(',')}`; } - async exec(cs) { + async exec(cs, {ep}) { await super.exec(cs); if (this.data.amd) { this.startAmd = cs.startAmd; this.stopAmd = cs.stopAmd; this.on('amd', this._onAmdEvent.bind(this, cs)); + + try { + this.ep = ep; + this.startAmd(cs, ep, this, this.data.amd); + } catch (err) { + this.logger.info({err}, 'Config:exec - Error calling startAmd'); + } } if (this.hasSynthesizer) { @@ -133,6 +140,7 @@ class TaskConfig extends Task { async kill(cs) { super.kill(cs); + if (this.ep && this.stopAmd) this.stopAmd(this.ep, this); } _onAmdEvent(cs, evt) { diff --git a/lib/utils/cron-jobs.js b/lib/utils/cron-jobs.js index 0c9dbc6d..db94f8e6 100644 --- a/lib/utils/cron-jobs.js +++ b/lib/utils/cron-jobs.js @@ -42,9 +42,9 @@ const clearChannels = () => { }; const clearFiles = () => { - const {logger} = require('../..'); - const out = execSync('find /tmp -name "*.mp3" -mtime +2 -exec rm {} \\;'); - logger.debug({out}, 'clearFiles: command output'); + //const {logger} = require('../..'); + /*const out = */ execSync('find /tmp -name "*.mp3" -mtime +2 -exec rm {} \\;'); + //logger.debug({out}, 'clearFiles: command output'); };