Impliment /stop

This commit is contained in:
Christopher Cookman 2025-12-20 21:30:08 -07:00
parent 96f2fdf47b
commit 5e2ad3a4c1

View file

@ -112,9 +112,13 @@ app.post('/stop', async (req, res) => {
// Typically it might involve 'asterisk -rx "channel request hangup <channel>"' or similar via AMI.
// Assuming we might want to run a command similar to originate but for hangup if we knew the channel.
// Since we don't have the channel ID easily available without tracking it, we might need to implement channel tracking or use a broad command.
// Example placeholder:
// exec(`/usr/sbin/asterisk -rx "channel request hangup all"`, (error, stdout, stderr) => { ... });
exec(`/usr/bin/ast_drop ${process.env.PAGE_GROUP || '9000'}`, (error, stdout, stderr) => {
if (error) {
console.error(`Error stopping page: ${error}`);
return res.status(500).send('Error stopping page');
}
console.log(`Page stopped: ${stdout}`);
});
res.status(200).send('Stop request received');
});