From 5e2ad3a4c1e4f03d4cc307f987a8af6b21fcf65e Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sat, 20 Dec 2025 21:30:08 -0700 Subject: [PATCH] Impliment /stop --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index c86015a..cf260b5 100644 --- a/index.js +++ b/index.js @@ -112,9 +112,13 @@ app.post('/stop', async (req, res) => { // Typically it might involve 'asterisk -rx "channel request hangup "' 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'); });