Giter Club home page Giter Club logo

ast-monitor's Introduction

ast-monitor

Ast-Monitor is a module to monitor events on Asterisk Manager Interface.

It simplify the task to get certain events link a call and its parts (called and caller channels) and join, clean and re-emit the event with a new object.

Use

const mon = require('ast-monitor')(AMI_PORT, AMI_HOST, AMI_USER, AMI_PASS, ARRAY_ITEMS_TO_MONITOR);
  • AMI_PORT: is the Asterisk Manager Interface port. Usually is 5038
  • AMI_HOST: the IP Address of your Asterisk
  • AMI_USER: the Asterisk Manager User defined on your /etc/asterisk/manager.conf
  • AMI_PASS: the Asterisk Manager User Password
  • ARRAY_ITEMS_TO_MONITOR: this is an array with the items you want monitor. It can be: trunks or peers
    • the array content can be a string with the item like peers, that means Monitor all peers, or an object with an array list of peer you want monitor like {'peers': ['8020','8021']} that means Monitor the peers 8020 and 8021
const mon = require('ast-monitor')('5038','192.168.10.252','snep','sneppass',[{'peers':['8029','8014']}]);

mon.events.on('online', function(data){
	console.log('Online: %s', JSON.stringify(data));
});

mon.events.on('offline', function(data){
	console.log('Offline: %s', JSON.stringify(data));
});

mon.events.on('oncall', function(data){
	console.log('OnCall: %s', JSON.stringify(data));
});

mon.events.on('hangup', function(data){
	console.log('Hangup: %s', JSON.stringify(data));
});

mon.events.on('state', function(data){
	console.log('State: %s', JSON.stringify(data));
});
mon.events.on('connected', function(data){
	console.log('Connected:');
	console.log(data);
});

mon.events.on('error', function(data){
	console.log('error:');
	console.log(data);
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.