From fdd8f7e743edd0fc77b7af8d8bce0c6791509619 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 1 Jun 2023 09:46:08 -0400 Subject: [PATCH] Fix/logger reference (#365) * fix logger reference * fix undefined logger reference --- lib/http-routes/api/create-call.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/http-routes/api/create-call.js b/lib/http-routes/api/create-call.js index 96705e28..d9a2f2b6 100644 --- a/lib/http-routes/api/create-call.js +++ b/lib/http-routes/api/create-call.js @@ -25,7 +25,7 @@ router.post('/', async(req, res) => { delete req.body.app_json; const restDial = makeTask(logger, {'rest:dial': req.body}); restDial.appJson = app_json; - const {lookupAccountDetails} = dbUtils(logger, srf); + const {lookupAccountDetails, lookupCarrierByPhoneNumber, lookupCarrier} = dbUtils(logger, srf); const {getSBC, getFreeswitch} = srf.locals; const sbcAddress = getSBC(); if (!sbcAddress) throw new Error('no available SBCs for outbound call creation'); @@ -82,7 +82,6 @@ router.post('/', async(req, res) => { } if (target.type === 'phone' && target.trunk) { - const {lookupCarrier} = dbUtils(this.logger, srf); const voip_carrier_sid = await lookupCarrier(req.body.account_sid, target.trunk); logger.info( `createCall: selected ${voip_carrier_sid} for requested carrier: ${target.trunk || 'unspecified'})`); @@ -96,7 +95,6 @@ router.post('/', async(req, res) => { * check if from-number matches any existing numbers on Jambonz * */ if (target.type === 'phone' && !target.trunk) { - const {lookupCarrierByPhoneNumber} = dbUtils(this.logger, srf); const str = restDial.from || ''; const callingNumber = str.startsWith('+') ? str.substring(1) : str; const voip_carrier_sid = await lookupCarrierByPhoneNumber(req.body.account_sid, callingNumber);