mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +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 uri = parseUri(req.uri);
|
||||
logger.info({
|
||||
uri,
|
||||
callId,
|
||||
callingNumber: req.callingNumber,
|
||||
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');
|
||||
|
||||
// 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];
|
||||
logger.debug(`got application from Request URI header: ${application_sid}`);
|
||||
req.locals.application_sid = application_sid;
|
||||
@@ -60,7 +61,7 @@ module.exports = function(srf, logger) {
|
||||
req.locals.application_sid = application_sid;
|
||||
}
|
||||
// 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];
|
||||
logger.debug(`got Queue from Request URI header: ${queue_name}`);
|
||||
req.locals.queue_name = queue_name;
|
||||
|
||||
Reference in New Issue
Block a user