mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
feat: lcr
This commit is contained in:
@@ -153,11 +153,12 @@ module.exports = (logger, srf) => {
|
||||
const sqlQueryLcrByAccountSid = `SELECT lcr_sid FROM lcr WHERE account_sid = ? OR
|
||||
service_provider_sid = (SELECT service_provider_sid from accounts where account_sid = ?)`;
|
||||
const sqlQueryLcrRouteByLcrSid = 'SELECT * FROM lcr_routes WHERE lcr_sid = ? ORDER BY priority';
|
||||
const sqlQueryLcrCarrierSetEntryByLcrRouteSid = 'SELECT * FROM lcr_carrier_set_entry WHERE lcr_route_sid = ? ORDER BY priority'
|
||||
const sqlQueryLcrCarrierSetEntryByLcrRouteSid = `SELECT * FROM lcr_carrier_set_entry
|
||||
WHERE lcr_route_sid = ? ORDER BY priority`;
|
||||
const lookupCarrierByLcr = async(account_sid, toNumber) => {
|
||||
const pp = pool.promise();
|
||||
try {
|
||||
const[lcrs] = await pp.query(sqlQueryLcrByAccountSid, [account_sid, account_sid]);
|
||||
const [lcrs] = await pp.query(sqlQueryLcrByAccountSid, [account_sid, account_sid]);
|
||||
if (lcrs.length) {
|
||||
const lcr_sid = lcrs[0];
|
||||
const [lcr_routes] = await pp.query(sqlQueryLcrRouteByLcrSid, [lcr_sid]);
|
||||
@@ -177,7 +178,7 @@ module.exports = (logger, srf) => {
|
||||
} catch (error) {
|
||||
logger.error({error}, `lookupCarrierByLcr: Error ${account_sid}:${toNumber}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
lookupAccountDetails,
|
||||
|
||||
Reference in New Issue
Block a user