mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
add custom headers to outdial, save unique uuid for running FS to redis
This commit is contained in:
@@ -106,5 +106,6 @@
|
||||
"Replaced": "replaced"
|
||||
},
|
||||
"MAX_SIMRINGS": 10,
|
||||
"BONG_TONE": "tone_stream://v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"
|
||||
"BONG_TONE": "tone_stream://v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)",
|
||||
"FS_UUID_SET_NAME": "fsUUIDs"
|
||||
}
|
||||
|
||||
@@ -63,7 +63,12 @@ class SingleDialer extends Emitter {
|
||||
async exec(srf, ms, opts) {
|
||||
opts = opts || {};
|
||||
opts.headers = opts.headers || {};
|
||||
opts.headers = {...opts.headers, 'X-Call-Sid': this.callSid};
|
||||
opts.headers = {
|
||||
...opts.headers,
|
||||
'X-Jambonz-Routing': this.target.type,
|
||||
'X-Jambonz-FS-UUID': srf.locals.fsUUID,
|
||||
'X-Call-Sid': this.callSid
|
||||
};
|
||||
this.ms = ms;
|
||||
let uri, to;
|
||||
try {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
const assert = require('assert');
|
||||
const noopLogger = {info: () => {}, error: () => {}};
|
||||
const {LifeCycleEvents} = require('./constants');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const {LifeCycleEvents, FS_UUID_SET_NAME} = require('./constants');
|
||||
const Emitter = require('events');
|
||||
const debug = require('debug')('jambonz:feature-server');
|
||||
const noopLogger = {info: () => {}, error: () => {}};
|
||||
|
||||
module.exports = (logger) => {
|
||||
logger = logger || noopLogger;
|
||||
@@ -89,9 +90,13 @@ module.exports = (logger) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const {srf} = require('../..');
|
||||
if (process.env.K8S) {
|
||||
logger.info('disabling OPTIONS pings since we are running as a kubernetes service');
|
||||
const {addToSet} = srf.locals.dbHelpers;
|
||||
const uuid = srf.locals.fsUUID = uuidv4();
|
||||
addToSet(FS_UUID_SET_NAME, uuid)
|
||||
.catch((err) => logger.info({err}, `Error adding ${uuid} to set ${FS_UUID_SET_NAME}`));
|
||||
}
|
||||
else {
|
||||
// OPTIONS ping the SBCs from each feature server every 60 seconds
|
||||
@@ -102,7 +107,6 @@ module.exports = (logger) => {
|
||||
|
||||
// initial ping once we are up
|
||||
setTimeout(async() => {
|
||||
const {srf} = require('../..');
|
||||
|
||||
// if SBCs are auto-scaling, monitor them as they come and go
|
||||
if (!process.env.JAMBONES_SBCS) {
|
||||
|
||||
Reference in New Issue
Block a user