work on say and gather

This commit is contained in:
Dave Horton
2020-01-13 14:01:19 -05:00
parent 1debb193c2
commit 1a656f3f0e
16 changed files with 1034 additions and 236 deletions

24
lib/tasks/hangup.js Normal file
View File

@@ -0,0 +1,24 @@
const Task = require('./task');
const {TaskName} = require('../utils/constants');
class TaskHangup extends Task {
constructor(logger, opts) {
super(logger, opts);
this.headers = this.data.headers || {};
}
get name() { return TaskName.Hangup; }
/**
* Hangup the call
*/
async exec(cs, dlg) {
try {
await dlg.destroy({headers: this.headers});
} catch (err) {
this.logger.error(err, `TaskHangup:exec - Error hanging up call with sip call id ${dlg.sip.callId}`);
}
}
}
module.exports = TaskHangup;