UNPKG

nami-raw

Version:

Minor fork of NAMI. It adds a raw event emitter and ability to subscribe to events on connect, sets keepalive. Original Description: An asterisk manager interface client, uses EventEmitter to communicate events, will allow you to send actions, and recei

66 lines (65 loc) 6.84 kB
{ "author": { "name": "Blake Robertson", "email": "dev@callinize.com", "url": "http://marcelog.github.com/" }, "name": "nami-raw", "description": "Minor fork of NAMI. It adds a raw event emitter and ability to subscribe to events on connect, sets keepalive. Original Description: An asterisk manager interface client, uses EventEmitter to communicate events, will allow you to send actions, and receive responses (and associated events), and also receive async events from server", "version": "0.6.3", "homepage": "https://github.com/marcelog/Nami", "keywords": [ "asterisk", "manager", "interface", "nami", "action", "response", "event", "node", "AMI", "node-ami" ], "repository": { "type": "git", "url": "git://github.com/marcelog/Nami.git" }, "main": "src/nami", "scripts": { "test": "index" }, "engines": { "node": ">=0.6.5" }, "dependencies": { "log4js": "0.3.9" }, "devDependencies": {}, "contributors": [ { "name": "Marcelo Gornstein", "email": "marcelog@gmail.com", "url": "http://marcelog.github.com" }, { "name": "Blake Robertson", "email": "dev@callinize.com", "url": "http://www.callinize.com" }, { "name": "Patrick Hogan", "email": "dev@callinize.com", "url": "http://www.callinize.com" } ], "readme": "Introduction\n------------\n\nFor API and docs, check out the homepage at http://marcelog.github.com/Nami\n\nYou can also download the distribution and doc from the CI server, at:\nhttp://ci.marcelog.name:8080/view/NodeJS/\n\nA very similar, PHP alternative, is available at http://marcelog.github.com/PAMI\nAn Erlang port is available at https://github.com/marcelog/erlami\n\nNami by itself is just a library that allows your nodejs code to communicate to\nan Asterisk Manager Interface (AMI). However, it includes a full application\nuseful to monitor an asterisk installation.\n\nYou will be able to login, receive asynchronous events, and send actions (also,\nasynchronously receiving the according response with their optional related\nevents).\n\nThis is supported by the Nami class (er.. function) which inherits from\nEventEmitter, so your application is able to subscribe to the interesting nami\nevents. \n\nRequirements\n------------\n * Nodejs (Tested with 0.6.5)\n * log4js (For logging, tested with 0.3.9)\n\nEvents used in Nami\n-------------------\n* namiConnected: Emitted when nami could successfully connect and logged in to\nan AMI server.\n\n* namiConnection: Emitted for all connection related events. Listen to this \ngeneric event for the status of the socket connection.\n\n* namiConnection(EventName): Emitted for the status of the connection. States \ninclude: `Connect`, `End`, `Error`, `Timeout`, and `Close`. The `Error` event\nwill emit right before the `Close` event and includes the error that was thrown. \nThe `Close` event includes a boolean value (`had_error`) if an error was thrown. \n\n* namiEvent: Emitted for all events. Listen to this generic event if you want\nto catch any events.\n\n* namiEvent(EventName): These events are thrown based on the event name\nreceived. Let's say nami gets an event named \"Dial\", \"VarSet\", or \"Hangup\".\nThis will emit the events: \"namiEventDial\", \"namiEventVarSet\", and\n\"NamiEventHangup\".\n\n* namiLoginIncorrect: Emitted when the login action fails (wrong password,\netc).\n\n* namiInvalidPeer: Emitted if nami tried to connect to anything that did not\nsalute like an AMI 1.1, 1.2, or 1.3.\n\nInternal Nami events\n--------------------\n* namiRawMessage: Whenever a full message is received from the\nAMI (delimited by double crlf), this is emitted to invoke the decode routine.\nAfter namiRawMessage, the decodification routine runs to properly identify this\nmessage as a response, an event that belongs to a response, or an async event\nfrom server.\n\n* namiRawEvent: Emitted when the decodification routine \nclassified the received message as an async event from server.\n\n* namiRawResponse: Emitted when the decodification routine classified the\nreceived message as a response to an action.\n\nInstallation\n------------\n$ npm install log4js\n$ npm install nami\n\n -or-\nDownload it from this repo :)\n\nConfiguration\n-------------\nNami expects a configuration object, very much like this:\nvar namiConfig = {\n host: \"amihost\",\n port: 5038,\n username: \"admin\",\n secret: \"secret\"\n};\n\nQuickstart\n----------\n$ mkdir testnami\n$ npm install log4js\n$ npm install nami\n\nvar nami = new (require(\"nami\").Nami)(namiConfig);\nnami.on('namiEvent', function (event) { });\nnami.on('namiEventDial', function (event) { });\nnami.on('namiEventVarSet', function (event) { });\nnami.on('namiEventHangup', function (event) { });\nprocess.on('SIGINT', function () {\n nami.close();\n process.exit();\n});\nnami.on('namiConnected', function (event) {\n nami.send(new namiLib.Actions.CoreShowChannelsAction(), function(response){\n logger.debug(' ---- Response: ' + util.inspect(response));\n });\n});\nnami.open();\n\nA Better example\n----------------\nSee src/index.js for a better example (including how to reconnect when the\ncurrent connection closes).\n\nThat's about it.\n\nMultiple server support\n-----------------------\nSee [this gist](https://gist.github.com/4063103) for an example of how to\nconnect to multiple asterisk boxes.\n\nSupported Actions (Check the api for details)\n---------------------------------------------\nLogin\nLogoff\nPing\nHangup\nCoreShowChannels\nCoreStatus\nCoreSettings\nStatus\nDahdiShowChannels\nListCommands\nAbsoluteTimeout\nSipShowPeer\nSipShowRegistry\nSipQualifyPeer\nSipPeers\nAgentLogoff\nAgents\nAttendedTransfer\nChangeMonitor\nCommand\nCreateConfig\nDahdiDialOffHook\nDahdiDndOff\nDahdiDndOn\nDahdiHangup\nDahdiRestart\nDbDel\nDbDeltree\nDbGet\nDbPut\nExtensionState\nGetConfig\nGetConfigJson\nGetVar\nSetVar\nJabberSend\nListCategories\nPauseMonitor\nLocalOptimizeAway\nReload\nPlayDtmf\nPark\nParkedCalls\nMonitor\nModuleCheck\nModuleLoad\nModuleReload\nModuleUnload\nMailboxCount\nMailboxStatus\nVoicemailUsersList\nOriginate\nRedirect\nUnpauseMonitor\nStopMonitor\nShowDialPlan\nSendText\nQueues\nQueueUnpause\nQueuePause\nQueueSummary\nQueueStatus\nQueueRule\nQueueRemove\nQueueAdd\nQueueLog\n\nThanks to\n--------\n* Joshua Elson for his help in trying and debugging in loaded asterisk servers\nand testing with node 0.6.5 and newer npm versions\n* Jon Hoult for his help in testing with AMI 1.2\n\n\n", "readmeFilename": "README", "bugs": { "url": "https://github.com/marcelog/Nami/issues" }, "_id": "nami-raw@0.6.3", "_from": "nami-raw@>=0.6.3", "dist": { "shasum": "6b84ade06c89c9d2dd337a7d8ddaf5879bf23137" } }