mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-12 09:19:34 +00:00
remove call to clear channels
This commit is contained in:
6
app.js
6
app.js
@@ -125,16 +125,14 @@ function handle(signal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.JAMBONZ_CLEANUP_INTERVAL_MINS) {
|
if (process.env.JAMBONZ_CLEANUP_INTERVAL_MINS) {
|
||||||
const {clearFiles, clearChannels} = require('./lib/utils/cron-jobs');
|
const {clearFiles} = require('./lib/utils/cron-jobs');
|
||||||
|
|
||||||
/* cleanup orphaned files or channels every so often */
|
/* cleanup orphaned files or channels every so often */
|
||||||
setTimeout(async() => {
|
setTimeout(async() => {
|
||||||
try {
|
try {
|
||||||
await clearFiles();
|
await clearFiles();
|
||||||
const count = await clearChannels();
|
|
||||||
if (count > 0) logger.info(`app.js: cleared ${count} orphaned channels`);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error({err}, 'app.js: error clearing files and channels');
|
logger.error({err}, 'app.js: error clearing files');
|
||||||
}
|
}
|
||||||
}, 1000 * 60 * (process.env.JAMBONZ_CLEANUP_INTERVAL_MINS || 60));
|
}, 1000 * 60 * (process.env.JAMBONZ_CLEANUP_INTERVAL_MINS || 60));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const clearChannels = () => {
|
|||||||
const pwd = fsInventory[0].secret;
|
const pwd = fsInventory[0].secret;
|
||||||
const maxDurationMins = process.env.JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS || 180;
|
const maxDurationMins = process.env.JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS || 180;
|
||||||
|
|
||||||
const calls = execSync(`sudo /usr/local/freeswitch/bin/fs_cli -p ${pwd} -x "show calls"`, {encoding: 'utf8'})
|
const calls = execSync(`/usr/local/freeswitch/bin/fs_cli -p ${pwd} -x "show calls"`, {encoding: 'utf8'})
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((line) => line.match(/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{8}/))
|
.filter((line) => line.match(/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{8}/))
|
||||||
.map((line) => {
|
.map((line) => {
|
||||||
@@ -33,7 +33,7 @@ const clearChannels = () => {
|
|||||||
if (calls.length > 0) {
|
if (calls.length > 0) {
|
||||||
logger.debug(`clearChannels: clearing ${calls.length} old calls longer than ${maxDurationMins} mins`);
|
logger.debug(`clearChannels: clearing ${calls.length} old calls longer than ${maxDurationMins} mins`);
|
||||||
for (const call of calls) {
|
for (const call of calls) {
|
||||||
const cmd = `sudo /usr/local/freeswitch/bin/fs_cli -p ${pwd} -x "uuid_kill ${call.uuid}"`;
|
const cmd = `/usr/local/freeswitch/bin/fs_cli -p ${pwd} -x "uuid_kill ${call.uuid}"`;
|
||||||
const out = execSync(cmd, {encoding: 'utf8'});
|
const out = execSync(cmd, {encoding: 'utf8'});
|
||||||
logger.debug({out}, 'clearChannels: command output');
|
logger.debug({out}, 'clearChannels: command output');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user