mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
* K8S: dont send OPTIONS pings * fix missing ref * k8s pre-stop hook added * k8s pre-stop hook changes * chmod +x utility * more k8s pre-stop changes * pre stop * fix healthcheck * k8s pre-stop working * add readiness probe * fix bug in pre-stop * logging * revamp k8s pre-stop a bit * initial support for cognigy bot * more cognigy changes * switch to use transcribe for cognigy * #54 include callInfo in dialogflow event payload
24 lines
631 B
JavaScript
24 lines
631 B
JavaScript
const express = require('express');
|
|
const api = require('./api');
|
|
const routes = express.Router();
|
|
const sessionTracker = require('../session/session-tracker');
|
|
|
|
const readiness = (req, res) => {
|
|
const logger = req.app.locals.logger;
|
|
const {count} = sessionTracker;
|
|
const {srf} = require('../..');
|
|
const {getFreeswitch} = srf.locals;
|
|
if (getFreeswitch()) {
|
|
return res.status(200).json({calls: count});
|
|
}
|
|
logger.info('responding to /health check with failure as freeswitch is not up');
|
|
res.sendStatus(480);
|
|
};
|
|
|
|
routes.use('/v1', api);
|
|
|
|
// health check
|
|
routes.get('/health', readiness);
|
|
|
|
module.exports = routes;
|