# node-rayo

> NodeJS client for the popular Rayo protocol

Latest version **0.0.2** (published 2012-02-09) · 0 weekly downloads

## Install

```sh
npm install node-rayo
pnpm add node-rayo
yarn add node-rayo
bun add node-rayo
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2012-02-09 |
| First published | 2012-02-09 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Fractal |
| Maintainers | fractal |

## Links

- npm: https://www.npmjs.com/package/node-rayo
- Repository: https://github.com/rayo/node-rayo
- Homepage: http://github.com/rayo/node-rayo
- npm.io page: https://npm.io/package/node-rayo

## Dependencies (2)

- [jab](https://npm.io/package/jab.md) *
- [coffee-script](https://npm.io/package/coffee-script.md) *

## Recent versions

- 0.0.2 (latest) — 2012-02-09

## README

node-rayo is a node client for the popular [Rayo](https://github.com/rayo/) protocol

## Installation
    
To install and use node-rayo, use [npm](http://github.com/isaacs/npm):

    $ npm install node-rayo

### Dependencies

**node-rayo** depends on the [jab](https://github.com/wearefractal/jab) xmpp library which has some native dependencies for XML processing.

#### Ubuntu/Debian
```
sudo apt-get install libexpat1 libexpat1-dev libicu-dev -y
```

#### Fedora/Red Hat
```
sudo yum install expat expat-devel libicu libicu-devel -y
```

#### Windows
Download and install [this file](http://downloads.sourceforge.net/project/expat/expat_win32/2.0.1/expat-win32bin-2.0.1.exe)

#### Mac OSX
```
curl -O http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
tar xzvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure
make
make check
sudo make install
cd ..
source /etc/profile
```

## Usage

Include node-rayo:

```javascript
var rayo = require('node-rayo');
```

To get started, create a connection with `rayo.Connection()`:

```javascript
conn = new rayo.Connection({
  host: 'prism.host.com',
  jabberId: 'youruser@jabber.org',
  jabberPass: 'pass',
  debug: false,
  ping: true   
});
```

You can then use `conn.create()` to create a Rayo command:

```javascript
dial = conn.create('dial', {
  to: 'sip:someuser@sip2sip.info',
  from: 'sip:rayo@test.net'
});

```

Once your command is created, you can listen to events specific to that command:

```javascript
dial.on('ringing', function(cmd) {
  return log.info("Call ringing...");
});
dial.on('answered', function(cmd) {
  return log.info("Call answered!");
});
```

And then send that command (note dial, component and mixer commands require `command.listen(cmd.id);` to wire up event handlers):
  
```javascript
return conn.send(dial, function(cmd) {
  return dial.listen(cmd.id);
});
```

Finally, connect!

```javascript
conn.connect();
```

## Examples

You can view more complete examples in both CoffeeScript and JavaScript in the [examples folder.](https://github.com/rayo/node-rayo/tree/master/examples)

---
_Source: https://npm.io/package/node-rayo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
