This commit is contained in:
Dave Horton
2020-02-28 10:25:43 -05:00
parent 19d674f531
commit 8cf107c34c
7 changed files with 9 additions and 8 deletions

View File

@@ -83,7 +83,10 @@ module.exports = function(srf, logger) {
else app.notifier = {request: () => {}}; else app.notifier = {request: () => {}};
req.locals.application = app; req.locals.application = app;
logger.debug(app, `retrieved application for ${req.locals.calledNumber}`); const obj = Object.assign({}, app);
delete obj.requestor;
delete obj.notifier;
logger.info({app: obj}, `retrieved application for incoming call to ${req.locals.calledNumber}`);
req.locals.callInfo = new CallInfo({req, app, direction: CallDirection.Inbound}); req.locals.callInfo = new CallInfo({req, app, direction: CallDirection.Inbound});
next(); next();
} catch (err) { } catch (err) {

View File

@@ -555,7 +555,7 @@ class CallSession extends Emitter {
} }
// update calls db // update calls db
this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`); //this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
this.updateCallStatus(Object.assign({}, this.callInfo), this.serviceUrl) this.updateCallStatus(Object.assign({}, this.callInfo), this.serviceUrl)
.catch((err) => this.logger.error(err, 'redis error')); .catch((err) => this.logger.error(err, 'redis error'));
} }

View File

@@ -9,7 +9,7 @@ function makeTask(logger, obj, parent) {
} }
const name = keys[0]; const name = keys[0];
const data = obj[name]; const data = obj[name];
logger.debug(data, `makeTask: ${name}`); //logger.debug(data, `makeTask: ${name}`);
if (typeof data !== 'object') { if (typeof data !== 'object') {
throw errBadInstruction; throw errBadInstruction;
} }

View File

@@ -12,7 +12,7 @@ class TaskTag extends Task {
async exec(cs) { async exec(cs) {
super.exec(cs); super.exec(cs);
cs.callInfo.customerData = this.data; cs.callInfo.customerData = this.data;
this.logger.debug({callInfo: cs.callInfo.toJSON()}, 'TaskTag:exec set customer data in callInfo'); //this.logger.debug({callInfo: cs.callInfo.toJSON()}, 'TaskTag:exec set customer data in callInfo');
} }
} }

View File

@@ -1,5 +1,4 @@
function normalizeJambones(logger, obj) { function normalizeJambones(logger, obj) {
logger.debug(`normalizeJambones: ${JSON.stringify(obj)}`);
if (!Array.isArray(obj)) throw new Error('malformed jambonz payload: must be array'); if (!Array.isArray(obj)) throw new Error('malformed jambonz payload: must be array');
const document = []; const document = [];
for (const tdata of obj) { for (const tdata of obj) {
@@ -17,7 +16,6 @@ function normalizeJambones(logger, obj) {
} }
else if (Object.keys(tdata).length === 1) { else if (Object.keys(tdata).length === 1) {
// {'say': {..}} // {'say': {..}}
logger.debug(`pushing ${JSON.stringify(tdata)}`);
document.push(tdata); document.push(tdata);
} }
else { else {

View File

@@ -86,12 +86,12 @@ class Requestor {
const diff = process.hrtime(startAt); const diff = process.hrtime(startAt);
const time = diff[0] * 1e3 + diff[1] * 1e-6; const time = diff[0] * 1e3 + diff[1] * 1e-6;
const rtt = time.toFixed(0); const rtt = time.toFixed(0);
this.logger.debug(`Requestor:request ${method} ${url} succeeded in ${rtt}ms`);
if (buf) this.stats.histogram('app.hook.response_time', rtt, ['hook_type:app']); if (buf) this.stats.histogram('app.hook.response_time', rtt, ['hook_type:app']);
if (buf && buf.toString().length > 0) { if (buf && buf.toString().length > 0) {
try { try {
const json = JSON.parse(buf.toString()); const json = JSON.parse(buf.toString());
this.logger.info({response: json}, `Requestor:request ${method} ${url} succeeded in ${rtt}ms`);
return json; return json;
} }
catch (err) { catch (err) {

View File

@@ -36,7 +36,7 @@
"ip": "^1.1.5", "ip": "^1.1.5",
"cidr-matcher": "^2.1.1", "cidr-matcher": "^2.1.1",
"jambonz-db-helpers": "^0.3.2", "jambonz-db-helpers": "^0.3.2",
"jambonz-realtimedb-helpers": "^0.1.7", "jambonz-realtimedb-helpers": "^0.1.8",
"jambonz-stats-collector": "^0.0.3", "jambonz-stats-collector": "^0.0.3",
"moment": "^2.24.0", "moment": "^2.24.0",
"parse-url": "^5.0.1", "parse-url": "^5.0.1",