mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
remove config in favor of env vars, other major changes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const Emitter = require('events');
|
||||
const config = require('config');
|
||||
const {CallDirection, TaskPreconditions, CallStatus, TaskName} = require('../utils/constants');
|
||||
const moment = require('moment');
|
||||
const assert = require('assert');
|
||||
@@ -227,13 +226,11 @@ class CallSession extends Emitter {
|
||||
* @param {object} [opts.call_hook] - new call_status_hook
|
||||
*/
|
||||
async _lccCallHook(opts) {
|
||||
const tasks = await this.requestor(opts.call_hook, this.callInfo);
|
||||
|
||||
//TODO: if they gave us a call status hook, we should replace
|
||||
//the existing one (or just remove this option altogether?)
|
||||
|
||||
this.logger.info({tasks}, 'CallSession:updateCall new task list');
|
||||
this.replaceApplication(tasks);
|
||||
const tasks = await this.requestor.request(opts.call_hook, this.callInfo);
|
||||
if (tasks && tasks.length > 0) {
|
||||
this.logger.info({tasks}, 'CallSession:updateCall new task list');
|
||||
this.replaceApplication(normalizeJamones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -488,7 +485,7 @@ class CallSession extends Emitter {
|
||||
async getMS() {
|
||||
if (!this.ms) {
|
||||
const mrf = this.srf.locals.mrf;
|
||||
this.ms = await mrf.connect(config.get('freeswitch'));
|
||||
this.ms = await mrf.connect(this.srf.locals.freeswitch);
|
||||
}
|
||||
return this.ms;
|
||||
}
|
||||
@@ -503,7 +500,7 @@ class CallSession extends Emitter {
|
||||
|
||||
// get a media server
|
||||
if (!this.ms) {
|
||||
this.ms = await mrf.connect(config.get('freeswitch'));
|
||||
this.ms = await mrf.connect(this.srf.locals.freeswitch);
|
||||
}
|
||||
if (!this.ep) {
|
||||
this.ep = await this.ms.createEndpoint({remoteSdp: this.req.body});
|
||||
@@ -534,6 +531,7 @@ class CallSession extends Emitter {
|
||||
}
|
||||
|
||||
// update calls db
|
||||
this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
|
||||
this.updateCallStatus(this.callInfo, this.serviceUrl).catch((err) => this.logger.error(err, 'redis error'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user