diff --git a/src/message/action.js b/src/message/action.js index 0f4533a..d980108 100644 --- a/src/message/action.js +++ b/src/message/action.js @@ -449,6 +449,22 @@ function GetConfigJson() { GetConfigJson.super_.call(this, 'GetConfigJson'); } +/* + * UpdateConfig Action. + * @constructor + * @see Action(String) + * @see See https://wiki.asterisk.org/wiki/display/AST/ManagerAction_UpdateConfig. + * @property {String} ActionID - ActionID for this transaction. Will be returned. + * @property {String} SrcFilename - Configuration filename to read (e.g. foo.conf). + * @property {String} DstFilename - Configuration filename to write (e.g. foo.conf) + * @property {String} Reload - Whether or not a reload should take place (or name of specific module). + * @property {String} Action-XXXXXX - Action to take. + * @augments Action + */ +function UpdateConfig() { + UpdateConfig.super_.call(this, 'UpdateConfig'); +} + /** * GetVar Action. * @constructor @@ -919,6 +935,18 @@ function QueueLog() { QueueLog.super_.call(this, 'QueueLog'); } +/** + * Events Action. + * @constructor + * @see Action(String) + * @see See https://wiki.asterisk.org/wiki/display/AST/ManagerAction_Events. + * @property {String} EventMask EventMask + * @augments Action + */ +function Events() { + Events.super_.call(this, 'Events'); +} + /** * MeetmeList Action. * @constructor @@ -1066,6 +1094,7 @@ util.inherits(Action, message.Message); (function() { var i; var actions = [ + Events, Login, Logoff, Ping, @@ -1099,6 +1128,7 @@ util.inherits(Action, message.Message); ExtensionState, GetConfig, GetConfigJson, + UpdateConfig, GetVar, SetVar, JabberSend, diff --git a/src/nami.js b/src/nami.js index f4de760..9f0c57b 100644 --- a/src/nami.js +++ b/src/nami.js @@ -45,7 +45,7 @@ function Nami(amiData) { this.amiData = amiData; this.EOL = "\r\n"; this.EOM = this.EOL + this.EOL; - this.welcomeMessage = "Asterisk Call Manager/.*" + this.EOL; + this.welcomeMessage = "Asterisk Call Manager/[0-9,.]*" + this.EOL; this.received = false; this.responses = { }; this.callbacks = { }; @@ -73,6 +73,7 @@ Nami.prototype.onRawEvent = function (event) { typeof (event.actionid) !== 'undefined' && typeof (this.responses[event.actionid]) !== 'undefined' && typeof (this.callbacks[event.actionid]) !== 'undefined' + && typeof (this.responses[event.actionid].events) !== 'undefined' ) { this.responses[event.actionid].events.push(event); if ( @@ -242,7 +243,7 @@ Nami.prototype.initializeSocket = function () { if (this.socket && !this.socket.destroyed) { this.socket.removeAllListeners(); - this.socket.end(); + this.socket.destroy(); } this.socket = new net.Socket();