From ee81d840cc111615f13346120dd07329f8b3c36b Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 21 Jun 2026 23:34:20 -0600 Subject: [PATCH] dev --- index.js | 12 +++++++----- package-lock.json | 21 ++++++++++++++++++++- package.json | 4 +++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 7d1ca94..905a29b 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ -const agi = require("asteriskagi") -const x = new agi({port: 4578}) +require("dotenv").config({ quiet: true }); +const agi = new require("asteriskagi")({port: process.env.AGI_PORT || 4573}) +const ami = new require("asterisk-ami")(process.env.AMI_PORT, process.env.AMI_HOST, process.env.AMI_USER, process.env.AMI_PASS, true); -x.on('call', async (call) => { +agi.on('call', async (call) => { const { remoteServer, uniqueid, context, extension, priority, calleridname, callerid, channel } = call; call.on("hangup", () => { console.log(`Hangup ${remoteServer}/${channel}`); @@ -12,8 +13,9 @@ x.on('call', async (call) => { }); console.log(`Call from ${callerid} (${calleridname}) to ${extension} in context ${context} on channel ${channel} with uniqueid ${uniqueid}`); - - await call.Playback("beep"); + setInterval(() => { + call.Playback("beep"); + }, 1500) while (true) { await call.Read("EXTEN_INPUT,,1,,10000"); const exten = await call.getVariable("EXTEN_INPUT"); diff --git a/package-lock.json b/package-lock.json index 27300e9..8ee9d30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,33 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "asteriskagi": "^1.2.2" + "asterisk-manager": "^0.2.0", + "asteriskagi": "^1.2.2", + "dotenv": "^17.4.2" } }, + "node_modules/asterisk-manager": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/asterisk-manager/-/asterisk-manager-0.2.0.tgz", + "integrity": "sha512-drPPaG18ZZx1+E8rSzWxzh5fmJw0poSWgsu4HHT/UWlvFmqCwtfBZILpdsDDGhD43ughWYxC0cmR7KirHDPaww==" + }, "node_modules/asteriskagi": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/asteriskagi/-/asteriskagi-1.2.2.tgz", "integrity": "sha512-ICkNVQAp+c6WR35bPEugY/tjlPIx2Q7JACUPhFu+TYyKFK5+q40BjpCPHAANh7jhd0XAOLmlUTDu/qtyb85ISg==", "license": "MIT" + }, + "node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } } } } diff --git a/package.json b/package.json index 4acf401..51eff11 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "license": "ISC", "type": "commonjs", "dependencies": { - "asteriskagi": "^1.2.2" + "asterisk-manager": "^0.2.0", + "asteriskagi": "^1.2.2", + "dotenv": "^17.4.2" } }