mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2026-10-04 02:04:22 +00:00
bugfix: handle calls with no user in To header
This commit is contained in:
+2
-2
@@ -100,7 +100,7 @@ module.exports = (srf, logger) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getApplicationForDidAndCarrier = async(req, voip_carrier_sid) => {
|
const getApplicationForDidAndCarrier = async(req, voip_carrier_sid) => {
|
||||||
const did = normalizeDID(req.calledNumber);
|
const did = normalizeDID(req.calledNumber) || 'anonymous';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/* straight DID match */
|
/* straight DID match */
|
||||||
@@ -214,7 +214,7 @@ module.exports = (srf, logger) => {
|
|||||||
if (matches.length) {
|
if (matches.length) {
|
||||||
/* we have one or more matches. Now check for one with a provisioned phone number matching the DID */
|
/* we have one or more matches. Now check for one with a provisioned phone number matching the DID */
|
||||||
const vc_sids = matches.map((m) => `'${m.voip_carrier_sid}'`).join(',');
|
const vc_sids = matches.map((m) => `'${m.voip_carrier_sid}'`).join(',');
|
||||||
const did = normalizeDID(req.calledNumber);
|
const did = normalizeDID(req.calledNumber) || 'anonymous';
|
||||||
const sql = `SELECT * FROM phone_numbers WHERE number = '${did}' AND voip_carrier_sid IN (${vc_sids})`;
|
const sql = `SELECT * FROM phone_numbers WHERE number = '${did}' AND voip_carrier_sid IN (${vc_sids})`;
|
||||||
logger.debug({matches, sql, did, vc_sids}, 'looking up DID');
|
logger.debug({matches, sql, did, vc_sids}, 'looking up DID');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user