dev
This commit is contained in:
parent
7fb025a169
commit
ee81d840cc
12
index.js
12
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");
|
||||
|
|
|
|||
21
package-lock.json
generated
21
package-lock.json
generated
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue