Compare commits

..

3 Commits

6 changed files with 27 additions and 16 deletions

View File

@@ -23,7 +23,8 @@ module.exports = function(srf, logger) {
lookupAppBySid, lookupAppBySid,
lookupAppByRealm, lookupAppByRealm,
lookupAppByTeamsTenant, lookupAppByTeamsTenant,
registrar registrar,
lookupClientByAccountAndUsername
} = srf.locals.dbHelpers; } = srf.locals.dbHelpers;
const { const {
writeAlerts, writeAlerts,
@@ -48,10 +49,17 @@ module.exports = function(srf, logger) {
const account_sid = req.get('X-Account-Sid'); const account_sid = req.get('X-Account-Sid');
req.locals = {callSid, account_sid, callId}; req.locals = {callSid, account_sid, callId};
if (req.has('X-Authenticated-User')) req.locals.originatingUser = req.get('X-Authenticated-User'); let clientDb = null;
if (req.has('X-Authenticated-User')) {
req.locals.originatingUser = req.get('X-Authenticated-User');
const arr = /^(.*)@(.*)/.exec(req.locals.originatingUser);
if (arr) {
[clientDb] = await lookupClientByAccountAndUsername(account_sid, arr[1]);
}
}
// 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 && clientDb.allow_direct_app_calling) {
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;
@@ -61,13 +69,13 @@ 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 && clientDb.allow_direct_queue_calling) {
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;
} }
// check for call to registered user // check for call to registered user
if (!JAMBONES_DISABLE_DIRECT_P2P_CALL && req.locals.originatingUser) { if (!JAMBONES_DISABLE_DIRECT_P2P_CALL && req.locals.originatingUser && clientDb.allow_direct_user_calling) {
const arr = /^(.*)@(.*)/.exec(req.locals.originatingUser); const arr = /^(.*)@(.*)/.exec(req.locals.originatingUser);
if (arr) { if (arr) {
const sipRealm = arr[2]; const sipRealm = arr[2];

View File

@@ -58,13 +58,13 @@ class Dialogflow extends Task {
this.vendor = this.data.tts.vendor || 'default'; this.vendor = this.data.tts.vendor || 'default';
this.language = this.data.tts.language || 'default'; this.language = this.data.tts.language || 'default';
this.voice = this.data.tts.voice || 'default'; this.voice = this.data.tts.voice || 'default';
this.speechSynthesisLabel = this.data.tts.label || 'default'; this.speechSynthesisLabel = this.data.tts.label;
// fallback tts // fallback tts
this.fallbackVendor = this.data.tts.fallbackVendor || 'default'; this.fallbackVendor = this.data.tts.fallbackVendor || 'default';
this.fallbackLanguage = this.data.tts.fallbackLanguage || 'default'; this.fallbackLanguage = this.data.tts.fallbackLanguage || 'default';
this.fallbackVoice = this.data.tts.fallbackLanguage || 'default'; this.fallbackVoice = this.data.tts.fallbackLanguage || 'default';
this.fallbackLabel = this.data.tts.fallbackLabel || 'default'; this.fallbackLabel = this.data.tts.fallbackLabel;
} }
this.bargein = this.data.bargein; this.bargein = this.data.bargein;
} }

View File

@@ -140,7 +140,8 @@ function installSrfLocals(srf, logger) {
lookupTeamsByAccount, lookupTeamsByAccount,
lookupAccountBySid, lookupAccountBySid,
lookupAccountCapacitiesBySid, lookupAccountCapacitiesBySid,
lookupSmppGateways lookupSmppGateways,
lookupClientByAccountAndUsername
} = require('@jambonz/db-helpers')({ } = require('@jambonz/db-helpers')({
host: JAMBONES_MYSQL_HOST, host: JAMBONES_MYSQL_HOST,
user: JAMBONES_MYSQL_USER, user: JAMBONES_MYSQL_USER,
@@ -217,6 +218,7 @@ function installSrfLocals(srf, logger) {
lookupAccountBySid, lookupAccountBySid,
lookupAccountCapacitiesBySid, lookupAccountCapacitiesBySid,
lookupSmppGateways, lookupSmppGateways,
lookupClientByAccountAndUsername,
updateCallStatus, updateCallStatus,
retrieveCall, retrieveCall,
listCalls, listCalls,

View File

@@ -334,6 +334,7 @@ class SingleDialer extends Emitter {
// verify it contains only allowed verbs // verify it contains only allowed verbs
const allowedTasks = tasks.filter((task) => { const allowedTasks = tasks.filter((task) => {
return [ return [
TaskPreconditions.None,
TaskPreconditions.StableCall, TaskPreconditions.StableCall,
TaskPreconditions.Endpoint TaskPreconditions.Endpoint
].includes(task.preconditions); ].includes(task.preconditions);

14
package-lock.json generated
View File

@@ -32,7 +32,7 @@
"debug": "^4.3.4", "debug": "^4.3.4",
"deepcopy": "^2.1.0", "deepcopy": "^2.1.0",
"drachtio-fsmrf": "^3.0.27", "drachtio-fsmrf": "^3.0.27",
"drachtio-srf": "^4.5.29", "drachtio-srf": "^4.5.31",
"express": "^4.18.2", "express": "^4.18.2",
"express-validator": "^7.0.1", "express-validator": "^7.0.1",
"ip": "^1.1.8", "ip": "^1.1.8",
@@ -5360,9 +5360,9 @@
} }
}, },
"node_modules/drachtio-srf": { "node_modules/drachtio-srf": {
"version": "4.5.29", "version": "4.5.31",
"resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-4.5.29.tgz", "resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-4.5.31.tgz",
"integrity": "sha512-Hj2OW+SyQxAyLpyHngJwW26FX9V4fDYZGX0mlU4YOF4ml7I7b7XITcRPxKhroYDOrLgKqhNeh5BcPoKqPhEK7A==", "integrity": "sha512-/M4J8h2aqHtMXWr8/UHngKQsY9sQQxjdd23jDTSpNVpCwgZ2/xZFhbg/B/UCjrarSRzbyDCvuluOAtaPRSw7Hw==",
"dependencies": { "dependencies": {
"debug": "^3.2.7", "debug": "^3.2.7",
"delegates": "^0.1.0", "delegates": "^0.1.0",
@@ -14944,9 +14944,9 @@
} }
}, },
"drachtio-srf": { "drachtio-srf": {
"version": "4.5.29", "version": "4.5.31",
"resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-4.5.29.tgz", "resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-4.5.31.tgz",
"integrity": "sha512-Hj2OW+SyQxAyLpyHngJwW26FX9V4fDYZGX0mlU4YOF4ml7I7b7XITcRPxKhroYDOrLgKqhNeh5BcPoKqPhEK7A==", "integrity": "sha512-/M4J8h2aqHtMXWr8/UHngKQsY9sQQxjdd23jDTSpNVpCwgZ2/xZFhbg/B/UCjrarSRzbyDCvuluOAtaPRSw7Hw==",
"requires": { "requires": {
"debug": "^3.2.7", "debug": "^3.2.7",
"delegates": "^0.1.0", "delegates": "^0.1.0",

View File

@@ -48,7 +48,7 @@
"debug": "^4.3.4", "debug": "^4.3.4",
"deepcopy": "^2.1.0", "deepcopy": "^2.1.0",
"drachtio-fsmrf": "^3.0.27", "drachtio-fsmrf": "^3.0.27",
"drachtio-srf": "^4.5.29", "drachtio-srf": "^4.5.31",
"express": "^4.18.2", "express": "^4.18.2",
"express-validator": "^7.0.1", "express-validator": "^7.0.1",
"ip": "^1.1.8", "ip": "^1.1.8",