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

This branch is 9 commits ahead of, 2 commits behind antirek/ding-dong:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e4ddf58 · Jun 12, 2019

History

76 Commits
Apr 30, 2019
Jun 12, 2019
Jun 12, 2019
Apr 29, 2019
Nov 16, 2017
Jan 5, 2019
Jun 23, 2015
Jan 10, 2015
Oct 24, 2014
May 1, 2019
Apr 30, 2019

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%