Skip to content

AGI (Asterisk Gateway Interface) library for Node.js

License

Notifications You must be signed in to change notification settings

teravoz/ding-dong

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ding-dong

AGI (Asterisk Gateway Interface) library for Node.js

Install

npm install https://github.com/teravoz/ding-dong.git

Usage example

Code

'use strict';

const AgiServer = require('ding-dong');

const handler = async function (context) {
  try {
    await context.answer();
    await context.streamFile('conf-adminmenu');
    await context.hangup();
  } finally {
    context.close();
  }
};

const agiServer = new AgiServer(handler, { port: 3082 });
agiServer.on('error', (err) => console.error(err));
agiServer.on('warn', (err) => console.warn(err));
agiServer.on('close', () => console.log('Internal TCP server connection closed'));
agiServer.init();
setTimeout(() => {
  agiServer.close()
    .then(() => console.log('AGI server closed'))
    .catch((err) => console.error(err));
}, 60000);

Asterisk extensions.conf

[default]
exten => 1000,1,AGI(agi://localhost:3082)

API

see API.md

Links

Asterisk AGI

About

AGI (Asterisk Gateway Interface) library for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%