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

View File

@@ -1,25 +1,23 @@
const Task = require('./task');
const name = 'sip:decline';
const {TaskName, TaskPreconditions} = require('../utils/constants');
class TaskSipDecline extends Task {
constructor(logger, opts) {
super(logger, opts);
this.name = name;
this.preconditions = TaskPreconditions.UnansweredCall;
this.headers = this.data.headers || {};
}
static get name() { return name; }
get name() { return TaskName.SipDecline; }
/**
* Reject an incoming call attempt with a provided status code and (optionally) reason
*/
async exec(cs) {
if (!cs.res.finalResponseSent) {
cs.res.send(this.data.status, this.data.reason, {
headers: this.headers
});
}
return false;
async exec(cs, {res}) {
res.send(this.data.status, this.data.reason, {
headers: this.headers
});
}
}