mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
27 lines
559 B
JavaScript
27 lines
559 B
JavaScript
const Task = require('./task');
|
|
const name = 'dial';
|
|
|
|
class TaskDial extends Task {
|
|
constructor(logger, opts) {
|
|
super(logger, opts);
|
|
this.name = name;
|
|
this.headers = this.data.headers || {};
|
|
}
|
|
|
|
static get name() { return name; }
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
module.exports = TaskDial;
|