mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-14 18:30:59 +00:00
initial checkin
This commit is contained in:
26
lib/tasks/sip_decline.js
Normal file
26
lib/tasks/sip_decline.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const Task = require('./task');
|
||||
const name = 'sip:decline';
|
||||
|
||||
class TaskSipDecline 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 = TaskSipDecline;
|
||||
Reference in New Issue
Block a user