mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
added initial support for REST-initiated outdials
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//const debug = require('debug')('jambonz:feature-server');
|
||||
const uuidv4 = require('uuid/v4');
|
||||
const {CallStatus, CallDirection} = require('./utils/constants');
|
||||
const {CallDirection} = require('./utils/constants');
|
||||
const CallInfo = require('./session/call-info');
|
||||
const retrieveApp = require('./utils/retrieve-app');
|
||||
const parseUrl = require('parse-url');
|
||||
@@ -71,7 +71,7 @@ module.exports = function(srf, logger) {
|
||||
const logger = req.locals.logger;
|
||||
const app = req.locals.application;
|
||||
const call_hook = app.call_hook;
|
||||
const method = (call_hook.method || 'POST').toUpperCase();
|
||||
const method = call_hook.method.toUpperCase();
|
||||
let auth;
|
||||
if (call_hook.username && call_hook.password) {
|
||||
auth = {username: call_hook.username, password: call_hook.password};
|
||||
@@ -81,7 +81,8 @@ module.exports = function(srf, logger) {
|
||||
const myPort = u.port ? `:${u.port}` : '';
|
||||
app.originalRequest = {
|
||||
baseUrl: `${u.protocol}://${u.resource}${myPort}`,
|
||||
auth
|
||||
auth,
|
||||
method
|
||||
};
|
||||
logger.debug({url: call_hook.url, method}, 'invokeWebCallback');
|
||||
const obj = Object.assign({}, req.locals.callInfo);
|
||||
@@ -91,8 +92,8 @@ module.exports = function(srf, logger) {
|
||||
app.tasks = await retrieveApp(logger, call_hook.url, method, auth, obj);
|
||||
next();
|
||||
} catch (err) {
|
||||
logger.error(err, 'Error retrieving or parsing application');
|
||||
res.send(500);
|
||||
logger.info(`Error retrieving or parsing application: ${err.message}`);
|
||||
res.send(480, {headers: {'X-Reason': err.message}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user