mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
snake case REST payloads, support for LCC with child_call_hook, handle 302 on outdial
This commit is contained in:
@@ -7,11 +7,13 @@ const {DbErrorUnprocessableRequest} = require('../utils/errors');
|
||||
/**
|
||||
* validate the call state
|
||||
*/
|
||||
function retrieveCallSession(callSid, opts) {
|
||||
function retrieveCallSession(logger, callSid, opts) {
|
||||
logger.debug(`retrieving session for callSid ${callSid}`);
|
||||
const cs = sessionTracker.get(callSid);
|
||||
if (cs) {
|
||||
const task = cs.currentTask;
|
||||
if (!task || task.name != TaskName.Enqueue) {
|
||||
logger.debug({cs}, 'found call session but not in Enqueue task??');
|
||||
throw new DbErrorUnprocessableRequest(`enqueue api failure: indicated call is not queued: ${task.name}`);
|
||||
}
|
||||
}
|
||||
@@ -19,14 +21,14 @@ function retrieveCallSession(callSid, opts) {
|
||||
}
|
||||
|
||||
/**
|
||||
* notify a waiting session that a conference has started
|
||||
* notify a waiting session that a queue event has occurred
|
||||
*/
|
||||
router.post('/:callSid', async(req, res) => {
|
||||
const logger = req.app.locals.logger;
|
||||
const callSid = req.params.callSid;
|
||||
logger.debug({body: req.body}, 'got enqueue event');
|
||||
logger.debug({callSid, body: req.body}, 'got enqueue event');
|
||||
try {
|
||||
const cs = retrieveCallSession(callSid, req.body);
|
||||
const cs = retrieveCallSession(logger, callSid, req.body);
|
||||
if (!cs) {
|
||||
logger.info(`enqueue: callSid not found ${callSid}`);
|
||||
return res.sendStatus(404);
|
||||
|
||||
Reference in New Issue
Block a user