mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
prevent exception referencing user.uri (#517)
This commit is contained in:
@@ -35,6 +35,7 @@ module.exports = function(srf, logger) {
|
|||||||
const callId = req.get('Call-ID');
|
const callId = req.get('Call-ID');
|
||||||
const uri = parseUri(req.uri);
|
const uri = parseUri(req.uri);
|
||||||
logger.info({
|
logger.info({
|
||||||
|
uri,
|
||||||
callId,
|
callId,
|
||||||
callingNumber: req.callingNumber,
|
callingNumber: req.callingNumber,
|
||||||
calledNumber: req.calledNumber
|
calledNumber: req.calledNumber
|
||||||
@@ -50,7 +51,7 @@ module.exports = function(srf, logger) {
|
|||||||
if (req.has('X-Authenticated-User')) req.locals.originatingUser = req.get('X-Authenticated-User');
|
if (req.has('X-Authenticated-User')) req.locals.originatingUser = req.get('X-Authenticated-User');
|
||||||
|
|
||||||
// check for call to application
|
// check for call to application
|
||||||
if (uri.user.startsWith('app-') && req.locals.originatingUser) {
|
if (uri.user?.startsWith('app-') && req.locals.originatingUser) {
|
||||||
const application_sid = uri.user.match(/app-(.*)/)[1];
|
const application_sid = uri.user.match(/app-(.*)/)[1];
|
||||||
logger.debug(`got application from Request URI header: ${application_sid}`);
|
logger.debug(`got application from Request URI header: ${application_sid}`);
|
||||||
req.locals.application_sid = application_sid;
|
req.locals.application_sid = application_sid;
|
||||||
@@ -60,7 +61,7 @@ module.exports = function(srf, logger) {
|
|||||||
req.locals.application_sid = application_sid;
|
req.locals.application_sid = application_sid;
|
||||||
}
|
}
|
||||||
// check for call to queue
|
// check for call to queue
|
||||||
if (uri.user.startsWith('queue-') && req.locals.originatingUser) {
|
if (uri.user?.startsWith('queue-') && req.locals.originatingUser) {
|
||||||
const queue_name = uri.user.match(/queue-(.*)/)[1];
|
const queue_name = uri.user.match(/queue-(.*)/)[1];
|
||||||
logger.debug(`got Queue from Request URI header: ${queue_name}`);
|
logger.debug(`got Queue from Request URI header: ${queue_name}`);
|
||||||
req.locals.queue_name = queue_name;
|
req.locals.queue_name = queue_name;
|
||||||
|
|||||||
Reference in New Issue
Block a user