From 775a31782108f8049b9aa4e917f5f339f0bbded9 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Sun, 3 Apr 2022 19:02:14 -0400 Subject: [PATCH] rest createCall: include accountSid and traceId in logging --- lib/http-routes/api/create-call.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/http-routes/api/create-call.js b/lib/http-routes/api/create-call.js index 8712cb40..16dd11b4 100644 --- a/lib/http-routes/api/create-call.js +++ b/lib/http-routes/api/create-call.js @@ -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`); },