Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Multiple ami connections with nami (nodejs asterisk manager interface)
// Used to store different nami objects (dont worry about it)
var namis = [];
// Create your event emitter object, you will call "on()"
// on this one instead of "the namis".
var mainEventEmitter = ....;
// Assuming you have an array called "boxes" with the ami
// login info for each "ami box", and a "name" field.
for(var j = 0; j < boxes.length; j++) {
(function(i) {
var pbx = boxes[i];
var name =;
namis[i] = new namiLib.Nami(pbx);
namis[i].on('namiInvalidPeer', function (data) {
mainEventEmitter.emit('invalidPeer', { name: name, id: i });
namis[i].on('namiLoginIncorrect', function () {
mainEventEmitter.emit('loginIncorrect', { name: name, id: i });
namis[i].on('namiConnected', function (event) {
mainEventEmitter.emit('connected', { name: name, id: i });
namis[i].on('namiEvent', function (event) {
mainEventEmitter.emit('event', { name: name, id: i , event: event});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.