awry
Version:
An ARI websocket and API client library
72 lines (51 loc) • 1.91 kB
Markdown
[![Build Status][Build Status Image]][Build Status Link]
[![Codecov][Codecov Image]][Codecov Link]
[![Known Vulnerabilities][Snyk Image]][Snyk Link]
An [Asterisk REST Interface][] websocket and API client library for node.js
v6+.
[]: https://travis-ci.org/chadxz/awry.svg?branch=master
[]: https://travis-ci.org/chadxz/awry
[]: https://img.shields.io/codecov/c/github/chadxz/awry.svg
[]: https://codecov.io/gh/chadxz/awry
[]: https://snyk.io/test/github/chadxz/awry/badge.svg
[]: https://snyk.io/test/github/chadxz/awry
[]: https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
`npm install awry`
```js
const awry = require('awry');
const api = new awry.API({
baseUrl: 'http://asterisk.local:8088/ari',
username: 'asterisk',
password: 'asterisk'
});
api.applications.list().then(apps => {
console.log(apps);
});
const events = awry.Events.connect({
app: 'someApp',
url: 'http://asterisk.local:8088/ari/events',
username: 'asterisk',
password: 'asterisk'
});
events.on('message', message => {
console.log(message);
});
```
For more details see the [full API documentation](http://chadmcelligott.com/awry).
awry uses the [debug](https://github.com/visionmedia/debug) module to log
debugging output. To enable this output to print to the console, set the
environment variable `DEBUG` to one of the following when running your app:
- `awry:*` - shows all debug output from this library.
- `awry:ARIWebSocket` - shows only the debug output from the ARIWebSocket
sub-module.
- `awry:ReconnectingWebSocket` - shows only the debug output from the
ReconnectingWebSocket sub-module.
For example: `DEBUG=awry:* node myapp.js`
See [CONTRIBUTING.md](CONTRIBUTING.md).
[](LICENSE-MIT)