Asterisk AMI client for node.js
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
README.md
package.json

README.md

Build Status

node-ami

node.js JavaScript client to communicate with an __A__sterisk __M__anager __I__nterface

install

npm install ami

use

//require
var Client = require('ami').Client;

var port = 5038; //default AMI port
var host = 'localhost';
var client = new Client();
//connect to AMI server
client.connect(port, host, function onConnection(err) {
  if(err) throw err; 

  //create the login action (plain javascript object)
  var login = {
    action: 'login',
    username: 'brian',
    secret: 'shhh!'
  }

  //send the action to asterisk and handle the response
  client.send(login, function(err, response) {

  })
})

//subscribe to all AMI messages (responses and events)
client.on('message', function(msg) {
  //message will be plain javascript object
  //in the case of our login response message:
  assert.equal(msg.actionID, '0');
  assert.equal(msg.response, 'Success');
  assert.equal(msg.message, 'Authentication accepted');
})

more info

Very much a work in progress. Would love contributions.

AMI documentation

more, more info

Fork & contribute! Open Source is awesome.

license

unlicense