28 lines
806 B
JavaScript
28 lines
806 B
JavaScript
const agi = require("asteriskagi")
|
|
const x = new agi({port: 4578})
|
|
|
|
x.on('call', async (call) => {
|
|
const { remoteServer, uniqueid, context, extension, priority, calleridname, callerid, channel } = call;
|
|
call.on("hangup", () => {
|
|
console.log(`Hangup ${remoteServer}/${channel}`);
|
|
});
|
|
|
|
call.on("error", (err) => {
|
|
console.error(`ERROR: ${remoteServer}/${channel}: ${err}`);
|
|
});
|
|
|
|
|
|
console.log(JSON.stringify(call))
|
|
await call.Answer();
|
|
console.log("answered")
|
|
await call.Wait(3);
|
|
console.log("waited")
|
|
await call.SayDigits("1234");
|
|
console.log("said digits")
|
|
await call.Playback('beep')
|
|
console.log("played")
|
|
const test = await call.Read("beep", 1)
|
|
console.log("read", test)
|
|
await call.Hangup()
|
|
console.log("hung up")
|
|
}) |