a
This commit is contained in:
parent
e425c645ac
commit
96f2fdf47b
14
index.js
14
index.js
|
|
@ -105,6 +105,20 @@ app.post('/trig', async (req, res) => {
|
||||||
res.status(200).send('Call triggered');
|
res.status(200).send('Call triggered');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post('/stop', async (req, res) => {
|
||||||
|
console.log('Stopping page for phone:', req.body.phone);
|
||||||
|
// Logic to stop the page would go here.
|
||||||
|
// For now we will just log it, as the specific asterisk command to hangup a channel depends on implementation details not provided.
|
||||||
|
// 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) => { ... });
|
||||||
|
|
||||||
|
res.status(200).send('Stop request received');
|
||||||
|
});
|
||||||
|
|
||||||
app.listen(PORT, HOST, () => {
|
app.listen(PORT, HOST, () => {
|
||||||
console.log(`Server running on http://${HOST}:${PORT}`);
|
console.log(`Server running on http://${HOST}:${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
@ -61,6 +61,10 @@
|
||||||
<h1 class="text-xl font-bold text-white tracking-wide">Paging Console</h1>
|
<h1 class="text-xl font-bold text-white tracking-wide">Paging Console</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
<button onclick="stopPage()" class="bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-lg shadow-sm transition-colors duration-150 ease-in-out flex items-center gap-2">
|
||||||
|
<i class="fa-solid fa-stop"></i>
|
||||||
|
<span>Stop Page</span>
|
||||||
|
</button>
|
||||||
<div class="relative group">
|
<div class="relative group">
|
||||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||||
<i class="fa-regular fa-phone text-gray-400 group-focus-within:text-blue-400 transition-colors"></i>
|
<i class="fa-regular fa-phone text-gray-400 group-focus-within:text-blue-400 transition-colors"></i>
|
||||||
|
|
@ -148,6 +152,15 @@
|
||||||
body: JSON.stringify(payload)
|
body: JSON.stringify(payload)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stopPage() {
|
||||||
|
const phoneSelect = document.getElementById('phoneSelect');
|
||||||
|
const phone = phoneSelect.value;
|
||||||
|
fetch('/stop', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' }
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue