src/nami.js
function Nami(amiData) {
    var self = this;
    Nami.super_.call(this);
    this.logLevel = 3; // debug level by default.

    var genericLog = function(minLevel, fun, msg) {
        if(self.logLevel >= minLevel) {
            fun(msg);
        }
    };
    this.logger = amiData.logger || {
        error: function(msg) { genericLog(0, console.error, msg)},
        warn: function(msg) { genericLog(1, console.warn, msg)},
        info: function(msg) { genericLog(2, console.info, msg)},
        debug: function(msg) { genericLog(3, console.log, msg)}
    };
    this.connected = false;
    this.amiData = amiData;
    this.EOL = "\r\n";
    this.EOM = this.EOL + this.EOL;
    this.welcomeMessage = "Asterisk Call Manager/.*" + this.EOL;
    this.received = false;
    this.responses = { };
    this.callbacks = { };
    this.on('namiRawMessage', this.onRawMessage);
    this.on('namiRawResponse', this.onRawResponse);
    this.on('namiRawEvent', this.onRawEvent);
}
function Nami(amiData) {
    var self = this;
    Nami.super_.call(this);
    this.logLevel = 3; // debug level by default.

    var genericLog = function(minLevel, fun, msg) {
        if(self.logLevel >= minLevel) {
            fun(msg);
        }
    };
    this.logger = amiData.logger || {
        error: function(msg) { genericLog(0, console.error, msg)},
        warn: function(msg) { genericLog(1, console.warn, msg)},
        info: function(msg) { genericLog(2, console.info, msg)},
        debug: function(msg) { genericLog(3, console.log, msg)}
    };
    this.connected = false;
    this.amiData = amiData;
    this.EOL = "\r\n";
    this.EOM = this.EOL + this.EOL;
    this.welcomeMessage = "Asterisk Call Manager/.*" + this.EOL;
    this.received = false;
    this.responses = { };
    this.callbacks = { };
    this.on('namiRawMessage', this.onRawMessage);
    this.on('namiRawResponse', this.onRawResponse);
    this.on('namiRawEvent', this.onRawEvent);
}
function Nami ( amiData ) { var self = this ; Nami . super_ . call ( this ) ; this . logLevel = 3 ; // debug level by default. var genericLog = function ( minLevel , fun , msg ) { if ( self . logLevel >= minLevel ) { fun ( msg ) ; } } ; this . logger = amiData . logger || { error : function ( msg ) { genericLog ( 0 , console . error , msg ) } , warn : function ( msg ) { genericLog ( 1 , console . warn , msg ) } , info : function ( msg ) { genericLog ( 2 , console . info , msg ) } , debug : function ( msg ) { genericLog ( 3 , console . log , msg ) } } ; this . connected = false ; this . amiData = amiData ; this . EOL = "\r\n" ; this . EOM = this . EOL + this . EOL ; this . welcomeMessage = "Asterisk Call Manager/.*" + this . EOL ; this . received = false ; this . responses = { } ; this . callbacks = { } ; this . on ( 'namiRawMessage' , this . onRawMessage ) ; this . on ( 'namiRawResponse' , this . onRawResponse ) ; this . on ( 'namiRawEvent' , this . onRawEvent ) ; }
Nami client.
@constructor
@param {object} amiData The configuration for ami.
@augments EventEmitter
Nami client .