rest createCall: include accountSid and traceId in logging

This commit is contained in:
Dave Horton
2022-04-03 19:02:14 -04:00
parent 9004f654ff
commit 775a317821

View File

@@ -13,6 +13,7 @@ const dbUtils = require('../../utils/db-utils');
router.post('/', async(req, res) => {
const {logger} = req.app.locals;
const {accountSid} = req.body;
logger.debug({body: req.body}, 'got createCall request');
try {
@@ -40,7 +41,7 @@ router.post('/', async(req, res) => {
'X-Jambonz-Routing': target.type,
'X-Jambonz-FS-UUID': srf.locals.fsUUID,
'X-Call-Sid': callSid,
'X-Account-Sid': req.body.account_sid
'X-Account-Sid': accountSid
};
switch (target.type) {
@@ -49,7 +50,7 @@ router.post('/', async(req, res) => {
uri = `sip:${target.number}@${sbcAddress}`;
to = target.number;
if ('teams' === target.type) {
const obj = await lookupTeamsByAccount(req.body.account_sid);
const obj = await lookupTeamsByAccount(accountSid);
if (!obj) throw new Error('dial to ms teams not allowed; account must first be configured with teams info');
Object.assign(opts.headers, {
'X-MS-Teams-FQDN': obj.ms_teams_fqdn,
@@ -183,7 +184,9 @@ router.post('/', async(req, res) => {
sipLogger = logger.child({
callSid: cs.callSid,
callId: callInfo.callId
callId: callInfo.callId,
accountSid,
traceId: rootSpan.traceId
});
sipLogger.info(`outbound REST call attempt to ${JSON.stringify(target)} has been sent`);
},