{"_id":"@dodancs/asterisk-ami-test-server","name":"@dodancs/asterisk-ami-test-server","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.6":{"name":"@dodancs/asterisk-ami-test-server","version":"0.1.6","description":"Asterisk Ami Test Server for NodeJS \\w TypeScript support","main":"lib/AmiTestServer.js","types":"lib/AmiTestServer.d.ts","private":false,"engines":{"node":">=4.0"},"scripts":{"start":"node ./bin/amiserver","build":"tsc","move_libs":"mkdir -p lib && mv src/*.js lib/ && mv src/*.d.ts lib/","clean":"rm -rf lib/ && find . -maxdepth 2 -type f \\( -name '*.js' -o -name '*.d.ts' \\) -not -path './node_modules/*' -delete","test":"mocha ./test","coverage":"istanbul cover _mocha -- -R spec","build_and_publish":"npm run clean && npm run build && npm run move_libs && npm publish --access=public"},"directories":{"src":"./src","test":"./test"},"repository":{"type":"git","url":"git+https://github.com/dodancs/asterisk-ami-test-server.git"},"publishConfig":{"registry":"https://registry.npmjs.org"},"keywords":["voip","asterisk","ami"],"author":{"name":"Alex Voronyansky","email":"belirafon@gmail.com"},"bugs":{"email":"dominik+npmjs@dancs.sk"},"bin":{"amiserver":"bin/amiserver"},"devDependencies":{"@types/debug":"^4.1.7","@types/mocha":"^10.0.1","@types/node":"^18.13.0","@types/shortid":"^0.0.29","coveralls":"^3.1.1","istanbul":"^0.4.5","mocha":"^10.2.0","ts-node":"^10.9.1","typescript":"^4.9.5"},"dependencies":{"@dodancs/asterisk-ami-event-utils":"^0.1.5","@dodancs/asterisk-ami-events-stream":"^0.1.5","co":"^4.6.0","shortid":"^2.2.16","yargs":"^17.7.0"},"license":"MIT","gitHead":"bbea6bf5554b74932e1d20d014cb82547672a527","homepage":"https://github.com/dodancs/asterisk-ami-test-server#readme","_id":"@dodancs/asterisk-ami-test-server@0.1.6","_nodeVersion":"18.14.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-NsGXDGmI1GdpX7jmBoDu7EQAc2zB/K2iBEwMyrEcuHxS7daWfgfEmeHHfzIetHcpcx+uBniriUkhCEETiS087A==","shasum":"3332687affb27a1ea6f721a685d61b7aac989f31","tarball":"https://registry.npmjs.org/@dodancs/asterisk-ami-test-server/-/asterisk-ami-test-server-0.1.6.tgz","fileCount":6,"unpackedSize":19334,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBoWg9LKGzf04P/HHg50qbLnnq8eCJY7F8S0jcN5MXIrAiAF3hSWeA4xqomUwYLKL+/s9UkK54J+7eNyMeH3wQkJlw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj8mxUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo0pg//YKQpsXWIPkb+2J4bgi/DmbQ0BxUjydwEjMH2Hlgz0ENaUA6A\r\nQWDXAcuvs6mf5E9y0N1uHRPIXXcqDITU2GzA4MFUUqgX12moHPepZiFLbqYh\r\nkn32FVPJcBUN4opr2WXgYxkTlr+1BO2pjPPFWGpaV9sHZz3Ct7un4tRiR/jO\r\nnlgIPYqrP2hWPLpi4V+ulPbQsaJV5ngTvi8S8reMrXwM5GRghmYzRYv2cByw\r\nHmd9NF9ORoevWWnQPZH7Fmyd6Fa+1rr/1vPX6z7fs9/JsFyU4i/e7w8r6/sS\r\nNu99JY4EyKkqZci9HF8saZoK9E7Ta1u3jMlxO7p42GNFYGNz1RzabIPkSVkf\r\nlTIXOdLqqSXRFjwVwiRvE33AlSrNn4iba/rW8T0vTI6LsCiuQe/g+GEqLmOd\r\nU6mJNR6ihy9KZBAoBk03DSI5zr7IINfSZFTgfuuYNggJhO7gLveCc9vJog8R\r\nLx1hqtgfA5BKstDzO2I1hA7vz8o5y0PhX1aAnlE6gU7AV0CzFd7U7oQv9I6p\r\n3huO7CPkrwd07SpdJ+W89DS3W4cI38amcoy+sjDCUxubgeQ3DfVZsdsEuHYm\r\ndUtqJLi6MHDVwVWKy4Tq7kIr0pKfAz+sQHEuzfEtrmt/RM0bJ5iUQhh/B2u/\r\nZfkt7In3mhCTtxXtDc+kR/vC7thWoV253nQ=\r\n=//b0\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dodancs","email":"dominik+npmjs@dancs.sk"},"maintainers":[{"name":"dodancs","email":"dominik+npmjs@dancs.sk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/asterisk-ami-test-server_0.1.6_1676831828375_0.2437507428155834"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-19T18:37:08.319Z","0.1.6":"2023-02-19T18:37:08.572Z","modified":"2023-02-19T18:37:08.770Z"},"maintainers":[{"name":"dodancs","email":"dominik+npmjs@dancs.sk"}],"description":"Asterisk Ami Test Server for NodeJS \\w TypeScript support","homepage":"https://github.com/dodancs/asterisk-ami-test-server#readme","keywords":["voip","asterisk","ami"],"repository":{"type":"git","url":"git+https://github.com/dodancs/asterisk-ami-test-server.git"},"author":{"name":"Alex Voronyansky","email":"belirafon@gmail.com"},"bugs":{"email":"dominik+npmjs@dancs.sk"},"license":"MIT","readme":"# Asterisk AMI Test Server\n\n[![Build Status](https://travis-ci.org/BelirafoN/asterisk-ami-test-server.svg?branch=master)](https://travis-ci.org/BelirafoN/asterisk-ami-test-server)\n[![Coverage Status](https://coveralls.io/repos/BelirafoN/asterisk-ami-test-server/badge.svg)](https://coveralls.io/r/BelirafoN/asterisk-ami-test-server)\n[![Code Climate](https://codeclimate.com/github/BelirafoN/asterisk-ami-test-server/badges/gpa.svg)](https://codeclimate.com/github/BelirafoN/asterisk-ami-test-server)\n[![npm version](https://badge.fury.io/js/asterisk-ami-test-server.svg)](https://badge.fury.io/js/asterisk-ami-test-server)\n\n## Install \n\n```bash\n$ npm i asterisk-ami-test-server\n```\n\n## NodeJS versions \n\nsupport `>=4.0.0`\n\n## Usage \n\nServer\n\n```javascript\nconst AmiTestServer = require('asterisk-ami-test-server');\nconst server = new AmiTestServer({\n    maxConnections: 50,\n    authTimeout: 30000,\n    credentials: {\n        username: 'test',\n        secret: 'test'\n    }\n});\n\nserver\n    .on('listening', () => console.log('listening'))\n    .on('connection', authClientsCount => console.log(`authClientsCount: ${authClientsCount}`))\n    .on('error', error => console.log(error))\n    .on('close', () => console.log('close'))\n    .listen(5038);\n    \n// Asterisk AMI Test Server listening on 5038 port\n```\n\nClient \n\n```javascript\nconst CRLF = '\\r\\n';\nconst net = required('net');\nconst client = net.connect({port: 5038}, () => {\n    client\n        .once('data', chunk => {\n            console.log(chunk.toString());\n            client.destroy();\n        })\n        .write([\n            'Action: Login',\n            'Username: test',\n            'Secret: test'\n        ].join(CRLF) + CRLF.repeat(2));\n});\n```\n\n### Methods \n\n* `.broadcast(data)` - sends `data` package to all authontificated clients;\n* `.listen(port)` - start listening on `port`;\n* `.close()` - close all client's connections;\n* `.getAuthClients()` - get array of all authontificated clients;\n* `.getUnAuthClients()` - get array of all unauthontificated clients;\n* `.getClients()` - get array of all clients;\n\n## Tests \n\nTests require [Mocha](https://mochajs.org/). \n\n```bash \nmocha ./tests\n``` \n\nor with `npm` \n\n```bash\nnpm test \n```\n\nTest coverage with [Istanbul](https://gotwarlost.github.io/istanbul/) \n\n```bash\nnpm run coverage\n```\n\n## License \n\nLicensed under the MIT License","readmeFilename":"README.md"}