remove config in favor of env vars, other major changes

This commit is contained in:
Dave Horton
2020-02-15 22:03:28 -05:00
parent 3d24ac1914
commit 3c89b7fd76
14 changed files with 162 additions and 113 deletions

View File

@@ -5,7 +5,6 @@ const assert = require('assert');
const placeCall = require('../utils/place-outdial');
const sessionTracker = require('../session/session-tracker');
const DtmfCollector = require('../utils/dtmf-collector');
const config = require('config');
const debug = require('debug')('jambonz:feature-server');
function parseDtmfOptions(logger, dtmfCapture) {
@@ -129,11 +128,11 @@ class TaskDial extends Task {
this._installDtmfDetection(cs, this.epOther, this.parentDtmfCollector);
await this._attemptCalls(cs);
await this.awaitTaskDone();
await cs.requestor.request(this.actionHook, Object.assign({}, cs.callInfo, this.results));
await this.performAction(Object.assign({}, cs.callInfo, this.results));
this._removeDtmfDetection(cs, this.epOther);
this._removeDtmfDetection(cs, this.ep);
} catch (err) {
this.logger.error(`TaskDial:exec terminating with error ${err.message}`);
this.logger.error({err}, 'TaskDial:exec terminating with error');
this.kill();
}
}
@@ -147,7 +146,7 @@ class TaskDial extends Task {
this.sd.kill();
this.sd = null;
}
sessionTracker.remove(this.callSid);
if (this.callSid) sessionTracker.remove(this.callSid);
if (this.listenTask) await this.listenTask.kill();
if (this.transcribeTask) await this.transcribeTask.kill();
if (this.timerMaxCallDuration) clearTimeout(this.timerMaxCallDuration);
@@ -242,7 +241,7 @@ class TaskDial extends Task {
const sbcAddress = cs.direction === CallDirection.Inbound ?
`${req.source_address}:${req.source_port}` :
config.get('outdials.sbc');
srf.locals.sbcs[0];
const opts = {
headers: req && req.has('X-CID') ? Object.assign(this.headers, {'X-CID': req.get('X-CID')}) : this.headers,
proxy: `sip:${sbcAddress}`,