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);