Fix/logger reference (#365)

* fix logger reference

* fix undefined logger reference
This commit is contained in:
Dave Horton
2023-06-01 09:46:08 -04:00
committed by GitHub
parent bb852600c0
commit fdd8f7e743

View File

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