mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
rest createCall: include accountSid and traceId in logging
This commit is contained in:
@@ -13,6 +13,7 @@ const dbUtils = require('../../utils/db-utils');
|
|||||||
|
|
||||||
router.post('/', async(req, res) => {
|
router.post('/', async(req, res) => {
|
||||||
const {logger} = req.app.locals;
|
const {logger} = req.app.locals;
|
||||||
|
const {accountSid} = req.body;
|
||||||
|
|
||||||
logger.debug({body: req.body}, 'got createCall request');
|
logger.debug({body: req.body}, 'got createCall request');
|
||||||
try {
|
try {
|
||||||
@@ -40,7 +41,7 @@ router.post('/', async(req, res) => {
|
|||||||
'X-Jambonz-Routing': target.type,
|
'X-Jambonz-Routing': target.type,
|
||||||
'X-Jambonz-FS-UUID': srf.locals.fsUUID,
|
'X-Jambonz-FS-UUID': srf.locals.fsUUID,
|
||||||
'X-Call-Sid': callSid,
|
'X-Call-Sid': callSid,
|
||||||
'X-Account-Sid': req.body.account_sid
|
'X-Account-Sid': accountSid
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (target.type) {
|
switch (target.type) {
|
||||||
@@ -49,7 +50,7 @@ router.post('/', async(req, res) => {
|
|||||||
uri = `sip:${target.number}@${sbcAddress}`;
|
uri = `sip:${target.number}@${sbcAddress}`;
|
||||||
to = target.number;
|
to = target.number;
|
||||||
if ('teams' === target.type) {
|
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');
|
if (!obj) throw new Error('dial to ms teams not allowed; account must first be configured with teams info');
|
||||||
Object.assign(opts.headers, {
|
Object.assign(opts.headers, {
|
||||||
'X-MS-Teams-FQDN': obj.ms_teams_fqdn,
|
'X-MS-Teams-FQDN': obj.ms_teams_fqdn,
|
||||||
@@ -183,7 +184,9 @@ router.post('/', async(req, res) => {
|
|||||||
|
|
||||||
sipLogger = logger.child({
|
sipLogger = logger.child({
|
||||||
callSid: cs.callSid,
|
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`);
|
sipLogger.info(`outbound REST call attempt to ${JSON.stringify(target)} has been sent`);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user