mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Fix/logger reference (#365)
* fix logger reference * fix undefined logger reference
This commit is contained in:
@@ -25,7 +25,7 @@ router.post('/', async(req, res) => {
|
|||||||
delete req.body.app_json;
|
delete req.body.app_json;
|
||||||
const restDial = makeTask(logger, {'rest:dial': req.body});
|
const restDial = makeTask(logger, {'rest:dial': req.body});
|
||||||
restDial.appJson = app_json;
|
restDial.appJson = app_json;
|
||||||
const {lookupAccountDetails} = dbUtils(logger, srf);
|
const {lookupAccountDetails, lookupCarrierByPhoneNumber, lookupCarrier} = dbUtils(logger, srf);
|
||||||
const {getSBC, getFreeswitch} = srf.locals;
|
const {getSBC, getFreeswitch} = srf.locals;
|
||||||
const sbcAddress = getSBC();
|
const sbcAddress = getSBC();
|
||||||
if (!sbcAddress) throw new Error('no available SBCs for outbound call creation');
|
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) {
|
if (target.type === 'phone' && target.trunk) {
|
||||||
const {lookupCarrier} = dbUtils(this.logger, srf);
|
|
||||||
const voip_carrier_sid = await lookupCarrier(req.body.account_sid, target.trunk);
|
const voip_carrier_sid = await lookupCarrier(req.body.account_sid, target.trunk);
|
||||||
logger.info(
|
logger.info(
|
||||||
`createCall: selected ${voip_carrier_sid} for requested carrier: ${target.trunk || 'unspecified'})`);
|
`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
|
* check if from-number matches any existing numbers on Jambonz
|
||||||
* */
|
* */
|
||||||
if (target.type === 'phone' && !target.trunk) {
|
if (target.type === 'phone' && !target.trunk) {
|
||||||
const {lookupCarrierByPhoneNumber} = dbUtils(this.logger, srf);
|
|
||||||
const str = restDial.from || '';
|
const str = restDial.from || '';
|
||||||
const callingNumber = str.startsWith('+') ? str.substring(1) : str;
|
const callingNumber = str.startsWith('+') ? str.substring(1) : str;
|
||||||
const voip_carrier_sid = await lookupCarrierByPhoneNumber(req.body.account_sid, callingNumber);
|
const voip_carrier_sid = await lookupCarrierByPhoneNumber(req.body.account_sid, callingNumber);
|
||||||
|
|||||||
Reference in New Issue
Block a user